#include <vector2.h>
Collaboration diagram for Vector2< T >:
Public Member Functions | |
Vector2 () | |
Vector2 (T x, T y) | |
T | GetX () const |
T | GetY () const |
bool | IsZero (T val) const |
bool | operator== (const Vector2< T > &p2) const |
bool | operator!= (const Vector2< T > &p2) const |
bool | operator>= (const Vector2< T > &p2) const |
bool | operator<= (const Vector2< T > &p2) const |
Vector2< T > | operator+ (const Vector2< T > &p2) const |
Vector2< T > | operator- (const Vector2< T > &p2) const |
Vector2< T > | operator- () const |
Vector2< T > | operator * (const Vector2< T > &p2) const |
Vector2< T > | operator/ (const Vector2< T > &p2) const |
Vector2< T > | operator% (const Vector2< T > &p2) const |
Vector2< T > | operator+ (const T val) const |
Vector2< T > | operator- (const T val) const |
Vector2< T > | operator * (const T val) const |
Vector2< T > | operator/ (const T val) const |
void | operator+= (const T val) |
void | operator-= (const T val) |
void | operator *= (const T val) |
void | operator+= (const Vector2< T > &p2) |
void | operator-= (const Vector2< T > &p2) |
Vector2< T > | operator * (const Vector2< double > &p2) |
Vector2< T > | inf (const Vector2< T > &p2) |
Vector2< T > | min (const Vector2< T > &p2) const |
Vector2< T > | max (const Vector2< T > &p2) const |
Vector2< T > | clamp (const Vector2< T > &min, const Vector2< T > &max) const |
double | Distance (const Vector2< T > p2) const |
double | Norm () const |
void | Clear () |
void | SetValues (T xx, T yy) |
void | SetValues (Vector2< T > v2) |
bool | IsXNull () const |
bool | IsYNull () const |
bool | IsNull () const |
double | ComputeAngle () const |
double | ComputeAngle (const Vector2< T > v2) const |
Public Attributes | |
T | x |
T | y |
Static Private Attributes | |
static const double | EPS_ZERO = 0.05 |
Definition at line 10 of file vector2.h.
void Vector2< T >::Clear | ( | ) | [inline] |
double Vector2< T >::ComputeAngle | ( | ) | const [inline] |
Calcule l'angle en radian du point M dans le repère de centre O
Pour O=(0,0) :
Definition at line 342 of file vector2.h.
00342 { 00343 double angle; 00344 00345 if( !IsZero( x ) ) 00346 if( !IsZero( y ) ){ 00347 angle = atan(double(y)/double(x)); 00348 if( x < 0 ) 00349 if( y > 0 ) 00350 angle += M_PI; 00351 else 00352 angle -= M_PI; 00353 } 00354 else 00355 if( x > 0) 00356 angle = 0; 00357 else 00358 angle = M_PI; 00359 else 00360 if( y > 0 ) 00361 angle = M_PI_2; 00362 else if(y < 0) 00363 angle = -M_PI_2; 00364 else 00365 angle = 0; 00366 00367 return angle; 00368 }
Here is the caller graph for this function:
T Vector2< T >::GetX | ( | ) | const [inline] |
T Vector2< T >::GetY | ( | ) | const [inline] |
Return the comparaison of two vector in the form of a vector.
p2 |
Definition at line 239 of file vector2.h.
00239 { 00240 return Vector2<T>( x < p2.x ? 1:0, 00241 y < p2.y ? 1:0); 00242 }
Here is the caller graph for this function:
bool Vector2< T >::IsNull | ( | ) | const [inline] |
bool Vector2< T >::IsXNull | ( | ) | const [inline] |
bool Vector2< T >::IsYNull | ( | ) | const [inline] |
bool Vector2< T >::IsZero | ( | T | val | ) | const [inline] |
Definition at line 54 of file vector2.h.
00054 { 00055 return (val == 0 || val <= VECTOR2_EPS_ZERO) && 00056 (-val <= VECTOR2_EPS_ZERO); 00057 }
Here is the caller graph for this function:
double Vector2< T >::Norm | ( | ) | const [inline] |
void Vector2< T >::operator *= | ( | const T | val | ) | [inline] |
val |
Definition at line 144 of file vector2.h.
00144 { 00145 return Vector2<T>(x + val, y + val); 00146 }
void Vector2< T >::operator+= | ( | const T | val | ) | [inline] |
val |
Definition at line 152 of file vector2.h.
00152 { 00153 return Vector2<T>(x - val, y - val); 00154 }
Definition at line 114 of file vector2.h.
00114 { 00115 return Vector2<T>(-x, -y); 00116 }
void Vector2< T >::operator-= | ( | const T | val | ) | [inline] |
val |
Definition at line 167 of file vector2.h.
00167 { 00168 return Vector2<T>(x / val, y / val); 00169 }
void Vector2< T >::SetValues | ( | T | xx, | |
T | yy | |||
) | [inline] |