|
-
April 21st, 2011, 07:49 AM
#1
given a startPoint, range and bearing, can I calculate the other point?
I want to calculate the other point in a Cartesian Coordinate system. How can I do that?
Thanks!
Last edited by lab1; April 26th, 2011 at 02:49 PM.
-
April 21st, 2011, 08:08 AM
#2
Re: given a startPoint, range and bearing, can I calculate the other point?
Could you define the terms a little more ?
1) By "range", do you mean "distance" ?
2) by "bearing" , do you mean direction, and if so, what is your input ? An angle ?
Directional unit vector ?
3) 2D or 3D ?
-
April 21st, 2011, 08:29 AM
#3
Re: given a startPoint, range and bearing, can I calculate the other point?
So would this algorithm be correct:
X2=X1+(cos(angle)*distance)
Y2=Y1+(sin(angle)*distance)
Thanks!
Last edited by lab1; April 26th, 2011 at 02:48 PM.
-
April 21st, 2011, 08:37 AM
#4
Re: given a startPoint, range and bearing, can I calculate the other point?
-
April 21st, 2011, 08:41 AM
#5
Re: given a startPoint, range and bearing, can I calculate the other point?
There are some widely published equations that will give you what you are looking for... here are the 3D ones 
Code:
sx = (sin(theta_xz) * r * cos(theta_yz)) + cx
sy = (r*sin(theta_yz) ) + cy;
sz = (cos(theta_xz) * r * cos(theta_yz)) + cz
sx, sy, sz are the coordinates you are trying to calculate. cx, cy, cz are the coordinates you are at, r is euclidean distance (range in your terms). theta_xz is the angle in the xz plane (sweeping from z to x), and theta yz is the angl in the yz plane (sweeping from z to y).
-
April 22nd, 2011, 11:01 AM
#6
Re: given a startPoint, range and bearing, can I calculate the other point?
Last edited by lab1; April 26th, 2011 at 02:48 PM.
-
April 22nd, 2011, 02:44 PM
#7
Re: given a startPoint, range and bearing, can I calculate the other point?
I suspect that the problem is you're using degrees as your unit of angle, which is not what the cos function is intended for.
http://www.cplusplus.com/reference/clibrary/cmath/cos/
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
|