Go to the FreeLists Home Page Home Signup Help Login
 



[3ddev] || [Date Prev] [04-2004 Date Index] [Date Next] || [Thread Prev] [04-2004 Thread Index] [Thread Next]

[3ddev] Position Movement based on angle Explanation

  • From: "Julian Serban" <julianserban100@xxxxxxxxxxx>
  • To: 3ddev@xxxxxxxxxxxxx
  • Date: Thu, 01 Apr 2004 14:23:28 +0200
Hi, this week I'll explain the following formula:

***
X' = X + Steps * Cos(Angle)
Y' = Y + Steps * Sin(Angle)
***

Okay first:

***
X + ....
Y + ....
***

Has a very logical and yet important function, imagine you have a 
Perpendicular(90*) coordinate system:

           |
           |
           |
______|______
           |
           |
           |

Then the X & Y can be though of the Origin, if we didn't include X, Y we 
could only use this formula on freevectors(Vectors without positions), which 
leads us to:

FreeVector + Vector = X, Y + Rest of the formula

Now this part:

***
Steps * Cos(Angle)
Steps * Sin(Angle)
***

is somewhat more complicated, we are all somwhat used to the fact that you 
use

Cos on X

and

Sin on Y

I don't really know the formula for Sin or Cos, but I do know that they 
caculate angles, so this is actually the only logical place to put the Angle 
value in our formula.

but if you seek to know more, then you could always use the Dot-Product, or 
the Cross-Product, which both can be used with Cos^-1 or Sin^-1 to calculate 
an angle:

Dot-Product = A.X * B.X + A.Y * B.Y

Some more information about Cos and Sin can be found here:

http://mathworld.wolfram.com/Cosine.html

http://mathworld.wolfram.com/Sine.html

There has been a large discussion about who invented the Dot & Cross 
Product, so I don't think I'm going to explain that. If you wish, then just 
google for the dotproduct, I'm sure you'll find alot about it.

So why:

***
Steps *
Steps *
***

well the reason here is very logical, when using Cos/Sin the values are 
always normalized(lenght of 1), so if Steps where 1, it would be the same, 
if steps where 2, it would be double, this part is pure logical math.

- Julian

_________________________________________________________________
Få alle de nye og sjove ikoner med MSN Messenger http://www.msn.dk/messenger






[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.