vec2d.h File Reference
+ Include dependency graph for vec2d.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GfVec2d
 Basic type for a vector of 2 double components. More...
 

Functions

GF_API std::ostream & operator<< (std::ostream &, GfVec2d const &)
 Output a GfVec2d. More...
 
GfVec2d GfCompMult (GfVec2d const &v1, GfVec2d const &v2)
 Returns component-wise multiplication of vectors v1 and v2. More...
 
GfVec2d GfCompDiv (GfVec2d const &v1, GfVec2d const &v2)
 Returns component-wise quotient of vectors v1 and v2. More...
 
double GfDot (GfVec2d const &v1, GfVec2d const &v2)
 Returns the dot (inner) product of two vectors. More...
 
double GfGetLength (GfVec2d const &v)
 Returns the geometric length of v. More...
 
double GfNormalize (GfVec2d *v, double eps=GF_MIN_VECTOR_LENGTH)
 Normalizes *v in place to unit length, returning the length before normalization. More...
 
GfVec2d GfGetNormalized (GfVec2d const &v, double eps=GF_MIN_VECTOR_LENGTH)
 Returns a normalized (unit-length) vector with the same direction as v. More...
 
GfVec2d GfGetProjection (GfVec2d const &a, GfVec2d const &b)
 Returns the projection of a onto b. More...
 
GfVec2d GfGetComplement (GfVec2d const &a, GfVec2d const &b)
 Returns the orthogonal complement of a.GetProjection(b). More...
 
bool GfIsClose (GfVec2d const &v1, GfVec2d const &v2, double tolerance)
 Tests for equality within a given tolerance, returning true if the length of the difference vector is less than or equal to tolerance. More...
 

Function Documentation

◆ GfCompDiv()

GfVec2d GfCompDiv ( GfVec2d const &  v1,
GfVec2d const &  v2 
)
inline

Returns component-wise quotient of vectors v1 and v2.

Definition at line 324 of file vec2d.h.

◆ GfCompMult()

GfVec2d GfCompMult ( GfVec2d const &  v1,
GfVec2d const &  v2 
)
inline

Returns component-wise multiplication of vectors v1 and v2.

Definition at line 315 of file vec2d.h.

◆ GfDot()

double GfDot ( GfVec2d const &  v1,
GfVec2d const &  v2 
)
inline

Returns the dot (inner) product of two vectors.

Definition at line 333 of file vec2d.h.

◆ GfGetComplement()

GfVec2d GfGetComplement ( GfVec2d const &  a,
GfVec2d const &  b 
)
inline

Returns the orthogonal complement of a.GetProjection(b).

That is:

a - a.GetProjection(b)

Definition at line 378 of file vec2d.h.

◆ GfGetLength()

double GfGetLength ( GfVec2d const &  v)
inline

Returns the geometric length of v.

Definition at line 340 of file vec2d.h.

◆ GfGetNormalized()

GfVec2d GfGetNormalized ( GfVec2d const &  v,
double  eps = GF_MIN_VECTOR_LENGTH 
)
inline

Returns a normalized (unit-length) vector with the same direction as v.

If the length of this vector is smaller than eps, the vector divided by eps is returned.

Definition at line 358 of file vec2d.h.

◆ GfGetProjection()

GfVec2d GfGetProjection ( GfVec2d const &  a,
GfVec2d const &  b 
)
inline

Returns the projection of a onto b.

That is:

b * (a * b)

Definition at line 368 of file vec2d.h.

◆ GfIsClose()

bool GfIsClose ( GfVec2d const &  v1,
GfVec2d const &  v2,
double  tolerance 
)
inline

Tests for equality within a given tolerance, returning true if the length of the difference vector is less than or equal to tolerance.

Definition at line 386 of file vec2d.h.

◆ GfNormalize()

double GfNormalize ( GfVec2d v,
double  eps = GF_MIN_VECTOR_LENGTH 
)
inline

Normalizes *v in place to unit length, returning the length before normalization.

If the length of *v is smaller than eps then *v is set to *v/eps. The original length of *v is returned.

Definition at line 349 of file vec2d.h.