Thu, 02/19/2004 - 19:23
Forums:
I'm trying to find the closest point on the surface of an imported STEP object, to an XYZ point in space.
I think using GeomAPI_ProjectPointOnSurf and then NearestPoint would normally work, but the former needs a surface, and doesn't seem to like the AIS_InteractiveContext of my STEP model.
Is there another way of doing it? Can I break up my STEP model into seperate surfaces?
Any help appreciated.
Cheers,
John
Thu, 02/19/2004 - 20:36
Try using BRepExtrema_DistShapeShape. You can use the TopoDS_Shape from your STEP object and create a vertex from your point. This works better than projecting to the surface since surfaces can be infinite and faces are trimmed.
Mon, 02/23/2004 - 14:37
Thanks Rob, I'm sure that will work.
I have created my gp_Pnt and set its coordinates. How do I convert it to a vertex? It must be obvious, but the forum is full of examples of doing it the other way round!
gp_Pnt thePoint = BRep_Tool::Pnt(theVertex);
Thanks,
John
Mon, 02/23/2004 - 15:27
When creating a topological entity from scratch (vertex, edge, face, etc.), you usually use the BRepBuilderAPI_MakeXXXX function. So, to create a vertex from a gp_Pnt, use:
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(pt);
Mon, 02/23/2004 - 18:11
Thanks for your help Rob.
My closest point detection is working! (-:
John