For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

BRepProj_Projection wrong conical projection of curve on face

Alexei Lobanov's picture
Forums: 

Hi all,

I need in conical projection of curve on plane (e.g. circle on plane). But the result that I received is much wrong. And the result depends of size of plane - that is face builded from plane - on which I projected. Why? Projection on plane must be same regardless of size of plane. Can anybody help me! Follow my example:

gp_Pnt cPlane(0.,0.,0.); // plane center
gp_Dir nPlane(0.,0.,1.); // normal of plane
gp_Pln aPlane(cPlane,nPlane);
GC_MakePlane makePlane(aPlane);
Handle(Geom_Plane) geomPlane = makePlane.Value();
if (geomPlane.IsNull())
return;
TopoDS_Shape aPlaneShape = BRepBuilderAPI_MakeFace(geomPlane,-10.,10.,-10.,10.);

Handle(AIS_Shape) aisPlaneShape = new AIS_Shape(aPlaneShape);

// vertex of pyramid - central point
gp_Pnt aVertex(0.,0.,5.);
TopoDS_Shape aVertexShape = BRepBuilderAPI_MakeVertex(aVertex);
Handle(AIS_Shape) aisVertexShape = new AIS_Shape(aVertexShape);

// circle that have been projected
gp_Circ aCircle(gp_Ax2(gp_Pnt(0.,0.,1.),gp_Dir(0.,0.,1.)),1.);
TopoDS_Shape aCircleEdge = BRepBuilderAPI_MakeEdge(aCircle);
Handle(AIS_Shape) aisCircleShape = new AIS_Shape(aCircleEdge);

// projecting
BRepProj_Projection proj(aCircleEdge,aPlaneShape,(gp_Pnt)aVertex);
if (!proj.IsDone()){
return;
}
TopoDS_Shape aProjShape = proj.Shape();
Handle(AIS_Shape) aisProjShape = new AIS_Shape(aProjShape);

// displaying
Handle(AIS_InteractiveContext) cont = // some of earlier created;
cont->Display(aisPlaneShape);
cont->Display(aisVertexShape);
cont->Display(aisCircleShape);
cont->Display(aisProjShape);