I want to rotate and translate a cylindric shape in 3D space.
. My input data for the rotation is a vector giving the direction of the cylinder's axis
. The translation is given by a point.
Here is my code to achieve this :
//Initialize an AIS_InteractiveContext and a V3d_View objects.
gp_Dir axis (1, 1, 1);//the new orientation
gp_Pnt pos (50, 50, 0);//the new position
TopoDS_Shape cylinder = BRepPrimAPI_MakeCylinder (50, 100);//create the shape.
Handle_AIS_InteractiveObject cylinder_item = new AIS_Shape (cylinder);
ais_context->Display (cylinder_item, true);//display the cylinder
gp_Trsf trans;//Define the transformation
trans.SetValues (1, 0, axis.X (), pos.X (),
0, 1, axis.Y (), pos.Y (),
0, 0, axis.Z (), pos.Z (),
ais_context->SetLocation (cylinder_item, trans);//apply the transformation
The orientation of the shape is ok, as well as the position, but the cylinder get deformed, the sections are not good.
Have someone already done this before?