wfmath  1.0.3
A math library for the Worldforge system.
WFMath::Vector< dim > Class Template Reference

A dim dimensional vector. More...

#include <vector.h>

Public Member Functions

 Vector ()
 Construct an uninitialized vector. More...
 
 Vector (const Vector &)=default
 Construct a copy of a vector. More...
 
 Vector (const AtlasInType &a)
 Construct a vector from an object passed by Atlas. More...
 
 Vector (const Point< dim > &point)
 Construct a vector from a point. More...
 
AtlasOutType toAtlas () const
 Create an Atlas object from the vector. More...
 
void fromAtlas (const AtlasInType &a)
 Set the vector's value to that given by an Atlas object. More...
 
Vectoroperator= (const Vector &v)=default
 
bool isEqualTo (const Vector &v, CoordType epsilon=numeric_constants< CoordType >::epsilon()) const
 
bool operator== (const Vector &v) const
 
bool operator!= (const Vector &v) const
 
bool isValid () const
 
void setValid (bool valid=true)
 make isValid() return true if you've initialized the vector by hand More...
 
Vectorzero ()
 Zero the components of a vector. More...
 
CoordType operator[] (const int i) const
 Get the i'th element of the vector. More...
 
CoordTypeoperator[] (const int i)
 Get the i'th element of the vector. More...
 
CoordType sqrMag () const
 The squared magnitude of a vector. More...
 
CoordType mag () const
 The magnitude of a vector. More...
 
Vectornormalize (CoordType norm=1.0)
 Normalize a vector. More...
 
CoordType sloppyMag () const
 An approximation to the magnitude of a vector. More...
 
VectorsloppyNorm (CoordType norm=1.0)
 Approximately normalize a vector. More...
 
Vectorrotate (int axis1, int axis2, CoordType theta)
 Rotate the vector in the (axis1, axis2) plane by the angle theta. More...
 
Vectorrotate (const Vector &v1, const Vector &v2, CoordType theta)
 Rotate the vector in the (v1, v2) plane by the angle theta. More...
 
Vectorrotate (const RotMatrix< dim > &)
 Rotate the vector using a matrix. More...
 
Vectormirror (const int i)
 Reflect a vector in the direction of the i'th axis. More...
 
Vectormirror (const Vector &v)
 Reflect a vector in the direction specified by v. More...
 
Vectormirror ()
 Reflect a vector in all directions simultaneously. More...
 
 Vector (CoordType x, CoordType y)
 2D only: construct a vector from (x, y) coordinates More...
 
 Vector (CoordType x, CoordType y, CoordType z)
 3D only: construct a vector from (x, y, z) coordinates More...
 
Vectorrotate (CoordType theta)
 2D only: rotate a vector by an angle theta More...
 
VectorrotateX (CoordType theta)
 3D only: rotate a vector about the x axis by an angle theta More...
 
VectorrotateY (CoordType theta)
 3D only: rotate a vector about the y axis by an angle theta More...
 
VectorrotateZ (CoordType theta)
 3D only: rotate a vector about the z axis by an angle theta More...
 
Vectorrotate (const Vector &axis, CoordType theta)
 3D only: rotate a vector about the i'th axis by an angle theta More...
 
Vectorrotate (const Quaternion &q)
 3D only: rotate a vector using a Quaternion More...
 
CoordType x () const
 Access the first component of a vector. More...
 
CoordTypex ()
 Access the first component of a vector. More...
 
CoordType y () const
 Access the second component of a vector. More...
 
CoordTypey ()
 Access the second component of a vector. More...
 
CoordType z () const
 Access the third component of a vector. More...
 
CoordTypez ()
 Access the third component of a vector. More...
 
VectormirrorX ()
 Flip the x component of a vector. More...
 
VectormirrorY ()
 Flip the y component of a vector. More...
 
VectormirrorZ ()
 Flip the z component of a vector. More...
 
Vectorpolar (CoordType r, CoordType theta)
 2D only: construct a vector from polar coordinates More...
 
void asPolar (CoordType &r, CoordType &theta) const
 2D only: convert a vector to polar coordinates More...
 
Vectorpolar (CoordType r, CoordType theta, CoordType z)
 3D only: construct a vector from polar coordinates More...
 
void asPolar (CoordType &r, CoordType &theta, CoordType &z) const
 3D only: convert a vector to polar coordinates More...
 
Vectorspherical (CoordType r, CoordType theta, CoordType phi)
 3D only: construct a vector from shperical coordinates More...
 
void asSpherical (CoordType &r, CoordType &theta, CoordType &phi) const
 3D only: convert a vector to shperical coordinates More...
 
const CoordTypeelements () const
 
template<>
CoordType sloppyMag () const
 
template<>
CoordType sloppyMag () const
 
template<>
Vector< 3 > & rotate (const Vector< 3 > &axis, CoordType theta)
 
template<>
Vector< 3 > & rotate (const Quaternion &q)
 
template<>
Vector< 2 > & polar (CoordType r, CoordType theta)
 
template<>
void asPolar (CoordType &r, CoordType &theta) const
 
template<>
Vector< 3 > & polar (CoordType r, CoordType theta, CoordType z)
 
template<>
void asPolar (CoordType &r, CoordType &theta, CoordType &z) const
 
template<>
Vector< 3 > & spherical (CoordType r, CoordType theta, CoordType phi)
 
template<>
void asSpherical (CoordType &r, CoordType &theta, CoordType &phi) const
 
template<>
CoordType z () const
 
template<>
CoordTypez ()
 
template<>
Vector< 3 > & mirrorZ ()
 
template<>
CoordType sloppyMagMax ()
 
template<>
CoordType sloppyMagMax ()
 
template<>
CoordType sloppyMagMax ()
 
template<>
CoordType sloppyMagMaxSqrt ()
 
template<>
CoordType sloppyMagMaxSqrt ()
 
template<>
CoordType sloppyMagMaxSqrt ()
 
template<>
Vector< 3 > & rotate (const Vector< 3 > &axis, CoordType theta)
 
template<>
Vector< 3 > & rotate (const Quaternion &q)
 
template<>
Vector< 2 > & polar (CoordType r, CoordType theta)
 
template<>
void asPolar (CoordType &r, CoordType &theta) const
 
template<>
Vector< 3 > & polar (CoordType r, CoordType theta, CoordType z)
 
template<>
void asPolar (CoordType &r, CoordType &theta, CoordType &z) const
 
template<>
Vector< 3 > & spherical (CoordType r, CoordType theta, CoordType phi)
 
template<>
void asSpherical (CoordType &r, CoordType &theta, CoordType &phi) const
 
template<>
CoordType sloppyMag () const
 
template<>
CoordType sloppyMag () const
 
template<>
CoordType sloppyMag () const
 
template<>
 Vector (CoordType x, CoordType y)
 
template<>
 Vector (CoordType x, CoordType y, CoordType z)
 
template<>
Vector< 2 > & rotate (CoordType theta)
 
template<>
Vector< 3 > & rotateX (CoordType theta)
 
template<>
Vector< 3 > & rotateY (CoordType theta)
 
template<>
Vector< 3 > & rotateZ (CoordType theta)
 

Static Public Member Functions

static const Vector< dim > & ZERO ()
 Provides a global instance preset to zero. More...
 
static CoordType sloppyMagMax ()
 The maximum ratio of the return value of sloppyMag() to the true magnitude. More...
 
static CoordType sloppyMagMaxSqrt ()
 The square root of sloppyMagMax() More...
 

Friends

class ZeroPrimitive< Vector< dim > >
 
std::ostream & operator (std::ostream &os, const Vector &v)
 
std::istream & operator>> (std::istream &is, Vector &v)
 
Vectoroperator+= (Vector &v1, const Vector &v2)
 Add the second vector to the first. More...
 
Vectoroperator-= (Vector &v1, const Vector &v2)
 Subtract the second vector from the first. More...
 
Vectoroperator*= (Vector &v, CoordType d)
 Multiply the magnitude of v by d. More...
 
