/// <summary> /// Creates (or finds an existing) vertex for the given position /// </summary> /// <param name="position"></param> /// <returns></returns> public static Vertex GetVertexForPosition(OcTree <Vertex> vertexCollection, Vec3d position) { var vertex = new Vertex { Position = position }; if (vertexCollection.Insert(vertex, position)) { return(vertex); } return(vertexCollection.FindClosest(position)); }