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
|