I am writing a simple boat simulation and I am stuck on one part of calculating a boats speed / position. Please can someone help me with an equation?
Given a fixed speed (lets call it S - in metres per second) and a given bearing ( call it B - 0-359) - can anyone please tell me what calculation will tell me how many metres North (+ve or -ve) and how many metres East (+ve or -ve) the boat moves per second
I am sure there is rinky dink fangled equation for this - but I didn't do well in Math
Thanks for responding - I am modelling this on a theoretically flat planet so I am not taking into account any real-world variations etc. I am assuming a steady course at a constant speed for a fixed period of time. The stuff you mentioned is way over my head I just wanted to make a little boat gif move about on a JPanel
I think what I am looking for is something like "The square on the hypotenuse is equal to the sum of the squares of the other two sides" but based on only knowing the angle of the triangle and the length of the hypotenuse - yeah, I know, I should have listened in class
it's been a while, but you want the sine and the cosine of the angle. asuming 0 is due north, and you go around clockwise, the sine(angle) * speed will give you the horizontal speed, and the cosine(angle) * speed will give you the vertical.
 using your notation:
HorizontalSpeed = sine(b) * S
VerticalSpeed = cosine(b) * S [ December 22, 2005: Message edited by: fred rosenberger ]
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
If you're working on a flat plain (not the real earth) you might need to convert to polar coordinates to move and then back to cartesian. The math is over my head (music major) but I managed to use the constructs my dad gave me (math prof) to do some neat 3D motion stuff in Pascal in a former life.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi