public static int _GetVertexIndex(this Point3d point, BrepVertexList Vertices, double tol = 10, bool throwExceptionIfNotFound = true) { double min_distance = 0; int min_index = -1; for (int i = 0; i < Vertices.Count; i++) { var v = Vertices[i]; var distance = v.Location._DistanceTo(point); if (min_index == -1 || (distance < min_distance && distance < tol)) { min_distance = distance; min_index = i; } } if (min_index == -1 && throwExceptionIfNotFound) { throw new Exception("_GetVertexIndex method cannot find vertex with specified point"); } return(min_index); }
public static int GetVertexIndex(this Point2d point, BrepVertexList Vertices, double tolerence = 0.01) { //var point3d = Trim.Face.PointAt(point.X, point.Y); return(0); }