
Tue, 08/03/2004 - 16:05
Hi,
I use GeomAPI_ProjectOnSurf in a fucntion for generating shape meshes.
But, I meet problems. Sometimes, GeomAPI_ProjectOnSurf is unable to
generate a projected point. For instance, look at the following piece
of program.
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{
gp_Pnt O(0,0,0);
gp_Dir N(0,0,1);
gp_Dir Vx(1,0,0);
Handle_Geom_Ellipse ellipse = new Geom_Ellipse(gp_Ax2(O,N,Vx),4,2);
BRepBuilderAPI_MakeEdge edge_builder(ellipse, 0,PI/2);
TopoDS_Shape E = edge_builder.Shape();
gp_Ax1 axis(O,Vx);
BRepPrimAPI_MakeRevol mkRev(E,axis, PI/2);
if (!mkRev.IsDone())
exit(0);
gp_Pnt P(2,0,0);
TopoDS_Shape shape = mkRev->Shape();
TopTools_IndexedMapOfShape MS;
TopExp().MapShapes(shape, TopAbs_FACE, MS);
// only one generated face whose corresponding surface type is GeomSurfaceOfRevolution
Handle_Geom_Surface Surf = BRep_Tool().Surface(TopoDS::Face(MS(1)));
GeomAPI_ProjectPointOnSurf Proj(P, Surf);
for (int i = 1; i
{
gp_pnt cur = Proj.Point(i);
cout
}
}
With the point P(2,0,0), there is no projected point. With other points
like P(0,0,1) or P(0,1,0) there is three points. I don't understqnd why.
Moreover to write my meshing function, I need to be able to project any point without exception.
I hope you could hep me, thanks for advance,
Franck
Tue, 08/03/2004 - 19:50
The point 2,0,0 is on the axis of your revolution surface, so you have an infinity of solution... pick one!
Francois.
Wed, 08/04/2004 - 18:31
thanks a lot,
you're right, I didn't take care of this information. So, currently to project a point placed on the axis, I compute a vector orthogonal to this axis and I use the intersection package.
Franck.