| Support Forum Library Source SourceForge Page G3D Web Page |
Do not subclass– this implementation makes assumptions about the memory layout. More...
Public Member Functions | |
| Vector2 (const Any &any) | |
| Vector2 () | |
| Creates the zero vector. | |
| Vector2 (class TextInput &t) | |
| Vector2 (class BinaryInput &b) | |
| Vector2 (float x, float y) | |
| Vector2 (float coordinate[2]) | |
| Vector2 (double coordinate[2]) | |
| Vector2 (const Vector2 &other) | |
| Vector2 (const Vector2int16 &other) | |
| Vector2 (const Vector2unorm16 &other) | |
| Vector2 | abs () const |
| Componentwise absolute value. | |
| Vector2 | clamp (const Vector2 &low, const Vector2 &high) const |
| Vector2 | clamp (float low, float high) const |
| void | deserialize (class BinaryInput &b) |
| void | deserialize (class TextInput &t) |
| Vector2 | direction () const |
| Returns a unit-length version of this vector. | |
| Vector2 | directionOrZero () const |
| Returns Vector2::zero() is magnitude is almost zero, otherwise returns unit-length vector. | |
| float | dot (const Vector2 &s) const |
| Vector2 | fastDirection () const |
| Potentially less accurate but faster than direction(). | |
| bool | fuzzyEq (const Vector2 &other) const |
| bool | fuzzyNe (const Vector2 &other) const |
| size_t | hashCode () const |
| bool | isFinite () const |
| Returns true if this vector has finite length. | |
| bool | isNaN () const |
| True if any field is NaN. | |
| bool | isUnit () const |
| Returns true if this vector has length == 1. | |
| bool | isZero () const |
| Returns true if this vector has length == 0. | |
| float | length () const |
| Magnitude of the vector. | |
| Vector2 | lerp (const Vector2 &v, float alpha) const |
| Linear interpolation. | |
| Vector2 | max (const Vector2 &v) const |
| Component-wise maximum. | |
| Vector2 | maxAbs (const Vector2 &v) const |
| Component-wise argmax(abs(), v.abs()). | |
| Vector2 | min (const Vector2 &v) const |
| Component-wise minimum. | |
| Vector2 | minAbs (const Vector2 &v) const |
| Component-wise argmin(abs(), v.abs()). | |
| bool | operator!= (const Vector2 &other) const |
| Vector2 | operator* (float s) const |
| Vector2 | operator* (const Vector2 &v) const |
| Array (pointwise) multiplication. | |
| Vector2 & | operator*= (float) |
| Vector2 & | operator*= (const Vector2 &) |
| Vector2 | operator+ (const Vector2 &v) const |
| Vector2 & | operator+= (const Vector2 &) |
| Vector2 | operator- (const Vector2 &v) const |
| Vector2 | operator- () const |
| Unary minus. | |
| Vector2 & | operator-= (const Vector2 &) |
| Vector2 | operator/ (const Vector2 &v) const |
| Array division. | |
| Vector2 | operator/ (float s) const |
| Vector2 & | operator/= (float) |
| Vector2 & | operator/= (const Vector2 &) |
| Vector2 & | operator= (const Any &a) |
| Vector2 & | operator= (const Vector2 &other) |
| bool | operator== (const Vector2 &other) const |
| float & | operator[] (int i) |
| const float & | operator[] (int i) const |
| Vector2 | pow (float p) const |
| Raise each component of this vector to a power. | |
| void | serialize (class BinaryOutput &b) const |
| void | serialize (class TextOutput &t) const |
| float | squaredLength () const |
| float | sum () const |
| x + y | |
| Any | toAny () const |
| Converts the Vector2 to an Any. | |
| std::string | toString () const |
| Vector2 | xx () const |
| Vector3 | xxx () const |
| Vector4 | xxxx () const |
| Vector4 | xxxy () const |
| Vector3 | xxy () const |
| Vector4 | xxyx () const |
| Vector4 | xxyy () const |
| Vector2 | xy () const |
| Vector3 | xyx () const |
| Vector4 | xyxx () const |
| Vector4 | xyxy () const |
| Vector3 | xyy () const |
| Vector4 | xyyx () const |
| Vector4 | xyyy () const |
| Vector2 | yx () const |
| Vector3 | yxx () const |
| Vector4 | yxxx () const |
| Vector4 | yxxy () const |
| Vector3 | yxy () const |
| Vector4 | yxyx () const |
| Vector4 | yxyy () const |
| Vector2 | yy () const |
| Vector3 | yyx () const |
| Vector4 | yyxx () const |
| Vector4 | yyxy () const |
| Vector3 | yyy () const |
| Vector4 | yyyx () const |
| Vector4 | yyyy () const |
Static Public Member Functions | |
| static const Vector2 & | inf () |
| static const Vector2 & | maxFinite () |
| Largest representable vector. | |
| static const Vector2 & | minFinite () |
| smallest (most negative) representable vector | |
| static const Vector2 & | nan () |
| static const Vector2 & | one () |
| static Vector2 | random (Random &r=Random::common()) |
| Uniformly distributed random vector on the unit sphere. | |
| static const Vector2 & | unitX () |
| static const Vector2 & | unitY () |
| static const Vector2 & | zero () |
Public Attributes | |
| float | x |
| float | y |
Do not subclass– this implementation makes assumptions about the memory layout.
|
explicit |
|
inline |
Creates the zero vector.
Referenced by abs(), clamp(), max(), maxAbs(), min(), minAbs(), operator*(), operator+(), operator-(), operator/(), and pow().
| G3D::Vector2::Vector2 | ( | class TextInput & | t | ) |
| G3D::Vector2::Vector2 | ( | class BinaryInput & | b | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Componentwise absolute value.
Referenced by G3D::clamp().
|
inline |
| void G3D::Vector2::deserialize | ( | class BinaryInput & | b | ) |
|
inline |
Returns a unit-length version of this vector.
Returns nan if length is almost zero.
Referenced by fastDirection(), and G3D::Line2D::Line2D().
|
inline |
Returns Vector2::zero() is magnitude is almost zero, otherwise returns unit-length vector.
|
inline |
Referenced by G3D::Box2D::contains(), and G3D::dot().
|
inline |
Potentially less accurate but faster than direction().
Only works if System::hasSSE is true.
|
inline |
|
inline |
| size_t G3D::Vector2::hashCode | ( | ) | const |
|
static |
Referenced by G3D::Widget::bounds(), and G3D::Rect2D::inf().
|
inline |
Returns true if this vector has finite length.
Referenced by G3D::Rect2D::isFinite().
|
inline |
True if any field is NaN.
Referenced by G3D::Rect2D::isEmpty().
|
inline |
Returns true if this vector has length == 1.
|
inline |
Returns true if this vector has length == 0.
|
inline |
Magnitude of the vector.
Referenced by directionOrZero(), G3D::length(), and G3D::normalize().
Linear interpolation.
Referenced by G3D::lerp(), and G3D::Rect2D::lerp().
Component-wise maximum.
Referenced by G3D::Rect2D::intersect(), G3D::max(), G3D::Rect2D::merge(), and G3D::Rect2D::xyxy().
|
static |
Largest representable vector.
Component-wise minimum.
Referenced by G3D::Rect2D::intersect(), G3D::Rect2D::merge(), G3D::min(), and G3D::Rect2D::xyxy().
|
static |
smallest (most negative) representable vector
|
static |
|
static |
|
inline |
|
inline |
|
inline |
|
inline |
Unary minus.
| Vector2 G3D::Vector2::operator/ | ( | float | s | ) | const |
| Vector2& G3D::Vector2::operator/= | ( | float | ) |
|
inline |
|
inline |
|
inline |
|
inline |
Raise each component of this vector to a power.
|
static |
Uniformly distributed random vector on the unit sphere.
| void G3D::Vector2::serialize | ( | class BinaryOutput & | b | ) | const |
| void G3D::Vector2::serialize | ( | class TextOutput & | t | ) | const |
|
inline |
|
inline |
x + y
| std::string G3D::Vector2::toString | ( | ) | const |
|
static |
|
static |
| Vector2 G3D::Vector2::xx | ( | ) | const |
| Vector3 G3D::Vector2::xxx | ( | ) | const |
| Vector4 G3D::Vector2::xxxx | ( | ) | const |
| Vector4 G3D::Vector2::xxxy | ( | ) | const |
| Vector3 G3D::Vector2::xxy | ( | ) | const |
| Vector4 G3D::Vector2::xxyx | ( | ) | const |
| Vector4 G3D::Vector2::xxyy | ( | ) | const |
| Vector2 G3D::Vector2::xy | ( | ) | const |
| Vector3 G3D::Vector2::xyx | ( | ) | const |
| Vector4 G3D::Vector2::xyxx | ( | ) | const |
| Vector4 G3D::Vector2::xyxy | ( | ) | const |
| Vector3 G3D::Vector2::xyy | ( | ) | const |
| Vector4 G3D::Vector2::xyyx | ( | ) | const |
| Vector4 G3D::Vector2::xyyy | ( | ) | const |
| Vector2 G3D::Vector2::yx | ( | ) | const |
| Vector3 G3D::Vector2::yxx | ( | ) | const |
| Vector4 G3D::Vector2::yxxx | ( | ) | const |
| Vector4 G3D::Vector2::yxxy | ( | ) | const |
| Vector3 G3D::Vector2::yxy | ( | ) | const |
| Vector4 G3D::Vector2::yxyx | ( | ) | const |
| Vector4 G3D::Vector2::yxyy | ( | ) | const |
| Vector2 G3D::Vector2::yy | ( | ) | const |
| Vector3 G3D::Vector2::yyx | ( | ) | const |
| Vector4 G3D::Vector2::yyxx | ( | ) | const |
| Vector4 G3D::Vector2::yyxy | ( | ) | const |
| Vector3 G3D::Vector2::yyy | ( | ) | const |
| Vector4 G3D::Vector2::yyyx | ( | ) | const |
| Vector4 G3D::Vector2::yyyy | ( | ) | const |
|
static |
Referenced by directionOrZero(), G3D::Rect2D::extent(), and G3D::Rect2D::wh().
| float G3D::Vector2::x |
Referenced by G3D::abs(), G3D::all(), G3D::any(), G3D::Map2D< Color1, Color1 >::bicubic(), G3D::Map2D< Color1, Color1 >::bilinear(), clamp(), G3D::Rect2D::contains(), G3D::Rect2D::corner(), dot(), G3D::Rect2D::intersects(), G3D::Rect2D::intersectsOrTouches(), max(), maxAbs(), min(), minAbs(), G3D::Map2D< Color1, Color1 >::nearest(), operator!=(), operator*(), G3D::Rect2D::operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), Load3DS::processMapChunk(), G3D::Rect2D::randomPoint(), G3D::Win32Window::setClientPosition(), G3D::UserInput::setMouseXY(), G3D::sign(), Vector2(), G3D::Rect2D::width(), G3D::Rect2D::x0(), G3D::Rect2D::x0y1(), G3D::Rect2D::x1(), G3D::Rect2D::x1y0(), G3D::Rect2D::xywh(), and G3D::Rect2D::xyxy().
| float G3D::Vector2::y |
Referenced by G3D::abs(), G3D::all(), G3D::any(), G3D::Map2D< Color1, Color1 >::bicubic(), G3D::Map2D< Color1, Color1 >::bilinear(), clamp(), G3D::Rect2D::contains(), G3D::Rect2D::corner(), direction(), dot(), G3D::Rect2D::height(), G3D::Rect2D::intersects(), G3D::Rect2D::intersectsOrTouches(), max(), maxAbs(), min(), minAbs(), G3D::Map2D< Color1, Color1 >::nearest(), operator!=(), operator*(), G3D::Rect2D::operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), Load3DS::processMapChunk(), G3D::Rect2D::randomPoint(), G3D::Win32Window::setClientPosition(), G3D::UserInput::setMouseXY(), G3D::sign(), squaredLength(), sum(), Vector2(), G3D::Rect2D::x0y1(), G3D::Rect2D::x1y0(), G3D::Rect2D::xywh(), G3D::Rect2D::xyxy(), G3D::Rect2D::y0(), and G3D::Rect2D::y1().
1.8.2