Parallel projection of spline curves onto plane

I'm trying to project a wire onto a plane. What I need are 2d curves. My approach so far is the following:
-retrieve the 3d-curve of every edge in the wire
-project the curve onto the plane using ProjLib_ProjectOnPlane
-create a 2d curve adaptor using ProjLib_ProjectedCurve.

The problem is that ProjLib_ProjectedCurve obviously cannot project splines. In the code, there are only empty switch cases:

[code]
static void Project(ProjLib_Projector& P, Handle(Adaptor3d_HCurve)& C)
{
GeomAbs_CurveType CType = C->GetType();
switch (CType) {
case GeomAbs_Line:
P.Project(C->Line());
break;
case GeomAbs_Circle:
P.Project(C->Circle());
break;
case GeomAbs_Ellipse:
P.Project(C->Ellipse());
break;
case GeomAbs_Hyperbola:
P.Project(C->Hyperbola());
break;
case GeomAbs_Parabola:
P.Project(C->Parabola());
break;
case GeomAbs_BSplineCurve:
case GeomAbs_BezierCurve:
case GeomAbs_OtherCurve: // try the approximation
break;
default:
Standard_NoSuchObject::Raise(" ");
}
}
[/code]

Do I have to implement the call to ProjLib_ComApprox myself now? I cannot believe that I am the first person requiring to project splines onto a plane, so there must be a usable way implemented already...

a's picture

did you try to use BRepProj_Projection? In this case you can project wire or edge to face.

Fabian Hachenberg's picture

Hi,
i found out now, that ProjLib_ProjectedCurve is working for splines as well (the implementation is a bit confusing, which is why i thought it wasn't implemented)!

BrepProj_Projection doesn't do parallel projection but central projection onto cones and cylinders. See here http://mathworld.wolfram.com/CylindricalProjection.html

anton's picture

> BrepProj_Projection doesn't do parallel projection

And that is one of the strange things in BrepProj_Projection, because in my case it does paralel projection.

Andrey Betenev's picture

This is correct: in BRepProj_Projection class, "cylindrical" projection means parallel one (the infinite cylindrical surface is extruded from the curve to be projected in specified direction, and gets intersected with the target shape). Similarly, "conical" projection means that conical surface with given apex is constructed. Thus the terms have different meaning than that is described at the referred Wolfram page, which is about map projections.

The documentation of the BRepProj_Projection class shall definitely be improved to clarify this.

Ankit's picture

Hi Andrey BETENEV,
I want to do parallel projection of a polygon wire on a shape(a sewed shape from more than one faces) and get a projected shape/face out of it.

I used BRepProj_Projection but it did not work for me.

Can you suggest something??

Ankit's picture

Hi Andrey BETENEV,
I want to do parallel projection of a polygon wire on a shape(a sewed shape from more than one faces) and get a projected shape/face out of it.

I used BRepProj_Projection but it did not work for me.

Can you suggest something??

P G's picture

parallel projection should work , this is a sketchy code from test harness
implmentation to do a parallel/cylindrical projection.
--------------------------------

TopoDS_Shape InpLine ;
TopoDS_Shape InpShape ;
Standard_Real DX=atof(a[4]),DY=atof(a[5]),DZ=atof(a[6]);
gp_Dir TD(DX,DY,DZ);
BRepProj_Projection Prj(InpLine,InpShape,TD);
Standard_Integer i = 1;

if (Prj.IsDone()) {
while (Prj.More()) {
Prj.Current());
i++;
Prj.Next();
}
}

Go thru the documentation of the class.

good luck
- PG