# calculating start and end angle of arc

hi i m having a arc with its center pc, its start point pst, and end point pend.

now i want to find start angle and end angle of this arc. i ve tried it using vector method(dot product)

i ve created three vectors one(v0) point joining center and a point with increament of R in x cord of center; second(v1) vect betn pc1, pst; 3rd(v2) betn pc1 and pend...

and calculated and as

StartAng = (acos((v0.Dot(v1))/(v0.magnitude()*v1.magnitude()))*(180/PI);

EndAng = (acos((v0.Dot(v2))/(v0.magnitude()*v2.magnitude()))*(180/PI);

multiplied by 180/PI for rad to degree conversion

its geving me output but the are not as it needed...

even angles are always betn 0 t0 180 actully should be 0 to 360....

i am giving some values of center with start ang and end ang

cx cy cz st_ang end_ang
42.83 -2.4 0 90 176.793
41.3564 11.40 0 164.584 77.7906
0 0 0 15.4165 19.293
40.49 14.17 0 112.5 160.70 33.84 26.36 0 142.084 55.2906
0 0 0 37.9165

above are some sample angs

i want to know what exactly is my mistake....
if not is there any other method to get angles...

plz give me ans i m in a lot need of it

wishing a reply..... First of all the dot product is always between 0 and 180 degrees (-1 to 1).

It look's like you want to find the angles in 3D which makes it a bit more tricky, the arc is normally 2D so trying to simplify it to a 2D problems would make things easier if possible.

I guess you could use the dot product to find the angles if you create a vector from the center of the "circle" going through the circles edge at 0 degrees and then use dot with this vector and a vector through each point to find the angle, but a simpler solution would be to use something like gpVec2d::Angle, this returns the angle in radians which would be more useful to you I guess. hi thanks alot 4 reply...

i ve tried the things as u mentioned above , much before but not working as it need to be...

actually i am working on DXF conversion where i need start & end angle for arc..... now i dont know wheter the curve is a 2d or 3d... lets asume it as 3d so what i need to do to get these ang...

if any geometric processs u know plz tell me (probably i may undestand it)..... i think i need to calculate direction cosines but even i calculate that the start angle n end angle is with respect to what i mean should i cansider it with resp to x , or y or z or line joining origin and center of arc?

if u can understan it plz tell me as soon as possible