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

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

jenisha Baskota's picture

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


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.


Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.