#### Archived

This topic is now archived and is closed to further replies.

# Really dumb math problem.

This topic is 6716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok this is probably easy for you guys but i dont know how to do this. I have 2 lines. I vertical and the other one is dynamic which means it can be pointing at any direction. (x1,y1) C /\ / \ b/ \a / \ / \ (x2,y2) (x3,y3) how do i find the angle betweent them? that angle im trying to find is angle C. how do i do that? btw. both lines start out in the same direction, and if i connect the enpoints, it will make a right triangle. email me at neopnoy@yahoo.com thanks.

##### Share on other sites
Ok, well, since they both begin at the same point and form a right angled triangle, you can use the cosine ratio to find the angle.

simply call your languag''s inverse cosine function on the two lines'' lengths.

-Mezz

##### Share on other sites
I forgot the law of cosines. What is it again? And how do you the inverse or sine or cosine on the comp? What functions?

##### Share on other sites
hi
you can use dot product in order to find cosine :
let be AB the vector for the first line defined by points A(xa,ya) and B(xb,yb) and CD the vector for the second line defined by points C(xc,yc) and D(xd,yd)
so we have :

AB(xb-xa,yb-ya) CD(xd-xc,yd-yc)

AB.CD=/AB/*/CD/*cos(AB,CD)

with /AB/=sqrt((xb-xa)²+(yb-ya)²)
/CD/=sqrt((xd-xc)²+(yd-yc)²)

we have also:
AB.CD==((xb-xa)*(xd-xc))+((yb-ya)*(yd-yc))

so :
cos(AB,CD)=(((xb-xa)*(xd-xc))+((yb-ya)*(yd-yc)))/(sqrt((xb-xa)²+(yb-ya)²)*((xd-xc)²+(yd-yc)²))

in order to find sine, use cross product

AB X CD=/AB/*/CD/*sin(AB,CD)

we have also

AB X CD=a*d-b*c

so :

sin(AC,CD)=(a*d-b*c)/(sqrt((xb-xa)²+(yb-ya)²)*((xd-xc)²+(yd-yc)²))

you have to calculate both sine and cosine because for one value of cosine you have two angles : cos (alpha) = cos (-alpha)

>>And how do you the inverse or sine or cosine on the comp? What functions?
sorry i don''t know!

hope that help

lunasol

##### Share on other sites
By inverse of cosine or sine do you mean finding the angle when you know the value? If so, use acos(), asin(), and atan(). These are arc cosine, arc sine, and arc tangent.

Morgan

Thanks guys!

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 13
• 9
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
633330
• Total Posts
3011388
• ### Who's Online (See full list)

There are no registered users currently online

×