Emilie
asked on
angle clockwise or counterclockwise?
I am writing a program that needs to determine the angle between two line segments and whether the angle is clockwise or counterclockwise from the main segment.
How do I determine the direction of the angle from the main segment?
All the coordinates are positive numbers. The segments are of variant sizes.
The solution needs to be an equation since I will have to insert it in some code.
Thanks!
How do I determine the direction of the angle from the main segment?
All the coordinates are positive numbers. The segments are of variant sizes.
The solution needs to be an equation since I will have to insert it in some code.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Math isn't exactly my forte. Would you mind explaining how to do a cross product of vectors?
Say I have a(x,y), b(x, y) and c(x, y), how do I do the cross product of ab x cb?
Say I have a(x,y), b(x, y) and c(x, y), how do I do the cross product of ab x cb?
ASKER
The cross product would be
(bx - ax)*(cy - ay) + (by - ay)*(cx - ax)
- x * y yields a positive number
- y * x yields a negative number
(bx - ax)*(cy - ay) + (by - ay)*(cx - ax)
- x * y yields a positive number
- y * x yields a negative number
http://www.java2s.com/Open-Source/Java-Document/GIS/jts/com/vividsolutions/jts/algorithm/Angle.java.htm