Ok, so the problem I had with my Normalize was that I had the following code
void Matrix::normalize()
{
x = x / this->mag();
y = y / this->mag();
z = z / this->mag();
}
When I needed to do this
void Matrix::normalize()
{
float thisMag = this->mag();
x = x / thisMag;
y = y / thisMag;
z = z / thisMag;
}
The first code was caluclating this->mag() after the x value had changed, making it a different value all together. Close, but not close enough.
Now for the written homework with Vector projections (yay /sarcasm).
No comments:
Post a Comment