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]);
83 return _v[0]*rhs.
_v[0]+
_v[1]*rhs.
_v[1];
153 return sqrt(
_v[0]*
_v[0] +
_v[1]*
_v[1] );
183 return Vec2d(lhs[0]*rhs[0], lhs[1]*rhs[1]);
189 return Vec2d(lhs[0]/rhs[0], lhs[1]/rhs[1]);
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec2d componentDivide(const Vec2d &lhs, const Vec2d &rhs)
divide rhs components by rhs vector components.
Definition Vec2d:187
bool isNaN(float v)
Definition Math:133
Vec2d componentMultiply(const Vec2d &lhs, const Vec2d &rhs)
multiply by vector components.
Definition Vec2d:181
General purpose double pair, uses include representation of texture coordinates.
Definition Vec2d:29
bool isNaN() const
Returns true if at least one component has value NaN.
Definition Vec2d:78
Vec2d & operator/=(value_type rhs)
Unary divide by scalar.
Definition Vec2d:107
value_type length() const
Length of the vector = sqrt( vec .
Definition Vec2d:151
const Vec2d operator/(value_type rhs) const
Divide by scalar.
Definition Vec2d:101
bool operator!=(const Vec2d &v) const
Definition Vec2d:52
bool operator==(const Vec2d &v) const
Definition Vec2d:50
value_type * ptr()
Definition Vec2d:61
Vec2d(value_type x, value_type y)
Definition Vec2d:43
Vec2d(const Vec2f &vec)
Definition Vec2d:45
const Vec2d operator-() const
Negation operator.
Definition Vec2d:145
value_type x() const
Definition Vec2d:72
value_type & operator[](int i)
Definition Vec2d:66
value_type _v[2]
Definition Vec2d:38
value_type operator*(const Vec2d &rhs) const
Dot product.
Definition Vec2d:81
Vec2d()
Constructor that sets all components of the vector to zero.
Definition Vec2d:41
Vec2d & operator-=(const Vec2d &rhs)
Unary vector subtract.
Definition Vec2d:137
@ num_components
Definition Vec2d:36
bool operator<(const Vec2d &v) const
Definition Vec2d:54
value_type & y()
Definition Vec2d:70
value_type y() const
Definition Vec2d:73
value_type & x()
Definition Vec2d:69
Vec2d & operator*=(value_type rhs)
Unary multiply by scalar.
Definition Vec2d:93
bool valid() const
Returns true if all components have values that are not NaN.
Definition Vec2d:76
Vec2d & operator+=(const Vec2d &rhs)
Unary vector add.
Definition Vec2d:123
value_type length2(void) const
Length squared of the vector = vec .
Definition Vec2d:157
value_type normalize()
Normalize the vector so that it has length unity.
Definition Vec2d:165
void set(value_type x, value_type y)
Definition Vec2d:64
const value_type * ptr() const
Definition Vec2d:62
double value_type
Data type of vector components.
Definition Vec2d:33
const Vec2d operator+(const Vec2d &rhs) const
Binary vector add.
Definition Vec2d:115
General purpose float pair.
Definition Vec2f:29
value_type _v[2]
Vec member variable.
Definition Vec2f:39