Vectoroperator/= (Vector &v, CoordType d)
 Divide the magnitude of v by d. More...
 
Vector operator+ (const Vector &v1, const Vector &v2)
 Take the sum of two vectors. More...
 
Vector operator- (const Vector &v1, const Vector &v2)
 Take the difference of two vectors. More...
 
Vector operator- (const Vector &v)
 Reverse the direction of a vector. More...
 
Vector operator* (CoordType d, const Vector &v)
 Multiply a vector by a scalar. More...
 
Vector operator* (const Vector &v, CoordType d)
 Multiply a vector by a scalar. More...
 
Vector operator/ (const Vector &v, CoordType d)
 Divide a vector by a scalar. More...
 
Vector Prod (const RotMatrix< dim > &m, const Vector &v)
 returns m * v More...
 
Vector InvProd (const RotMatrix< dim > &m, const Vector &v)
 returns m^-1 * v More...
 
Vector operator- (const Point< dim > &c1, const Point< dim > &c2)
 Find the vector which gives the offset between two points. More...
 
Point< dim > operator+ (const Point< dim > &c, const Vector &v)
 Find the point at the offset v from the point c. More...
 
Point< dim > operator- (const Point< dim > &c, const Vector &v)
 Find the point at the offset -v from the point c. More...
 
Point< dim > operator+ (const Vector &v, const Point< dim > &c)
 Find the point at the offset v from the point c. More...
 
Point< dim > & operator+= (Point< dim > &p, const Vector &rhs)
 Shift a point by a vector. More...
 
Point< dim > & operator-= (Point< dim > &p, const Vector &rhs)
 Shift a point by a vector, in the opposite direction. More...
 
CoordType Cross (const Vector< 2 > &v1, const Vector< 2 > &v2)
 2D only: get the z component of the cross product of two vectors More...
 
Vector< 3 > Cross (const Vector< 3 > &v1, const Vector< 3 > &v2)
 3D only: get the cross product of two vectors More...
 
CoordType Dot (const Vector &v1, const Vector &v2)
 The dot product of two vectors. More...
 
CoordType Angle (const Vector &v, const Vector &u)
 The angle between two vectors. More...
 

Detailed Description

template<int dim = 3>
class WFMath::Vector< dim >

A dim dimensional vector.

This class implements the 'generic' subset of the interface in the fake class Shape.

Definition at line 55 of file const.h.

Constructor & Destructor Documentation

◆ Vector() [1/6]

template<int dim = 3>
WFMath::Vector< dim >::Vector ( )
inline

Construct an uninitialized vector.

Definition at line 125 of file vector.h.

Referenced by WFMath::Vector< 3 >::mirror(), and WFMath::Vector< 3 >::Vector().

◆ Vector() [2/6]

template<int dim = 3>
WFMath::Vector< dim >::Vector ( const Vector< dim > &  )
default

Construct a copy of a vector.

◆ Vector() [3/6]

template<int dim>
WFMath::Vector< dim >::Vector ( const AtlasInType a)
inlineexplicit

Construct a vector from an object passed by Atlas.

Definition at line 103 of file atlasconv.h.

◆ Vector() [4/6]

template<int dim>
WFMath::Vector< dim >::Vector ( const Point< dim > &  point)
explicit

Construct a vector from a point.

Definition at line 46 of file vector_funcs.h.

◆ Vector() [5/6]

template<int dim = 3>
WFMath::Vector< dim >::Vector ( CoordType  x,
CoordType  y 
)

2D only: construct a vector from (x, y) coordinates

◆ Vector() [6/6]

template<int dim = 3>
WFMath::Vector< dim >::Vector ( CoordType  x,
CoordType  y,
CoordType  z 
)

3D only: construct a vector from (x, y, z) coordinates

Member Function Documentation

◆ asPolar() [1/2]

template<int dim = 3>
void WFMath::Vector< dim >::asPolar ( CoordType r,
CoordType theta 
) const

2D only: convert a vector to polar coordinates

Referenced by WFMath::Vector< 3 >::mirrorY().

◆ asPolar() [2/2]

