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!
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 ?
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!
Re: given a startPoint, range and bearing, can I calculate the other point?
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).
Re: given a startPoint, range and bearing, can I calculate the other point?
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/