return *this;
}
Vector2D operator - () const {
return Vector2D (-x, -y );
}
Vector2D& operator += ( const Vector2D& v ) {
x += v.x; y += v.y;
return *this;
}
Vector2D& operator -= ( const Vector2D& v ) {
x -= v.x; y -= v.y;
return *this;
}
Vector2D& operator *= ( const Vector2D& v ) {
*
7. npeo6pa30BaHMfl Ha nnocKOCTH
x *= v.x; y *= v.y;
return *this;
Vector2D& operator *= (float f) x*= f;
y*= f;
return *this;
Vector2D& operator /= ( const Vector2D& v )
x /= v.x; y /= v.y;
return *this;
Vector2D& operator /= (float f) x/= f;
y/= f;
return *this;
float& operator Q (int index )
return * (index + &x );
int operator == ( const Vector2D& v ) const
return x == v.x && y == v.y;
int operator != ( const Vector2D& v ) const
return x != v.x || y != v.y;
int operator < ( const Vector2D& v ) const
return (x < v.x) || ((x == v.x) && (y < v.y));
int operator > ( const Vector2D& v ) const
return (x > v.x) || ((x == v.x) && (y > v.y));
float length () const
return (float) sqrt (x*x + y*y); y

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

float polarAngle () const {
return (float) atan2 ( y, x );
}
int ' classify ( const Vector2D&, const Vector2D& ) const;
friend Vector2D operator + (const Vector2D&,const Vector2D&); friend Vector2D operator - (const Vector2D&,const Vector2D&); friend Vector2D operator * (const Vector2D&,const Vector2D&); friend Vector2D operator * (float, const Vector2D&);
friend Vector2D. operator * ( const Vector2D&, float); friend Vector2D operator / (const Vector2D&,float); friend Vector2D operator / (const Vector2D&, const Vector2D&); friend float operator & (const Vector2D&, const Vector2D&);
inline Vector2D operator + ( const Vector2D& u, const Vector2D& v ) return Vector2D ( u.x + v.x, u.y + v.y );
inline Vector2D operator - ( const Vector2D& u, const Vector2D& v ) return Vector2D (u.x - v.x, u.y - v.y );

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