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!

EmilieAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
Take the cross product of the vectors
0
 
EmilieAuthor Commented:
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?
0
 
EmilieAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.