UT_Vector2 Class Reference

2D Vector class. More...

#include <UT_Vector2.h>

List of all members.

Public Member Functions

 UT_Vector2 (void)
 UT_Vector2 (fpreal vx, fpreal vy)
 UT_Vector2 (const fpreal32 v[2])
 UT_Vector2 (const fpreal64 v[2])
 UT_Vector2 (const UT_Vector3 &v)
 UT_Vector2 (const UT_Vector4 &v)
 ~UT_Vector2 (void)
UT_Vector2operator= (const UT_Vector3 &v)
 Assignment operator that truncates a V3 to a V2.
UT_Vector2operator= (const UT_Vector4 &v)
 Assignment operator that truncates a V4 to a V2.
UT_Vector2 operator- () const
UT_Vector2operator+= (const UT_Vector2 &v)
UT_Vector2operator-= (const UT_Vector2 &v)
unsigned operator== (const UT_Vector2 &v) const
unsigned operator!= (const UT_Vector2 &v) const
int equalZero (fpreal tol=0.00001f) const
int isEqual (const UT_Vector2 &v, fpreal tol=0.00001f) const
void negate ()
void multiplyComponents (const UT_Vector2 &v)
fpreal whichSide (const UT_Vector2 &e1, const UT_Vector2 &e2) const
UT_Vector2operator= (fpreal scalar)
UT_Vector2operator+= (fpreal scalar)
UT_Vector2operator-= (fpreal scalar)
UT_Vector2operator*= (fpreal scalar)
UT_Vector2operator*= (const UT_Vector2 &v)
UT_Vector2operator/= (fpreal scalar)
UT_Vector2operator/= (const UT_Vector2 &v)
UT_Vector2operator*= (const UT_TMatrix2< float > &mat)
fpreal dot (const UT_Vector2 &v) const
fpreal normalize (void)
fpreal length (void) const
 The vector length (not to be confused with the vector dimension).
fpreal length2 (void) const
 The vector length squared.
UT_Vector2 project (const UT_Vector2 &u)
 Calculates the orthogonal projection of a vector u on the *this vector.
UT_Vector2 projection (const UT_Vector2 &p, const UT_Vector2 &v) const
UT_Vector3 getBary (const UT_Vector2 &t0, const UT_Vector2 &t1, const UT_Vector2 &t2, bool *degen=NULL) const
void assign (fpreal xx=0.0f, fpreal yy=0.0f)
 Set the values of the vector components.
void assign (const float *v)
 Set the values of the vector components.
int findMinAbsAxis () const
 These allow you to find out what indices to use for different axes.
int findMaxAbsAxis () const
 These allow you to find out what indices to use for different axes.
const float * data (void) const
float & x (void)
float x (void) const
float & y (void)
float y (void) const
float & operator() (unsigned i)
float operator() (unsigned i) const
float & operator[] (unsigned i)
float operator[] (unsigned i) const
void homogenize (void)
 Express the point in homogeneous coordinates or vice-versa.
void dehomogenize (void)
 Express the point in homogeneous coordinates or vice-versa.
void save (ostream &os, int binary=0) const
 Protected I/O methods.
bool load (UT_IStream &is)
 Protected I/O methods.

Public Attributes

float vec [2]
 The data.

Friends

ostream & operator<< (ostream &os, const UT_Vector2 &v)
 I/O friends.


Detailed Description

2D Vector class.

Definition at line 94 of file UT_Vector2.h.


Constructor & Destructor Documentation

UT_Vector2::UT_Vector2 ( void   )  [inline]

Default constructor. No data is initialized! Use it for extra speed.

Definition at line 98 of file UT_Vector2.h.

UT_Vector2::UT_Vector2 ( fpreal  vx,
fpreal  vy 
) [inline]

Definition at line 103 of file UT_Vector2.h.

UT_Vector2::UT_Vector2 ( const fpreal32  v[2]  )  [inline, explicit]

Definition at line 107 of file UT_Vector2.h.

UT_Vector2::UT_Vector2 ( const fpreal64  v[2]  )  [inline, explicit]

Definition at line 111 of file UT_Vector2.h.

UT_Vector2::UT_Vector2 ( const UT_Vector3 v  )  [explicit]

UT_Vector2::UT_Vector2 ( const UT_Vector4 v  )  [explicit]

UT_Vector2::~UT_Vector2 ( void   )  [inline]

Definition at line 119 of file UT_Vector2.h.


Member Function Documentation

void UT_Vector2::assign ( const float *  v  )  [inline]

Set the values of the vector components.

Definition at line 318 of file UT_Vector2.h.

void UT_Vector2::assign ( fpreal  xx = 0.0f,
fpreal  yy = 0.0f 
) [inline]

Set the values of the vector components.

Definition at line 313 of file UT_Vector2.h.

const float* UT_Vector2::data ( void   )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 283 of file UT_Vector2.h.

void UT_Vector2::dehomogenize ( void   )  [inline]

Express the point in homogeneous coordinates or vice-versa.

Definition at line 323 of file UT_Vector2.h.

fpreal UT_Vector2::dot ( const UT_Vector2 v  )  const [inline]

Definition at line 225 of file UT_Vector2.h.

int UT_Vector2::equalZero ( fpreal  tol = 0.00001f  )  const [inline]

