Реферат: Трехмерная графика Теория
Vector& operator /= ( double );
friend Vector operator + ( const Vector&, const Vector& );
friend Vector operator - ( const Vector&, const Vector& );
friend Vector operator * ( const Vector&, const Vector& );
friend Vector operator * ( double, const Vector& );
friend Vector operator * ( const Vector&, double );
friend Vector operator / ( const Vector&, double );
friend Vector operator / ( const Vector&, const Vector& );
friend double operator & ( const Vector& u, const Vector& v )
{ return u.x * v.x + u.y * v.y + u.z * v.z; };
friend Vector operator ^ ( const Vector&, const Vector& );
double operator ! () { return (double) sqrt ( x * x + y * y + z * z ); };
double& operator [] ( int n ) { return *( &x + n ); };
int operator < ( double v ) { return x < v && y < v && z < v; };
int operator > ( double v ) { return x > v && y > v && z > v; };
};
class Ray
{
public:
Vector Org;
Vector Dir;
Ray () {};
Ray ( Vector& o, Vector& d ) { Org = o, Dir = d; };
Vector Point ( double t ) { return Org + Dir * t; };
};
inline Vector Vector :: operator - () const
{
return Vector ( -x, -y, -z );
}