math - Finding the angle between two lines -
possible duplicate:
calculating angle between 2 lines without having calculate slope? (java)
i need find angle between 3 points. have point , point c being 2 points of ray , have point b being central point points , c extend from. if create line between points b , a, , create line between points b , c, can find angle between 2 lines.
take line direction vector a(a,a',a") , line b direction vector b(b,b',b").
a.b = ||a||.||b||.cos(t) a.b cos(t) = -------------- ||a||.||b||
take a(1,2,3) ; b(4,5,6) ; c(3,2,0) calculate angle between lines ab , ac. line ab has direction numbers (3,3,3) , line ac has direction numbers (2,0,-3). hence
6 + 0 - 9 cos(t) = ----------------- sqrt(27) .sqrt(13)
update:
use arccos(cos(t)) obtain angle. convert radians degrees multiply 180/π convert degrees radians multiply π/180
Comments
Post a Comment