template<int dim = 3>
void WFMath::Vector< dim >::asPolar ( CoordType r,
CoordType theta,
CoordType z 
) const

3D only: convert a vector to polar coordinates

◆ asSpherical()

template<int dim = 3>
void WFMath::Vector< dim >::asSpherical ( CoordType r,
CoordType theta,
CoordType phi 
) const

3D only: convert a vector to shperical coordinates

Referenced by WFMath::Vector< 3 >::mirrorY().

◆ fromAtlas()

template<int dim>
void WFMath::Vector< dim >::fromAtlas ( const AtlasInType a)
inline

Set the vector's value to that given by an Atlas object.

Definition at line 109 of file atlasconv.h.

Referenced by WFMath::RotBox< dim >::fromAtlas(), and WFMath::Vector< 3 >::Vector().

◆ mag()

template<int dim = 3>
CoordType WFMath::Vector< dim >::mag ( ) const
inline

The magnitude of a vector.

Definition at line 217 of file vector.h.

Referenced by WFMath::Vector< 3 >::normalize(), and WFMath::Quaternion::rotation().

◆ mirror() [1/3]

template<int dim = 3>
Vector& WFMath::Vector< dim >::mirror ( const int  i)
inline

Reflect a vector in the direction of the i'th axis.

Definition at line 271 of file vector.h.

◆ mirror() [2/3]

template<int dim = 3>
Vector& WFMath::Vector< dim >::mirror ( const Vector< dim > &  v)
inline

Reflect a vector in the direction specified by v.

Definition at line 273 of file vector.h.

◆ mirror() [3/3]

template<int dim = 3>
Vector& WFMath::Vector< dim >::mirror ( )
inline

Reflect a vector in all directions simultaneously.

This is a nice way to implement the parity operation if dim is odd.

Definition at line 279 of file vector.h.

Referenced by WFMath::Vector< 3 >::mirrorX(), and WFMath::Vector< 3 >::mirrorY().

◆ mirrorX()

template<int dim = 3>
Vector& WFMath::Vector< dim >::mirrorX ( )
inline

Flip the x component of a vector.

Definition at line 326 of file vector.h.

◆ mirrorY()

template<int dim = 3>
Vector& WFMath::Vector< dim >::mirrorY ( )
inline

Flip the y component of a vector.

Definition at line 328 of file vector.h.

◆ mirrorZ()

template<int dim = 3>
Vector& WFMath::Vector< dim >::mirrorZ ( )

Flip the z component of a vector.

Referenced by WFMath::Vector< 3 >::mirrorY().

◆ normalize()

template<int dim = 3>
Vector& WFMath::Vector< dim >::normalize ( CoordType  norm = 1.0)
inline

Normalize a vector.

Definition at line 219 of file vector.h.

◆ operator[]() [1/2]

template<int dim = 3>
CoordType WFMath::Vector< dim >::operator[] ( const int  i) const
inline

Get the i'th element of the vector.

Definition at line 188 of file vector.h.

◆ operator[]() [2/2]

template<int dim = 3>
CoordType& WFMath::Vector< dim >::operator[] ( const int  i)
inline

Get the i'th element of the vector.

Definition at line 190 of file vector.h.

◆ polar() [1/2]

template<int dim = 3>
Vector& WFMath::Vector< dim >::polar ( CoordType  r,
CoordType  theta 
)

2D only: construct a vector from polar coordinates

Referenced by WFMath::Vector< 3 >::mirrorY().

◆ polar() [2/2]

template<int dim = 3>
Vector& WFMath::Vector< dim >::polar ( CoordType  r,
CoordType  theta,
CoordType  z 
)

3D only: construct a vector from polar coordinates

◆ rotate() [1/6]

template<int dim>
Vector< dim > & WFMath::Vector< dim >::rotate ( int  axis1,
int  axis2,
CoordType  theta 
)

Rotate the vector in the (axis1, axis2) plane by the angle theta.

Definition at line 174 of file vector_funcs.h.

Referenced by WFMath::Vector< 3 >::mirror(), and WFMath::Vector< 3 >::normalize().

◆ rotate() [2/6]

