So I'm a Mathtard
BlitzMax Forums/BlitzMax Programming/So I'm a Mathtard
| ||
I have a sprite class... and I want to have a method that updates its location. So say I have X and Y... And I have an angle (in degrees because my brain works in degrees)... and I have a velocity... I think I need something like the following: x = x + ( velocity * cos ( angle ) ) y = y + ( velocity * sin ( angle ) ) But is that angle in degrees or radians? Math sucks. :D |
| ||
Its in degrees. I always use:x = Cos(angle) * velocity + x y = Sin(angle) * velocity + y ...which is the same thing, written differently. |
| ||
Sounds good to me. Thanks. :) |
| ||
Blitz is in degrees, other languages often (usually?) use radians. |
| ||
@dynaman...I spent days debugging code once, until I realised that.Doh! |
| ||
if anyone does not know, for the purpose of converting code from any language that uses radians to degrees or degrees to radians: radians to degrees: ToRAd = Pi/180 rad = degrees*ToRad degrees to radian: ToDeg = 180/pi deg = radians*ToDeg if Pi is not defined: Pi = 3.1415926535897931 |