Getting angles made by axis of cylinder with X,Y and Z axis

Hi,
I am new to opencascade and my knowledge on vectors have gotten rustic. Cylinders are constructed  using  BRepPrimAPI_MakeCylinder, with gp_Ax2, radius and height.

BRepPrimAPI_MakeCylinder(const gp_Ax2&Axes, const Standard_Real R, const Standard_Real H)

gp_Ax2 is obtained from gp_Pnt and gp_Dir. In my application, gp_Pnt and gp_Dir can be constructed from user input. My question is, should there be any restriction on the value of X, Y and Z for gp_Dir?

I am having hard time calculating the angle made by the axis of cylinder with x, y and z axes. I need the angles for some purposes. Can anybody give me an insight on how I can calculate the angles given length of axis, gp_pnt  and X,Y and Z forming gp_Dir.?

qa qa's picture

Hello,

gp_Dir represents non-null direction vector, so x*x + y*y + z*z should be greater than some small threshold.

There is a special method called "Angle" in the gp_Dir class for angles calculation. You can construct directions representing global axes using gp::DX(), gp::DY, gp::DZ methods.

qaqa