Give a point on BSplineSurface or BSplineCurve, How to compute its U or V parameters?
For example,given a point P on a BSplineCurve f, how can i get its U value in opencascade?
Rob Bachrach Tue, 03/12/2013 - 18:09
Check out GeomAPI_ProjectPointOnCurve and GeomAPI_ProjectPointOnSurf. These will project your point onto the curve or surface. The LowerDistanceParameter and LowerDistanceParameters functions can retrieve your UV values.
You can also use the BRepExtrema_DistShapeShape class, which can calculate the minimum distance between two shapes, e.g. a vertex and a face. It provides methods "ParOn..." to get the corresponding u/v-parameters.
*************** to run this on a curve follow the same procedure but use the ShapeAnalysis_Curve.cxx class instead of the ShapeAnalysis_Surface class.
note: might have to make sure the point is literally on the surface, by projecting it to the surface first./ don't remember off the bat if its necessary to do this.
Tue, 03/12/2013 - 18:09
Check out GeomAPI_ProjectPointOnCurve and GeomAPI_ProjectPointOnSurf. These will project your point onto the curve or surface. The LowerDistanceParameter and LowerDistanceParameters functions can retrieve your UV values.
Tue, 03/12/2013 - 18:27
You can also use the BRepExtrema_DistShapeShape class, which can calculate the minimum distance between two shapes, e.g. a vertex and a face. It provides methods "ParOn..." to get the corresponding u/v-parameters.
Thu, 03/14/2013 - 07:38
The U and V parameter of a point on surface:
TopoDS_Shape thesurf = ...
const TopoDS_Face& aFace = TopoDS::Face (thesurf);
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
Handle(ShapeAnalysis_Surface) aSurfAna = new ShapeAnalysis_Surface (aSurf);
gp_Pnt2d pUV = aSurfAna->ValueOfUV(point, Precision::Confusion());
*************** to run this on a curve follow the same procedure but use the ShapeAnalysis_Curve.cxx class instead of the ShapeAnalysis_Surface class.
note: might have to make sure the point is literally on the surface, by projecting it to the surface first./ don't remember off the bat if its necessary to do this.
Enjoy!