def project_vertex(self, pnt_or_vertex): ''' returns the closest orthogonal project on `pnt` on edge ''' if isinstance(pnt_or_vertex, TopoDS_Vertex): pnt_or_vertex = vertex2pnt(pnt_or_vertex) poc = GeomAPI_ProjectPointOnCurve(pnt_or_vertex, self.curve_handle) return poc.LowerDistanceParameter(), poc.NearestPoint()
def project_point_on_curve(crv, pnt): if isinstance(crv, TopoDS_Shape): # get the curve handle... crv = adapt_edge_to_curve(crv).Curve().Curve() else: raise NotImplementedError('expected a TopoDS_Edge...') rrr = GeomAPI_ProjectPointOnCurve(pnt, crv) return rrr.LowerDistanceParameter(), rrr.NearestPoint()
def lower_distance_parameter(self, pnt): """Evalute parameter of curve's point that has minimal distance to pnt""" algo = GeomAPI_ProjectPointOnCurve(pnt.Pnt(), self.Curve()) return algo.LowerDistanceParameter()