When working with quaternions/vectors/matrices/rotation of you require alot cos(angle)/sin(angle).
Now, it seems best to work in radians all the time and try to keep your numbers in radians; avoid converting into degree's.
Right now I have a lookup table which looks like this:
//----------------
//Generate Vector Circles
//----------------
void Camera::GenerateVectorCircle()
{
float Theta=0;
float Pi = 3.14159265358979f;
float ToRad = Pi / 180;
for (int i = 0;i < 360;i++)
{
Theta = i * ToRad;
m_VectorCircle[i].u = cosf(Theta);
m_VectorCircle[i].v = sinf(Theta);
}
}
This table seems to work fine but I'm sure it can't be 100% accurate unless...
Here is my question: between 0 --> 2pi (thus 0 --> 360)...Is there the same number of value's between 0 --> 2pi and 0 --> 360?
From a glance, obviously not.
So I must create a look up table to eliminate the use of sin and cos on a regular basis, but the look up table must have contain values for any angle in rads.
Is this possible? Between 0 and 2pi there are probably a quaddrillion values I would have to record for cos and sin on each angle.
So is accuracy lost if I just use that lookup table above and ALWAYS work in degree's?
Maybe this post is pointless.




Reply With Quote