Hi all,
A bit of a maths question, hoping some trig expert can tell me what I'm doing wrong here...!?
I have a normalised point (x,y,z) representing a face normal. I want to rotate this point around the Y axis by n degrees. My maths isn't realy good enough to come up with the equation on my own, but thanks to the wondering of modern search engines I was able to find this equation. I found the same equation at a few other sites, so I'm assuming its correct...
x' = z * (sin n) + x * (cos n);
y' = y;
z' = z * (cos n) - x * (sin n);
My mel equivalent looks something like this -->
// start mel example
float $pos[];
$pos[0] = 1.0; //
$pos[1] = 0.0; // normalised point
$pos[2] = 0.0; //
float $n = 35.0; // degrees the point will be rotated around Y axis
$pos[0] = $pos[2] * (sin($n)) + $pos[0] * (cos($n));
$pos[2] = $pos[2] * (cos($n)) - $pos[0] * (sin($n));
// end mel example
This example does not give me the desired result...the resulting point is nowhere near where I expected it to be! I know i'm doing something terribly wrong here, but i have no idea what it is...Please help!!! My sanity is at stake here!
Cheers,
Grant.