Wonton::Point< D > Class Template Reference

Represents a point in an N-dimensional space. More...

#include <Point.h>

Public Member Functions

WONTON_INLINE Point ()
 Default constructor - Point at origin in D-space. More...
 
WONTON_INLINE Point (const std::vector< double > &v)
 Specialized constructor from a std::vector of arbitary size. More...
 
WONTON_INLINE Point (const double &x, const double &y, const double &z)
 Specialized constructor for Points in 3d. More...
 
WONTON_INLINE Point (const double &x, const double &y)
 Specialized constructor for Points in 2d. More...
 
WONTON_INLINE Point (const double &x)
 Specialized constructor for Points in 1d. More...
 
WONTON_INLINE Point (const Vector< D > &v)
 Convert a Vector to a Point. More...
 
WONTON_INLINE Point (const Point< D > &rhs)
 Copy constructor. More...
 
WONTON_INLINE const double & operator[] (const int &i) const
 Return component i of the Point. More...
 
WONTON_INLINE double & operator[] (const int &i)
 Return component i of the Point. More...
 
WONTON_INLINE Point< D > operator- () const
 Negative of this Point. More...
 
WONTON_INLINE Point< D > & operator+= (const Vector< D > &v)
 Translate this Point along the Vector v. More...
 
WONTON_INLINE Point< D > & operator+= (const Point< D > &p)
 Add two Point vectors to get a third point vector. More...
 
WONTON_INLINE Point< D > & operator+= (std::vector< double > const &v)
 
WONTON_INLINE Point< D > & operator*= (double s)
 Scale this Point (*) More...
 
WONTON_INLINE Point< D > & operator/= (double s)
 Scale this Point (/) More...
 
std::istream & readFromStream (std::istream &is)
 Read in the coordinates a Point from an input stream. More...
 
std::ostream & writeToStream (std::ostream &os) const
 Pretty printing of the coordinates of a Point to an output stream. More...
 
WONTON_INLINE Vector< D > asV ()
 Convert Point to Vector from the origin to the coordinates of the Point. More...
 
WONTON_INLINE Vector< D > asV () const
 Convert Point to Vector from the origin to the coordinates of the Point. More...
 

Detailed Description

template<int D>
class Wonton::Point< D >

Represents a point in an N-dimensional space.

Template Parameters
DIndicates the dimensionality of the Point (this will generally be one of [1,2,3]).

Constructor & Destructor Documentation

◆ Point() [1/7]

template<int D>
WONTON_INLINE Wonton::Point< D >::Point ( )
inline

Default constructor - Point at origin in D-space.

◆ Point() [2/7]

template<int D>
WONTON_INLINE Wonton::Point< D >::Point ( const std::vector< double > &  v)
inline

Specialized constructor from a std::vector of arbitary size.

Parameters
[in]vstd::vector of coordinates.

◆ Point() [3/7]

template<int D>
WONTON_INLINE Wonton::Point< D >::Point ( const double &  x,
const double &  y,
const double &  z 
)
inline

Specialized constructor for Points in 3d.

Parameters
[in]x,y,zThe (x,y,z) coordinates of this Point.

◆ Point() [4/7]

template<int D>
WONTON_INLINE Wonton::Point< D >::Point ( const double &  x,
const double &  y 
)
inline

Specialized constructor for Points in 2d.

Parameters
[in]x,yThe (x,y) coordinates of this Point.

◆ Point() [5/7]

template<int D>
WONTON_INLINE Wonton::Point< D >::Point ( const double &  x)
inline

Specialized constructor for Points in 1d.

Parameters
[in]xThe x coordinates of this Point.

◆ Point() [6/7]

template<int D>
WONTON_INLINE Wonton::Point< D >::Point ( const Vector< D > &  v)
inlineexplicit

Convert a Vector to a Point.

◆ Point() [7/7]

template<int D>
WONTON_INLINE Wonton::Point< D >::Point ( const Point< D > &  rhs)
inline

Copy constructor.

Member Function Documentation

◆ asV() [1/2]

template<int D>
WONTON_INLINE Vector<D> Wonton::Point< D >::asV ( )
inline

Convert Point to Vector from the origin to the coordinates of the Point.

◆ asV() [2/2]

template<int D>
WONTON_INLINE Vector<D> Wonton::Point< D >::asV ( ) const
inline

Convert Point to Vector from the origin to the coordinates of the Point.

◆ operator*=()

template<int D>
WONTON_INLINE Point<D>& Wonton::Point< D >::operator*= ( double  s)
inline

Scale this Point (*)

◆ operator+=() [1/3]

template<int D>
WONTON_INLINE Point<D>& Wonton::Point< D >::operator+= ( const Vector< D > &  v)
inline

Translate this Point along the Vector v.

◆ operator+=() [2/3]

template<int D>
WONTON_INLINE Point<D>& Wonton::Point< D >::operator+= ( const Point< D > &  p)
inline

Add two Point vectors to get a third point vector.

◆ operator+=() [3/3]

template<int D>
WONTON_INLINE Point<D>& Wonton::Point< D >::operator+= ( std::vector< double > const &  v)
inline

◆ operator-()

template<int D>
WONTON_INLINE Point<D> Wonton::Point< D >::operator- ( ) const
inline

Negative of this Point.

◆ operator/=()

template<int D>
WONTON_INLINE Point<D>& Wonton::Point< D >::operator/= ( double  s)
inline

Scale this Point (/)

◆ operator[]() [1/2]

template<int D>
WONTON_INLINE const double& Wonton::Point< D >::operator[] ( const int &  i) const
inline

Return component i of the Point.

◆ operator[]() [2/2]

template<int D>
WONTON_INLINE double& Wonton::Point< D >::operator[] ( const int &  i)
inline

Return component i of the Point.

◆ readFromStream()

template<int D>
std::istream& Wonton::Point< D >::readFromStream ( std::istream &  is)
inline

Read in the coordinates a Point from an input stream.

◆ writeToStream()

template<int D>
std::ostream& Wonton::Point< D >::writeToStream ( std::ostream &  os) const
inline

Pretty printing of the coordinates of a Point to an output stream.


The documentation for this class was generated from the following file:
  • /home/wonton/wonton/wonton/support/Point.h