| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to find out the angle?
Hi All,
This might be a math question. I want to find out the angle between two lines which have the same length. Line one : AB A(Xa,Ya) B(Xb,Yb) Line two : CD C(Xc,Yc) D(Xd,Yd) move A to C , so B = new_x = Xb - ( Xa-Xc ) new_y = Yb - ( Ya-Yc ) the find out the length of new_B and D dist = sqrt ( (new_x - Xd)* (new_x - Xd) + (new_y - Yd)* (new_y - Yd) ); finally, the angle = 2*( asin( dist/2/line_AB ); ================================= use: arc = degree*PI/180; sin( arc )..... cos( arc ).... this is what I have done so far, but it cannot show the corret angle. anyone can tell me what's wrong above?? |
|
#2
|
||||
|
||||
|
If both lines are the same length, then you can't use normal trig functions (sin, asin, etc) to figure out their angle because in a rt triangle, the only way to have two lines of equal length is to have the 90 degree angle right between them....
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips. ![]() |
|
#3
|
|||
|
|||
|
my idea is to divide the triangle (Isosceles) to two right triangles.
then find out the angle in one of these two right trigangle, and mutiple *2 is the answer |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > how to find out the angle? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|