Support Forum G3D Web Page |
Do not subclass– this implementation makes assumptions about the memory layout.
More...
Public Member Functions | |
Vector2 (const Any &any) | |
Vector2 (DoNotInitialize dni) | |
Vector2 () | |
Creates the zero vector. More... | |
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 (const Vector2int32 &other) | |
Vector2 | abs () const |
Componentwise absolute value. More... | |
Vector2 | ceil () const |
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. More... | |
Vector2 | directionOrZero () const |
Returns Vector2::zero() is magnitude is almost zero, otherwise returns unit-length vector. More... | |
float | dot (const Vector2 &s) const |
Vector2 | fastDirection () const |
Potentially less accurate but faster than direction(). More... | |
Vector2 | floor () const |
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. More... | |
bool | isNaN () const |
True if any field is NaN. More... | |
bool | isUnit () const |
Returns true if this vector has length == 1. More... | |
bool | isZero () const |
Returns true if this vector has length == 0. More... | |
float | length () const |
Magnitude of the vector. More... | |
Vector2 | lerp (const Vector2 &v, float alpha) const |
Linear interpolation More... | |
Vector2 | max (const Vector2 &v) const |
Component-wise maximum. More... | |
Vector2 | maxAbs (const Vector2 &v) const |
Component-wise argmax(abs(), v.abs()). More... | |
Vector2 | min (const Vector2 &v) const |
Component-wise minimum. More... | |
Vector2 | minAbs (const Vector2 &v) const |
Component-wise argmin(abs(), v.abs()). More... | |
Vector2 | mod1 () const |
Fast implementation of wrap(1.0f) More... | |
bool | operator!= (const Vector2 &other) const |
Vector2 | operator* (float s) const |
Vector2 | operator* (const Vector2 &v) const |
Array (pointwise) multiplication. More... | |
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. More... | |
Vector2 & | operator-= (const Vector2 &) |
Vector2 | operator/ (const Vector2 &v) const |
Array division. More... | |
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. More... | |
void | serialize (class BinaryOutput &b) const |
void | serialize (class TextOutput &t) const |
float | squaredLength () const |
float | sum () const |
x + y More... | |
Any | toAny () const |
Converts the Vector2 to an Any. More... | |
String | toString () const |
Vector2 | wrap (const Vector2 &v) const |
Vector2 | wrap (float f) 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 Vector2 | hammersleySequence2D (int rayIndex, int raysPerPixel) |
static const Vector2 & | inf () |
static const Vector2 & | maxFinite () |
Largest representable vector. More... | |
static const Vector2 & | minFinite () |
smallest (most negative) representable vector More... | |
static const Vector2 & | nan () |
static const Vector2 & | one () |
static Vector2 | random (Random &r=Random::common()) |
Uniformly distributed random vector on the unit sphere. More... | |
static const Vector2 & | unitX () |
static const Vector2 & | unitY () |
static const Vector2 & | zero () |
Public Attributes | |
float | x |
float | y |
Static Public Attributes | |
static Vector2 | ignore |
For use with default output arguments. More... | |
Do not subclass– this implementation makes assumptions about the memory layout.
G3D::Vector2::Vector2 | ( | const Any & | any | ) |
|
inline |
|
inline |
Creates the zero vector.
Referenced by abs(), ceil(), clamp(), floor(), max(), maxAbs(), min(), minAbs(), mod1(), operator*(), operator+(), operator-(), operator/(), pow(), and wrap().
G3D::Vector2::Vector2 | ( | class TextInput & | t | ) |
G3D::Vector2::Vector2 | ( | class BinaryInput & | b | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
explicit |
|
inline |
Componentwise absolute value.
|
inline |
Referenced by G3D::clamp().
|
inline |
void G3D::Vector2::deserialize | ( | class BinaryInput & | b | ) |
void G3D::Vector2::deserialize | ( | class TextInput & | t | ) |
|
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.
Referenced by G3D::squareMagnitude().
|
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 |
|
inline |
|
inlinestatic |
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.
|
inline |
True if any field is NaN.
Referenced by G3D::EventCoordinateMapper::ready().
|
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().
Component-wise maximum.
Referenced by G3D::max(), and G3D::Rect2D::xyxy().
|
static |
Largest representable vector.
Component-wise minimum.
Referenced by G3D::min(), and G3D::Rect2D::xyxy().
|
static |
smallest (most negative) representable vector
|
inline |
Fast implementation of wrap(1.0f)
|
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 |
Referenced by fuzzyEq(), fuzzyNe(), isUnit(), G3D::Light::randomPosition(), and G3D::squareMagnitude().
|
inline |
x + y
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().
|
static |
For use with default output arguments.
The value is always undefined.
float G3D::Vector2::x |
Referenced by G3D::abs(), abs(), G3D::GuiPane::addRadioButton(), G3D::all(), G3D::any(), G3D::Map2D< Color1, Color1 >::bicubic(), G3D::Map2D< Color1, Color1 >::bilinear(), ceil(), clamp(), G3D::Rect2D::contains(), direction(), dot(), floor(), G3D::TextSurface::getObjectSpaceBoundingBox(), G3D::TextSurface::getObjectSpaceBoundingSphere(), hammersleySequence2D(), G3D::Rect2D::intersects(), G3D::Rect2D::intersectsOrTouches(), isFinite(), isNaN(), isZero(), length(), max(), maxAbs(), min(), minAbs(), mod1(), G3D::Map2D< Color1, Color1 >::nearest(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), G3D::Light::position(), pow(), G3D::Light::randomPosition(), G3D::UserInput::setMouseXY(), G3D::sign(), squaredLength(), sum(), Vector2(), wrap(), G3D::Rect2D::xywh(), and G3D::Rect2D::xyxy().
float G3D::Vector2::y |
Referenced by G3D::abs(), abs(), G3D::all(), G3D::any(), G3D::Map2D< Color1, Color1 >::bicubic(), G3D::Map2D< Color1, Color1 >::bilinear(), ceil(), clamp(), G3D::Rect2D::contains(), direction(), dot(), floor(), G3D::TextSurface::getObjectSpaceBoundingBox(), G3D::TextSurface::getObjectSpaceBoundingSphere(), hammersleySequence2D(), G3D::Rect2D::intersects(), G3D::Rect2D::intersectsOrTouches(), isFinite(), isNaN(), isZero(), length(), max(), maxAbs(), min(), minAbs(), mod1(), G3D::Map2D< Color1, Color1 >::nearest(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), G3D::Light::position(), pow(), G3D::Light::randomPosition(), G3D::UserInput::setMouseXY(), G3D::sign(), squaredLength(), sum(), Vector2(), wrap(), G3D::Rect2D::xywh(), and G3D::Rect2D::xyxy().