Can anyone suggest a good forum for questions like this?======
Understanding vectors - what makes a sailboat go?
The wind is applied at an angle to the sailboat like so:
/\ / / \ / | | / | | J | | \__/
The wind force has two portions, one along the axis of the boat,
and one perpendicular to the axis. The sails catch the force
perpendicular to the keel of the boat and translate it, using
the keel to prevent the boat from sliding, into forward motion.
The drag of the boat below the waterline and the mass of the boat
determine the amount of wind force necessary to move the boat.
So, to determine the amount of forward motion a boat has, the wind
vector must be translated into the coordinate system of the boat
(y being parallel to the keel, and x being perpendicular), and the
x portion of that vector is used in the movement calculation.
Let us say that the boat is at angle ‘A’ relative to the map coordinate
system. Let us say that the wind is at angle ‘B’ relative to the map
coordinate system. We need to get angle B’ where B’ is the wind angle
in the coordinate system rotated by angle A:
Let us define the angle of orientation ‘A’ as angle from north.
Since this is the complementary angle to the standard angle for (x,y),
we have: x = sin(A) and y = cos(A)
If we rotate x and y by an angle B to get x’ and y’, defining the
rotation as an angle from north, we get:
x' = x cos(B) - y sin(B) y' = x sin(B) - y cos(B)
If we substitute our original definition, we have:
x' = sin(A) cos(B) - cos(A) sin(B) y' = sin(A) sin(B) - cos(A) cos(B)
Now all we need for the wind force perpendicular to the keel is the
absolute value of x’, our final equation is:
x' = sin(A) cos(B) - cos(A) sin(B)
Let us run a sample equation to verify our logic:
Ship is facing north-northwest (angle = 90+90+90+45+(45/2) = 337.5 degrees) The wind is blowing from due east (angle = 90 degrees)
First, we need to convert degrees to radians:
337.5 X ship angle = ----- = --- = X*360 = 337.5*2*PI 360 2*PI 337.5*2*PI 337.5*PI ship angle = --------- = -------- = 1.875*PI 360 180 90*PI wind angle = ----- = 0.5*PI 180
So, substituting our formula, we have:
x' = sin(1.875*PI) cos(0.5*PI) - cos(1.875*PI) sin(0.5*PI)
Logically we would have slightly less wind force than if the boat
were aligned directly north, i.e. x’ should be slightly less than 1.
Solving the calculation gives us:
x' = 0.1026 * 0.9985 - 0.9947 * 0.0274 = 0.0752
Something is obviously wrong.
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec