43 Vec2d(value_type
x,value_type
y) { _v[0]=
x; _v[1]=
y; }
47 inline operator Vec2f()
const {
return Vec2f(static_cast<float>(_v[0]),static_cast<float>(_v[1]));}
56 if (_v[0]<v.
_v[0])
return true;
57 else if (_v[0]>v.
_v[0])
return false;
58 else return (_v[1]<v.
_v[1]);
61 inline value_type*
ptr() {
return _v; }
62 inline const value_type*
ptr()
const {
return _v; }
64 inline void set( value_type
x, value_type
y ) { _v[0]=
x; _v[1]=
y; }
69 inline value_type&
x() {
return _v[0]; }
70 inline value_type&
y() {
return _v[1]; }
72 inline value_type
x()
const {
return _v[0]; }
73 inline value_type
y()
const {
return _v[1]; }
83 return _v[0]*rhs.
_v[0]+_v[1]*rhs.
_v[1];
89 return Vec2d(_v[0]*rhs, _v[1]*rhs);
103 return Vec2d(_v[0]/rhs, _v[1]/rhs);
117 return Vec2d(_v[0]+rhs.
_v[0], _v[1]+rhs.
_v[1]);
133 return Vec2d(_v[0]-rhs.
_v[0], _v[1]-rhs.
_v[1]);
147 return Vec2d (-_v[0], -_v[1]);
153 return sqrt( _v[0]*_v[0] + _v[1]*_v[1] );
159 return _v[0]*_v[0] + _v[1]*_v[1];
170 value_type inv = 1.0/norm;
183 return Vec2d(lhs[0]*rhs[0], lhs[1]*rhs[1]);
189 return Vec2d(lhs[0]/rhs[0], lhs[1]/rhs[1]);
Vec2d & operator-=(const Vec2d &rhs)
bool operator!=(const Vec2d &v) const
Vec2d & operator*=(value_type rhs)
value_type operator*(const Vec2d &rhs) const
const Vec2d operator/(value_type rhs) const
value_type length() const
bool operator==(const Vec2d &v) const
Vec2d componentDivide(const Vec2d &lhs, const Vec2d &rhs)
value_type & operator[](int i)
Vec2d & operator/=(value_type rhs)
const value_type * ptr() const
void set(value_type x, value_type y)
const Vec2d operator+(const Vec2d &rhs) const
value_type length2(void) const
bool operator<(const Vec2d &v) const
const Vec2d operator-() const
Vec2d & operator+=(const Vec2d &rhs)
Vec2d(value_type x, value_type y)
Vec2d componentMultiply(const Vec2d &lhs, const Vec2d &rhs)