# Trig problem

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.

See ya!
-Sam Lantinga (slouken at devolution.com)

## Lead Programmer, Loki Entertainment Software

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Sam Lantinga schrieb am 13 Feb 2000:

Can anyone suggest a good forum for questions like this?

======

Understanding vectors - what makes a sailboat go?

The Algorithms Mailing List <algorithms at 3dgamedev.com>

The algorithms mailing list is run by 3dGamedev.com . List discussions
include topics relating to Real-time algorithms and there use in
real-time gaming and simulations. The list has moderate traffic
averaging about 60-100 E-mails a day. Members of this list include
professional game developers, skilled amateurs, researchers and
students. Topics range from Real-time Physics, 3d Geometry
Transformations, terrain algorithms, and Run-time Level of Detail
(LOD).

The official charter for the algorithms mailing list is located at
http://www.3dgamedev.com/lists/algo_charter.asp

Hi,
Hope nobody minds me posting to the list.
Thought I’ll reply since I got an answer close to 1!!Instead of rotating axis and stuff,If the
boat’s axis makes an angle A with some co-ord. system and the wind an angle B with the same co-ord
system,
The angle that the wind makes the axis of the boat = Relative measurement = (B-A).So the
angle the wind makes to the line perpendicular to the axis of the boat is (90-(B-A)) or 90+(B-A)
depending on how we measure the angle(or how the sail directs the perpendicular wind)

``````    The component of a vector V1 along another vector(direction),
``````

Component = |V1| cos(X)

``````                     V1
/
/  X
/ )
-------- V2
``````

So in this case |V1| = 1 say, X = (90 + (B-A))
Wind -> East, B= -90 deg , Boat -> Nort-NorthWest,A = 337.5 deg(Not 112.5??),So wind component
perpendicular to boat = cos(90 + (-90 - 337.5)) = Done with calculator with degrees = 0.9238.

Now I’ve never seen a sail boat,Since you are taking the wind component perpendicular to the
boat,Does that mean a boat that is along the direction of the wind will not move???

Hrrm. Something is definitely wrong.

A = 1.875 * PI
B = 0.5 * PI
A’ = A - A = 0
B’ = B - A = 0.5 * PI - 1.875 * PI = -1.375 * PI

Since :
somex = sin(sometheta)
somey = cos(sometheta)
then
somex’ = sin(sometheta’)
somey’ = cos(sometheta’)

So,
x’ = sin(B’) = sin(-1.375PI) = 0.923879532511286756128183189396788
degrees, and you evaulate sin(-1.375
PI)

y’ = cos(B’) = cos(-1.375*PI) = -0.382683432365089771728459984030399

So, you probably just forget to switch your calculator to radian mode. I do
that all the time

Bret

Hi!

SL> Can anyone suggest a good forum for questions like this?

SL> ======

SL> Understanding vectors - what makes a sailboat go?

SL> The wind is applied at an angle to the sailboat like so:

SL> /\ /
SL> / \ /
SL> | | /
SL> | | J
SL> | |
SL> __/

SL> The wind force has two portions, one along the axis of the boat,
SL> and one perpendicular to the axis. The sails catch the force
SL> perpendicular to the keel of the boat and translate it, using
SL> the keel to prevent the boat from sliding, into forward motion.
SL> The drag of the boat below the waterline and the mass of the boat
SL> determine the amount of wind force necessary to move the boat.

[skip]

SL> Something is obviously wrong.

Well, you have oversimplified the model.

The sails function in two ways - as a aerodynamic screen and as a
wing (lift force approximately perpendicular to the sail). Also,
there is drag, generated by aerodynamic resistance of the ship in
general.

The function of the sail is determined by its type ( configuration),
its tightness (whether it is sloppy or tightly bound to the mast and
rays) and angle between rays (plane, on which sail has greatest
square of projection) and wind.

Typical medium or large sized sail ships had from several dozen to
hundred or so separate sails. Such enormous number of sails of
different types allowed them to gather enough windpower to move in
almost any direction and enough manoeuvrability to turn rapidly.

Hmm…

Well, it’s a long story. If you have some location, where I can upload
drawings (gif or macromedia), I could write a small tutorial on
modelling sails and sail ships. Quite an interesting subject, to think
about it. (just came to my mind)

./lxnt

I have a teacher here in college who may be interested in helping you.
Dr. Jim Strayer
jstrayer at cardinal.lhup.edu

Tell him dave Leimbach sent ya!!
He teaches a recreational mathematics course here at Lock haven University
and likes games and puzzles a whole lot. He is also the only Professor I
know with a Next Box and his name on a plaque by “his” stool at his local
bar/branch office.

Take it easy Sam and if you need help with it (I love roleplaying games!!)
ask me. I’d love to give some feedback. (I am also pretty handy around
C/C++ and a bunch of other languages) I am also going to graduate in
May!!

Dave

Sam Lantinga wrote:

Can anyone suggest a good forum for questions like this?

comp.games.development.programming.algorithms?

Understanding vectors - what makes a sailboat go?

Trig alone won’t cut it - a sail is basically a vertical
airplane wing, and it’s the negative air pressure in front
the sail that drags the boat along. That’s why it works to
sail upwind.

There’s a book by Marchaj called "Sailing Theory and Practice"
that has scads of formulas and charts. It’s oriented towards
modern racing yachts, but it goes a lot into the effects of
the shape of the sails, the heeling (leaning over) of the boat,
interactions of multiple sails, etc.

For a game, it might be better just to make up some tables
for behavior at various compass points, and interpolate.
The net effect of the 20-odd sails and hundreds of lines
of an old-time square-rigger would be too complicated to
be worth trying to calculate.

There are a couple pure sailing games out there, and I have
a vague memory of a source-available game done for Unix once
upon a time. Look for “sail” or “Berkeley sail”.

(Sailing ships used to be one of my big interests - books and
ship models still clutter up the house…)

Stan
@Stan_Shebs

This message was not supposed to go to the list
Please don’t everyone email the guy.

(Not that I think you would!!)

Dave> I have a teacher here in college who may be interested in helping you.

Dr. Jim Strayer
jstrayer at cardinal.lhup.edu

Tell him dave Leimbach sent ya!!
He teaches a recreational mathematics course here at Lock haven University
and likes games and puzzles a whole lot. He is also the only Professor I
know with a Next Box and his name on a plaque by “his” stool at his local
bar/branch office.

Take it easy Sam and if you need help with it (I love roleplaying games!!)
ask me. I’d love to give some feedback. (I am also pretty handy around
C/C++ and a bunch of other languages) I am also going to graduate in
May!!

Dave

So, you probably just forget to switch your calculator to radian mode.

Doh! In radian mode, I do indeed get 0.9239, which was the same solution
presented using another method in this thread.

Since this post was off-topic, I’m taking it offline, but I want to thank
everybody for their help. I’m going to do more research on sail theory,
and if I keep this simplified model, I’ll definitely not use rotation of
the coordinate axes.

Thanks!!

``````-Sam Lantinga				(slouken at devolution.com)
``````

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Now I’ve never seen a sail boat,Since you are taking the wind component perpendicular to the
boat,Does that mean a boat that is along the direction of the wind will not move???

Yup! That’s why boats heading into the wind weave back and forth in a
pattern called “tacking”

P.S. My sailing knowledge dates back to sailing classes when I was
young, so no doubt it’s simplified and possibly mis-remembered.

Last post, promise!

See ya,
-Sam Lantinga (slouken at devolution.com)