|
-
Mar 5th, 2001, 04:49 AM
#1
Thread Starter
New Member
Hi I have two points on 2d plane and need to work out the angle that they create relative to +x axis..
This is what I have come up with so far but it's too long and I'm sure there is a better way..
x = DistX - SrcX
y = DistY - SrcY
if y>0 and x>0 then Angle = ATN(abs(y)/abs(x))
if y>0 and x<0 then Angle = ATN(abs(x)/abs(y)) + 90
if y<0 and x<0 then Angle = ATN(abs(y)/abs(x)) + 180
if y<0 and x>0 then Angle = ATN(abs(x)/abs(y)) + 270
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|