Definition at line 152 of file UT_Vector2.h.

int UT_Vector2::findMaxAbsAxis (  )  const [inline]

These allow you to find out what indices to use for different axes.

Definition at line 250 of file UT_Vector2.h.

int UT_Vector2::findMinAbsAxis (  )  const [inline]

These allow you to find out what indices to use for different axes.

Definition at line 243 of file UT_Vector2.h.

UT_Vector3 UT_Vector2::getBary ( const UT_Vector2 t0,
const UT_Vector2 t1,
const UT_Vector2 t2,
bool *  degen = NULL 
) const

Compute (homogeneous) barycentric co-ordinates of this point relative to the triangle defined by t0, t1 and t2. (The point is projected into the triangle's plane.)

void UT_Vector2::homogenize ( void   )  [inline]

Express the point in homogeneous coordinates or vice-versa.

Definition at line 322 of file UT_Vector2.h.

int UT_Vector2::isEqual ( const UT_Vector2 v,
fpreal  tol = 0.00001f 
) const [inline]

Definition at line 157 of file UT_Vector2.h.

fpreal UT_Vector2::length ( void   )  const [inline]

The vector length (not to be confused with the vector dimension).

Definition at line 260 of file UT_Vector2.h.

fpreal UT_Vector2::length2 ( void   )  const [inline]

The vector length squared.

Definition at line 262 of file UT_Vector2.h.

bool UT_Vector2::load ( UT_IStream is  ) 

Protected I/O methods.

void UT_Vector2::multiplyComponents ( const UT_Vector2 v  )  [inline]

Definition at line 165 of file UT_Vector2.h.

void UT_Vector2::negate ( void   )  [inline]

Definition at line 163 of file UT_Vector2.h.

fpreal UT_Vector2::normalize ( void   )  [inline]

Definition at line 229 of file UT_Vector2.h.

unsigned UT_Vector2::operator!= ( const UT_Vector2 v  )  const [inline]

Definition at line 151 of file UT_Vector2.h.

float UT_Vector2::operator() ( unsigned  i  )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 293 of file UT_Vector2.h.

float& UT_Vector2::operator() ( unsigned  i  )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 288 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator*= ( const UT_TMatrix2< float > &  mat  )  [inline]

Definition at line 221 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator*= ( const UT_Vector2 v  )  [inline]

Definition at line 204 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator*= ( fpreal  scalar  )  [inline]

Definition at line 198 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator+= ( fpreal  scalar  )  [inline]

Definition at line 188 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator+= ( const UT_Vector2 v  )  [inline]

Definition at line 135 of file UT_Vector2.h.

UT_Vector2 UT_Vector2::operator- (  )  const [inline]

Definition at line 131 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator-= ( fpreal  scalar  )  [inline]

Definition at line 194 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator-= ( const UT_Vector2 v  )  [inline]

Definition at line 141 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator/= ( const UT_Vector2 v  )  [inline]

Definition at line 214 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator/= ( fpreal  scalar  )  [inline]

Definition at line 210 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator= ( fpreal  scalar  )  [inline]

Definition at line 183 of file UT_Vector2.h.

UT_Vector2& UT_Vector2::operator= ( const UT_Vector4 v  ) 

Assignment operator that truncates a V4 to a V2.

UT_Vector2& UT_Vector2::operator= ( const UT_Vector3 v  ) 

Assignment operator that truncates a V3 to a V2.

unsigned UT_Vector2::operator== ( const UT_Vector2 v  )  const [inline]

Definition at line 147 of file UT_Vector2.h.

float UT_Vector2::operator[] ( unsigned  i  )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 303 of file UT_Vector2.h.

float& UT_Vector2::operator[] ( unsigned  i  )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 298 of file UT_Vector2.h.

UT_Vector2 UT_Vector2::project ( const UT_Vector2 u  ) 

Calculates the orthogonal projection of a vector u on the *this vector.

UT_Vector2 UT_Vector2::projection ( const UT_Vector2 p,
const UT_Vector2 v 
) const

Vector p (representing a point in 2-space) and vector v define a line. This member returns the projection of "this" onto the line (the point on the line that is closest to this point).

void UT_Vector2::save ( ostream &  os,
int  binary = 0 
) const

Protected I/O methods.

fpreal UT_Vector2::whichSide ( const UT_Vector2 e1,
const UT_Vector2 e2 
) const [inline]

Given an oriented line from e1 passing through e2, determine on which side of the line the point p lies. Alternatively, determine in which half plane, positive or negative, the point lies. If the segment degenerates to a point, then the point is always on it.

Definition at line 177 of file UT_Vector2.h.

float UT_Vector2::x ( void   )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 285 of file UT_Vector2.h.

float& UT_Vector2::x ( void   )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 284 of file UT_Vector2.h.

float UT_Vector2::y ( void   )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 287 of file UT_Vector2.h.

float& UT_Vector2::y ( void   )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 286 of file UT_Vector2.h.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
const UT_Vector2 v 
) [friend]

I/O friends.

Definition at line 338 of file UT_Vector2.h.


Member Data Documentation

float UT_Vector2::vec[2]

The data.

Definition at line 333 of file UT_Vector2.h.


The documentation for this class was generated from the following file:

Generated on Fri May 25 00:10:55 2012 for HDK by  doxygen 1.5.9