I'm working on my own math classes for vertices and matrices for a school project and for that I have overloaded several operators. One of them I'm using in several functions of the vector class, but I get the following error for that:
1>e:\farao engine\farao engine svn\trunk\farao engine\faraovector3d.cpp(44): error C2677: binary '*' : no global operator found which takes type 'FARAO::FARAOMatrix44' (or there is no acceptable conversion)
/*
*Rotate this vector argDegrees over it's X-axis.
*/
FARAOVector3D FARAOVector3D::VectorRotationMatrixForX(double argDegrees)
{
//Initializes the vector that is to be returned.
FARAOVector3D vectorResult;
//Initializes and defines the rotation matrix.
FARAOMatrix44 rotationMatrix;
rotationMatrix.setAsIdentityMatrix();
rotationMatrix.matrix44[1][1] = cos(argDegrees);
rotationMatrix.matrix44[1][2] = sin(argDegrees);
rotationMatrix.matrix44[2][1] = -sin(argDegrees);
rotationMatrix.matrix44[2][2] = cos(argDegrees);
//Calculates the vector that is to be returned.
//This part causes the error.
vectorResult = this * rotationMatrix;
//Returns the vector that is to be returned.
return vectorResult;
}
//Overloading the * operator for multiplying a vector with a 4x4 matrix.
FARAOVector3D operator* (FARAOMatrix44 argMatrix44)
{
//Initializes the vector that is to be returned.
FARAOVector3D vectorResult;
//Calculate the x position.
vectorResult.vector3D[0] =
vector3D[0] * argMatrix44.matrix44[0][0] +
vector3D[1] * argMatrix44.matrix44[1][0] +
vector3D[2] * argMatrix44.matrix44[2][0] +
argMatrix44.matrix44[3][0];
//Calculate the y position.
vectorResult.vector3D[1] =
vector3D[0] * argMatrix44.matrix44[0][1] +
vector3D[1] * argMatrix44.matrix44[1][1] +
vector3D[2] * argMatrix44.matrix44[2][1] +
argMatrix44.matrix44[3][1];
//Calculate the x position.
vectorResult.vector3D[2] =
vector3D[0] * argMatrix44.matrix44[0][2] +
vector3D[1] * argMatrix44.matrix44[1][2] +
vector3D[2] * argMatrix44.matrix44[2][2] +
argMatrix44.matrix44[3][2];
//Returns the vector that is to be returned.
return vectorResult;
}
Is there something I have overlooked that could cause the error?
Or should I try to solve it in another way?