I'm not sure if this is in the right sub-forums. If not, please move it.
If I were given two points (x,y) and (x',y'), how can I determine the angle they form? Let's assume that (x,y) is the vertex of the angle, and the other line the angle is to be measured from is (x+1,y). If the angle is to be defined by the area swept from (x+1,y), pivoting around (x,y) is a counterclockwise direction, and reaching the line connecting (x,y) and (x',y'), how would one calculate the angle?
Welcome to ScienceForums.Net!
|
After you've registered, come in and introduce yourself, or visit the forum index. If you need any help registering, posting, or if you just have some questions about our site, please feel free to contact us at staff at scienceforums dot net.
|
|
| Guest Message © 2012 DevFuse | |
Page 1 of 1
given 2 points, calculate angle
#3 30 August 2010 - 10:04 AM
You can use the dot product to calculate the angle between two vectors. However, you have to be careful how you choose your vectors if you want the specific angle you were talking about.
This applies to the above post and any new ideas or media presented in it.
- "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started.
- "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started.
- Posts: 609 | Joined: 03-October 07
Reply
#4 30 August 2010 - 10:49 PM
Thanks both,
The dot product works for angles from 0 to 180, but beyond that it starts repeating. For example, if (x',y') = (-1,-1) and (x,y) = (0, 0), then theta = 2.356, but if I set (x',y') = (-1,1) then theta = 2.356 - exactly the same. Obviously, I can deduce the angle on the other side by subtracting this result from 2*pi, but it would be best if I had a formula in which I didn't have to do this - the reason being I'm implementing this into a computer program, and I can't just tell it to "eye ball" the angle to tell whether or not it needs to subtract the result from 2*pi. What I need is a formula that gives results that span the whole range from 0 degrees to 360.
Fuzzwood,
Would your suggestion do this? I'm not sure what you mean by "finding the intersecting point". Do you mean the vertex (which wouldn't necessarily be at the origin)?
The dot product works for angles from 0 to 180, but beyond that it starts repeating. For example, if (x',y') = (-1,-1) and (x,y) = (0, 0), then theta = 2.356, but if I set (x',y') = (-1,1) then theta = 2.356 - exactly the same. Obviously, I can deduce the angle on the other side by subtracting this result from 2*pi, but it would be best if I had a formula in which I didn't have to do this - the reason being I'm implementing this into a computer program, and I can't just tell it to "eye ball" the angle to tell whether or not it needs to subtract the result from 2*pi. What I need is a formula that gives results that span the whole range from 0 degrees to 360.
Fuzzwood,
Would your suggestion do this? I'm not sure what you mean by "finding the intersecting point". Do you mean the vertex (which wouldn't necessarily be at the origin)?
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones."
-Albert Einstein
-Albert Einstein
- Posts: 953 | Joined: 23-October 04
Reply
#5 31 August 2010 - 01:56 AM
I think you need to find the angle that the line joining the two points makes with the x axis.
In that case find the tan by:
y'-y/x'-x
then search the trigonometric tables for the angle
In that case find the tan by:
y'-y/x'-x
then search the trigonometric tables for the angle
(x-a)(x-b)(x-c)(x-d)..............(x-z)= 0 know why?:eyebrow::eyebrow:>:D:eyebrow::eyebrow:
- Posts: 83 | Joined: 20-April 10
Reply
#6 5 September 2010 - 09:12 AM
If the angle with the x-axis is what you want, it's easier to calculate the inverse tan of the slope. But again, be careful; if the angle is larger than 90°, the angle will be negative, and you have to add it, or subtract it's absolute value, to/from 180°.
This applies to the above post and any new ideas or media presented in it.
- "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started.
- "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started.
- Posts: 609 | Joined: 03-October 07
Reply
Share this topic:
Page 1 of 1

Help
Sign In »
Register Now!













