some one said:
Does anyone know the algorithm or a function out there that will
compute the offset location given the following:
inputs:
1) x,y coordinate of starting point
2) angle (bearing)
3) distance to offset point
outputs:
1) x,y coordinate of destination
You know, for mathematics questions, there's always sci.math. Your
question is completely irrelevant to comp.lang.c. Anyway...
Suppose your variables are as follows:
1) x=x coordinate of starting point, y=y coordinate of starting point
2) theta=angle (bearing)
3) r=distance to offset point
Now the output:
x' = x coordinate of destination = x + r*cos(theta)
y' = y coordinate of destination = y + r*sin(theta)
Those formulas work right away as C expressions, given that you've
declared the variables as doubles and #included <math.h>.
--
/-- Joona Palaste (
[email protected]) ------------- Finland --------\
\--
http://www.helsinki.fi/~palaste --------------------- rules! --------/
"The large yellow ships hung in the sky in exactly the same way that bricks
don't."
- Douglas Adams