Public Member Functions | |
float & | operator[] (int i) |
const float & | operator[] (int i) const |
const float * | array () const |
Vector2 (const Vector2 &i) | |
Vector2 (const float v[2]) | |
Vector2 (const double v[2]) | |
Vector2 (float a, float b) | |
Vector2 & | operator= (const Vector2 &v) |
void | set (float i) |
void | set (float a, float b) |
void | clear () |
Vector2 | operator* (float d) const |
Vector2 & | operator*= (float d) |
Vector2 | operator* (const Vector2 &v) const |
Vector2 & | operator*= (const Vector2 &v) |
Vector2 | operator/ (float d) const |
Vector2 & | operator/= (float d) |
Vector2 | operator/ (const Vector2 &v) const |
Vector2 & | operator/= (const Vector2 &v) |
Vector2 | operator+ (const Vector2 &v) const |
Vector2 & | operator+= (const Vector2 &v) |
Vector2 | operator- () const |
Vector2 | operator- (const Vector2 &v) const |
Vector2 & | operator-= (const Vector2 &v) |
bool | operator== (const Vector2 &v) const |
bool | operator!= (const Vector2 &v) const |
bool | operator== (float d) const |
bool | operator!= (float d) const |
bool | operator< (const Vector2 &v) const |
Fairly arbitrary operator so you can store these in ordered arrays. | |
float | length () const |
float | lengthSquared () const |
float | distanceBetween (const Vector2 &v) const |
float | distanceSquared (const Vector2 &v) const |
float | dot (const Vector2 &v) const |
float | cross (const Vector2 &v) const |
Returns the Z component of the cross product, Ux*Vy-Uy*Vx. | |
float | normalize () |
Change the vector to be unit length. Returns the original length. | |
void | negate () |
void | append (Hash &) const |
Public Attributes | |
float | x |
float | y |
Friends | |
std::ostream & | operator<< (std::ostream &o, const Vector2 &) |
2-component vector, used to represent a point/vector in the plane.
This object is in general compatible with the SbVec2 template in the Inventor library. However it allows direct access to the x,y,z members, which imho makes math using this much easier to read.
See DD::Image::Vector3 for more details on the member functions.
This is component multiplication! Use dot() or cross() for vector multiply
|
inline |
Same as (this-v).length()
|
inline |
Same as (this-v).lengthSquared()
Referenced by DD::Image::Quadtree< T >::_add(), and DD::Image::Quadtree< unsigned >::add().
©2020 The Foundry Visionmongers, Ltd. All Rights Reserved. |