Help with sin/cos/tan
Displaying 1-3 of 3 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
rpgking

There was a thread on my question before, but I couldn't find it anywhere, so I'll start a new one.

Basically, my question is how do you get a regular integer result of a sin/cos/tan calculation if it is 16.16 fixed point in Verge3? I remember this involved bitshifting, but I'm not sure of the specifics...

Posted on 2004-04-08 20:58:00

Omni

Bitshift it down...by 16, or something.

int variable
variable = Sin(180)

variable = variable >> 16

I don't know what you call it, but you bitshift down by 16. Make sure you do all your multiplication and stuff before you bitshift.


int variable
variablex = Sin(180)
variabley = Cos(180)

int vectorlength
vectorlength = 30

vectorx = (variabley * vectorlength) >> 16
vectory = (variablex * vectorlength) >> 16

Posted on 2004-04-08 21:28:17

rpgking

Ah, ok. Thanks. That makes sense.

Posted on 2004-04-09 05:11:29


Displaying 1-3 of 3 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.