template<int dim>
Vector< dim > & WFMath::Vector< dim >::rotate ( const Vector< dim > &  v1,
const Vector< dim > &  v2,
CoordType  theta 
)

Rotate the vector in the (v1, v2) plane by the angle theta.

This throws CollinearVectors if v1 and v2 are parallel.

Definition at line 189 of file vector_funcs.h.

◆ rotate() [3/6]

template<int dim>
Vector< dim > & WFMath::Vector< dim >::rotate ( const RotMatrix< dim > &  m)

Rotate the vector using a matrix.

Definition at line 197 of file vector_funcs.h.

◆ rotate() [4/6]

template<int dim = 3>
Vector& WFMath::Vector< dim >::rotate ( CoordType  theta)

2D only: rotate a vector by an angle theta

◆ rotate() [5/6]

template<int dim = 3>
Vector& WFMath::Vector< dim >::rotate ( const Vector< dim > &  axis,
CoordType  theta 
)

3D only: rotate a vector about the i'th axis by an angle theta

◆ rotate() [6/6]

template<int dim = 3>
Vector& WFMath::Vector< dim >::rotate ( const Quaternion q)

3D only: rotate a vector using a Quaternion

◆ rotateX()

template<int dim = 3>
Vector& WFMath::Vector< dim >::rotateX ( CoordType  theta)

3D only: rotate a vector about the x axis by an angle theta

Referenced by WFMath::Vector< 3 >::mirror().

◆ rotateY()

template<int dim = 3>
Vector& WFMath::Vector< dim >::rotateY ( CoordType  theta)

3D only: rotate a vector about the y axis by an angle theta

Referenced by WFMath::Vector< 3 >::mirror().

◆ rotateZ()

template<int dim = 3>
Vector& WFMath::Vector< dim >::rotateZ ( CoordType  theta)

3D only: rotate a vector about the z axis by an angle theta

Referenced by WFMath::Vector< 3 >::mirror().

◆ setValid()

template<int dim = 3>
void WFMath::Vector< dim >::setValid ( bool  valid = true)
inline

make isValid() return true if you've initialized the vector by hand

Definition at line 154 of file vector.h.

Referenced by WFMath::RotMatrix< dim >::column(), WFMath::Cross(), WFMath::Quaternion::fromRotMatrix(), WFMath::Quaternion::Quaternion(), WFMath::Quaternion::rotation(), and WFMath::RotMatrix< dim >::row().

◆ sloppyMag()

template<int dim = 3>
CoordType WFMath::Vector< dim >::sloppyMag ( ) const

An approximation to the magnitude of a vector.

The sloppyMag() function gives a value between the true magnitude and sloppyMagMax multiplied by the true magnitude. sloppyNorm() uses sloppyMag() to normalize the vector. This is currently only implemented for dim = {1, 2, 3}. For all current implementations, sloppyMagMax is greater than or equal to one. The constant sloppyMagMaxSqrt is provided for those who want to most closely approximate the true magnitude, without caring whether it's too low or too high.

Referenced by WFMath::Vector< 3 >::normalize().

◆ sloppyMagMax()

template<int dim = 3>
static CoordType WFMath::Vector< dim >::sloppyMagMax ( )
static

The maximum ratio of the return value of sloppyMag() to the true magnitude.

Referenced by WFMath::Vector< 3 >::normalize(), and WFMath::Parallel().

◆ sloppyMagMaxSqrt()

template<int dim = 3>
static CoordType WFMath::Vector< dim >::sloppyMagMaxSqrt ( )
static

The square root of sloppyMagMax()

This is provided for people who want to obtain maximum accuracy from sloppyMag(), without caring whether the answer is high or low. The result sloppyMag()/sloppyMagMaxSqrt() will be within sloppyMagMaxSqrt() of the true magnitude.

Referenced by WFMath::Vector< 3 >::normalize(), and WFMath::Parallel().

◆ sloppyNorm()

template<int dim>
Vector< dim > & WFMath::Vector< dim >::sloppyNorm ( CoordType  norm = 1.0)

Approximately normalize a vector.

