Ahora me saltan otros errores:
In member function `float Vector3d::getLength() const':|
error: passing `const Vector3d' as `this' argument of `float Vector3d::operator*(Vector3d*)' discards qualifiers|
error: invalid conversion from `const Vector3d* const' to `Vector3d*'|
error: initializing argument 1 of `float Vector3d::operator*(Vector3d*)'|
In member function `Vector3d Vector3d::getUnary() const':|
error: passing `const Vector3d' as `this' argument of `Vector3d Vector3d::operator/(float)' discards qualifiers|
El código de ambos métodos es:
float getLength() const
{
return sqrt(this->operator*(this));
}
Vector3d getUnary() const
{
return this->operator/(this->getLength());
}
Otra cosa, tengo una clase Cube tal que así:
class Cube
{
public:
bool isVisible (int nface);
private:
Vector3d vertex[8];
struct
{
int d;
Vector3d n;
} face[6];
};
isVisible es un método que devuelve true si la cara nface está mirando al observador (Un plano cuyo vector normal es j.)
bool Cube::isVisible (int nface)
{
if (this->face[nface].n * uj > 0)
return true;
else return false;
}
Pues en isVisible me da estos errores:
In member function `bool Cube::isVisible(int)':|
error: no match for 'operator*' in '((Cube*)this)->Cube::face[nface].Cube::<anonymous struct>::n * uj'|
note: candidates are: Vector3d Vector3d::operator*(float)|
note: float Vector3d::operator*(Vector3d*)|
EDIT: Vale, lo del cubo es que la estructura no se puede acceder alegremente xD