/1
inline Vector3D operator + ( const Vector3D& u, const Vector3D& v ) return Vector3D ( u.x + v.x, u.y + v.y, u.z + v.z );
inline Vector3D operator - ( const.Vector3D& u, const Vector3D& v ) return Vector3D ( u.x - v.x, u.y - v.y, u.z - v.z );
inline Vector3D operator * ( const Vector3D& u, const Vector3D& v ) return Vector3D ( u.xVx, u.yVy, u.z * v.z );
inline Vector3D operator * ( const Vector3D& v, float a ) return Vector3D ( v.x*a, v.y*a, v.z*a );
inline Vector3D operator * (float a, const Vector3D& v ) return Vector3D (v.x*a, v.y*a, v.z*a );
inline Vector3D operator / ( const Vector3D& u, const Vector3D& v ) return Vector3D ( u.x/v.x, u.y/v.y, u.z/v.z );
inline Vector3D operator / ( const Vector3D& v, float a ) return Vector3D ( v.x/a, v.y/a, v.z/a );
inline float operator & ( const Vector3D& u, const Vector3D& v ) return u.xVx + u.y*v.y + u.z*v.z;
inline Vector3D operator A ( const Vector3D& u, const Vector3D& v )
return Vector3D (u.y*v.z-u.z*v.y, u.zVx-u.xVz,
u.x*v.y-u.y*v.x);
#endif
9. npeo6pa30BaHMfl b npocipaHCTBe, npoeKTupoBaHM
// File matrix3D.h #ifndef __MATRIX3D_ #define _MATRIX3D_
#include "Vector3D.h"
class Matrix3D {
public:
float x [3][3];
Matrix3D () {}
Matrix3D (float);
Matrix3D ( const Matrix3D& );
Matrix3D& operator = ( const Matrix3D& ); Matrix3D& operator = (float); Matrix3D& operator += ( const Matrix3D& ); Matrix3D& operator -= ( const Matrix3D& ); Matrix3D& operator *= ( const Matrix3D& ); Matrix3D& operator *= (float); Matrix3D& operator /= (float);
float * operator [] (int i) {
return & x[i][0];
}
void invert (); void transpose ();
static Matrix3D scale ( const Vector3D& );
static Matrix3D rotateX (float);
static Matrix3D rotateY (float);
static Matrix3D rotateZ (float);
static Matrix3D rotate ( const Vector3D&, float);
static Matrix3D mirrorX ();
static Matrix3D mirrorY ();
static Matrix3D mirrorZ ();
friend Matrix3D operator + (const Matrix3D&,const Matrix3D&);

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