Normalize a vector using sloppyMag() instead of the true magnitude. The new length of the vector will be between norm/sloppyMagMax() and norm.

Definition at line 138 of file vector_funcs.h.

Referenced by WFMath::Vector< 3 >::normalize().

◆ spherical()

template<int dim = 3>
Vector& WFMath::Vector< dim >::spherical ( CoordType  r,
CoordType  theta,
CoordType  phi 
)

3D only: construct a vector from shperical coordinates

Referenced by WFMath::Vector< 3 >::mirrorY().

◆ sqrMag()

◆ toAtlas()

template<int dim>
AtlasOutType WFMath::Vector< dim >::toAtlas ( ) const
inline

Create an Atlas object from the vector.

Definition at line 122 of file atlasconv.h.

Referenced by WFMath::Vector< 3 >::Vector().

◆ x() [1/2]

template<int dim = 3>
CoordType WFMath::Vector< dim >::x ( ) const
inline

Access the first component of a vector.

Definition at line 313 of file vector.h.

Referenced by WFMath::Vector< 3 >::mirror().

◆ x() [2/2]

template<int dim = 3>
CoordType& WFMath::Vector< dim >::x ( )
inline

Access the first component of a vector.

Definition at line 315 of file vector.h.

◆ y() [1/2]

template<int dim = 3>
CoordType WFMath::Vector< dim >::y ( ) const
inline

Access the second component of a vector.

Definition at line 317 of file vector.h.

Referenced by WFMath::Vector< 3 >::mirror().

◆ y() [2/2]

template<int dim = 3>
CoordType& WFMath::Vector< dim >::y ( )
inline

Access the second component of a vector.

Definition at line 319 of file vector.h.

◆ z() [1/2]

template<int dim = 3>
CoordType WFMath::Vector< dim >::z ( ) const

Access the third component of a vector.

Referenced by WFMath::Vector< 3 >::mirror(), WFMath::Vector< 3 >::mirrorY(), and WFMath::Vector< 3 >::y().

◆ z() [2/2]

template<int dim = 3>
CoordType& WFMath::Vector< dim >::z ( )

Access the third component of a vector.

◆ ZERO()

template<int dim>
const Vector< dim > & WFMath::Vector< dim >::ZERO ( )
static

Provides a global instance preset to zero.

Definition at line 54 of file vector_funcs.h.

Referenced by WFMath::Vector< 3 >::Vector().

◆ zero()

template<int dim>
Vector< dim > & WFMath::Vector< dim >::zero ( )

Zero the components of a vector.

Definition at line 148 of file vector_funcs.h.

Referenced by WFMath::Vector< 3 >::setValid().

Friends And Related Function Documentation

◆ Angle

template<int dim = 3>
CoordType Angle ( const Vector< dim > &  v,
const Vector< dim > &  u 
)
friend

The angle between two vectors.

Definition at line 160 of file vector_funcs.h.

◆ Cross [1/2]

template<int dim = 3>
CoordType Cross ( const Vector< 2 > &  v1,
const Vector< 2 > &  v2 
)
friend

2D only: get the z component of the cross product of two vectors

Definition at line 102 of file vector.cpp.

Referenced by WFMath::Vector< 3 >::mirrorY(), and WFMath::Vector< 3 >::operator[]().

◆ Cross [2/2]

template<int dim = 3>
Vector<3> Cross ( const Vector< 3 > &  v1,
const Vector< 3 > &  v2 
)
friend

3D only: get the cross product of two vectors

Definition at line 109 of file vector.cpp.

◆ Dot

template<int dim = 3>
CoordType Dot ( const Vector< dim > &  v1,
const Vector< dim > &  v2 
)
friend

The dot product of two vectors.

Definition at line 206 of file vector_funcs.h.

Referenced by WFMath::Vector< 3 >::mirror(), and WFMath::Parallel().

◆ InvProd

template<int dim = 3>
Vector InvProd ( const RotMatrix< dim > &  m,
const Vector< dim > &  v 
)
friend

returns m^-1 * v

Definition at line 177 of file rotmatrix_funcs.h.

