Rotate a line with an angle

Hello,

I have a line, defined with origin and direction. How is it possible to turn this line through a given angle?
Is there a special class for this purpose?

Thanks in advance
Markus

Tilman Leune's picture

hi,
you should take a look at gp_Trsf.
This is the foundation class for Transformations

an example of usage is shown in the Bottle Tutorial

Markus Hagemann's picture

Got it. Thanks for the hint.

// build a line
gp_Pnt initPoint(0.00, 0.00, 0.00);
gp_Pnt endPoint(0.00, 0.00, 1.00);
BRepBuilderAPI_MakeEdge edge1(initPoint, endPoint);
builder.Add(compound, edge1);
TopoDS_Shape lineShape(compound);

// rotate line
gp_Trsf myTrsf;
myTrsf.SetRotation(gp::OX(), alpha * (PI /180) );
BRepBuilderAPI_Transform xform(lineShape, myTrsf);
lineShape = xform.Shape();