``````friend Matrix3D operator - (const Matrix3D&,const Matrix3D&);
friend Matrix3D operator * (const Matrix3D&,const Matrix3D&);
friend Matrix3D operator * (const Matrix3D&, float);
friend Matrix3D operator * (float, const Matrix3D&);
friend Vector3D operator * (const Matrix3D&,const Vector3D);
};
Matrix3D scale ( const Vector3D& );
Matrix3D rotateX (float);
Matrix3D rotateY (float);
Matrix3D rotateZ (float);
Matrix3D rotate ( const Vector3D&, float);
Matrix3D mirrorX ();
Matrix3D mirrorY ();
Matrix3D mirrorZ ();
#endif``````

Компьютерная-графика. Полигональные модели

``````! // File matrix3D.cpp #include <math.h> #include "matrix3D.h"
Matrix3D :: Matrix3D (float a ) {
x[0][1] = x[0][2] = x[1][0] = x[1][2] = x[2][0] = x{2][1] = 0.0; x[0][0] = x[1][1] = x[2K2] = a;
}
Matrix3D :: Matrix3D (const Matrix3D& a ) {
x [0][0] = a.x [0][0] x [0][1) = a.x [0][1] x [0][2] = a.x [0][2] x [1][0] = a.x [1)[0] x[1][1] = a.x [1][1] x [1][2] = a.x [1][2] x [2][0] = a.x [2)[0] x [2][1] = a.x [2][1] x [2][2] = a.x [2][2]
}
Matrix3D& Matrix3D :: operator = ( const Matrix3D& a ) {
x [0][0] = a.x [0][0] x [0][1] = a.x [0][1] x [0][2] = a.x [0][2] x [1][0] = a.x [1][0] x[1][1] = a.x [1][1] x [1][2] = a.x [1][2] x [2][0] = a.x [2][0] x[2][1] = a.x[2][1] x [2][2] = a.x [2][2]
return "this;
}
Matrix3D& Matrix3D :: operator = (float a ) {
x [0][1] = x [0][2] = x [1][0] = x[1][2] = x[2][0] = x[2][1] = 0.0; x[0][0] = x[1][1] = x[2][2] = a;
return 'this;
}
Matrix3D& Matrix3D :: operator += ( const Matrix3D& a ) {
x [0][0] += a.x[0][0] x[0][1]+=a.x[0][1) x [0][2] += a.x [0][2] x [1][0] += a.x [1][0] x[1][1]+=a.x [1][1] x[1][2] +=a.x [1][2]
9. flpeo6pa30BaHHFi b npocipaHCTBe, npoeKTHpoBaHU
x [2][0] += a.x [2][0]; x[2][1]+=a.x [2][1]; x [2][2] += a.x [2][2];
return *this;
}
Matrix3D& Matrix3D :: operator -= ( const Matrix3D& a ) {
x [0][0] -=a.x [0][0]; x[0][1]-=a.x [0][1]; x [0][2] -=a.x [0][2]; x[1][0]-=a.x[1][0]; x[1][1]-=a.x [1][1]; x[1][2] -a.x [1][2]; x [2][0] -=a.x [2][0]; x[2][1]-=a.x [2][1]; x [2][2] -=a.x [2][2];``````

⇐ Предыдущая| |Следующая ⇒