Angle between two lines

Hi all,

Given 3 gp_Pnt objects P1, P2, P3 which are used to form two lines P1 & P2, and P2 & P3 (i.e a sector of a circle, centered at P2). Can you please suggest how I obtain the angle formed by the two lines (i.e angle of the circle sector)

Thank-you,
Suds

C R Johnson's picture

You can use the gp_Vec class. It handles this sort of vector algebra stuff.

gp_Vec v1(P2,P1);
gp_Vec v2(P2,P3);
Standard_Real angle = v1.Angle(v2);