◆ operator* [1/2]

template<int dim = 3>
Vector operator* ( CoordType  d,
const Vector< dim > &  v 
)
friend

Multiply a vector by a scalar.

Definition at line 430 of file vector.h.

◆ operator* [2/2]

template<int dim = 3>
Vector operator* ( const Vector< dim > &  v,
CoordType  d 
)
friend

Multiply a vector by a scalar.

Definition at line 420 of file vector.h.

◆ operator*=

template<int dim = 3>
Vector& operator*= ( Vector< dim > &  v,
CoordType  d 
)
friend

Multiply the magnitude of v by d.

Definition at line 103 of file vector_funcs.h.

Referenced by WFMath::Vector< 3 >::mirror().

◆ operator+ [1/3]

template<int dim = 3>
Vector operator+ ( const Vector< dim > &  v1,
const Vector< dim > &  v2 
)
friend

Take the sum of two vectors.

Definition at line 400 of file vector.h.

◆ operator+ [2/3]

template<int dim = 3>
Point<dim> operator+ ( const Point< dim > &  c,
const Vector< dim > &  v 
)
friend

Find the point at the offset v from the point c.

Definition at line 278 of file point.h.

◆ operator+ [3/3]

template<int dim = 3>
Point<dim> operator+ ( const Vector< dim > &  v,
const Point< dim > &  c 
)
friend

Find the point at the offset v from the point c.

Definition at line 288 of file point.h.

◆ operator+= [1/2]

template<int dim = 3>
Vector& operator+= ( Vector< dim > &  v1,
const Vector< dim > &  v2 
)
friend

Add the second vector to the first.

Definition at line 79 of file vector_funcs.h.

◆ operator+= [2/2]

template<int dim = 3>
Point<dim>& operator+= ( Point< dim > &  p,
const Vector< dim > &  rhs 
)
friend

Shift a point by a vector.

Definition at line 100 of file point_funcs.h.

◆ operator- [1/4]

template<int dim = 3>
Vector operator- ( const Vector< dim > &  v1,
const Vector< dim > &  v2 
)
friend

Take the difference of two vectors.

Definition at line 410 of file vector.h.

◆ operator- [2/4]

template<int dim = 3>
Vector operator- ( const Vector< dim > &  v)
friend

Reverse the direction of a vector.

Definition at line 124 of file vector_funcs.h.

◆ operator- [3/4]

template<int dim = 3>
Vector operator- ( const Point< dim > &  c1,
const Point< dim > &  c2 
)
friend

Find the vector which gives the offset between two points.

Definition at line 86 of file point_funcs.h.

◆ operator- [4/4]

template<int dim = 3>
Point<dim> operator- ( const Point< dim > &  c,
const Vector< dim > &  v 
)
friend

Find the point at the offset -v from the point c.

Definition at line 298 of file point.h.

◆ operator-= [1/2]

template<int dim = 3>
Vector& operator-= ( Vector< dim > &  v1,
const Vector< dim > &  v2 
)
friend

Subtract the second vector from the first.

Definition at line 91 of file vector_funcs.h.

Referenced by WFMath::Vector< 3 >::mirror().

◆ operator-= [2/2]

template<int dim = 3>
Point<dim>& operator-= ( Point< dim > &  p,
const Vector< dim > &  rhs 
)
friend

Shift a point by a vector, in the opposite direction.

Definition at line 112 of file point_funcs.h.

◆ operator/

template<int dim = 3>
Vector operator/ ( const Vector< dim > &  v,
CoordType  d 
)
friend

Divide a vector by a scalar.

Definition at line 440 of file vector.h.

◆ operator/=

template<int dim = 3>
Vector& operator/= ( Vector< dim > &  v,
CoordType  d 
)
friend

Divide the magnitude of v by d.

Definition at line 113 of file vector_funcs.h.

◆ Prod

template<int dim = 3>
Vector Prod ( const RotMatrix< dim > &  m,
const Vector< dim > &  v 
)
friend

returns m * v

Definition at line 160 of file rotmatrix_funcs.h.


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