Point< N, T > Class Template Reference
A
Point is templated to store N elements of data of type T. If left off, T will default to a "real_t" data type.
More...
#include <Point.h>
List of all members.
|
Public Member Functions |
|
| | Point (const T *srcData) |
| | Point () |
| | Constructs a point at the origin (w=1).
|
| | Point (const Point< N, T > &v) |
| | Copy Constructor.
|
|
| const T & | operator[] (const unsigned index) const |
| T & | operator[] (const unsigned index) |
| const T * | operator* () const |
| T * | operator* () |
|
| bool | operator== (const Point< N, T > &v) const |
| bool | operator!= (const Point< N, T > &v) const |
|
| Point< N, T > & | operator= (const Point< N, T > &v) |
| Point< N, T > & | operator+= (const Vector< N-1, T > &rhs) |
| Point< N, T > & | operator-= (const Vector< N-1, T > &rhs) |
|
| Point< N, T > & | operator*= (const T &scale) |
| Point< N, T > & | operator/= (const T &scale) |
|
| Point< N, T > | operator+ (const Vector< N-1, T > &rhs) const |
| Point< N, T > | operator- (const Vector< N-1, T > &rhs) const |
| Vector< N-1, T > | operator- (const Point< N, T > &rhs) const |
|
| Point< N, T > | operator* (const T &scale) const |
| Point< N, T > | operator/ (const T &scale) const |
|
| bool | isZero () const |
| T | getDistance (const Point< N, T > &v) const |
| T | getDistance2 (const Point< N, T > &v) const |
| T | getSum () const |
| T | getAverage () const |
| void | cleanup () |
| | Cleans up point (0's out entries that are less than epsilon).
|
|
| | Point (const T &v0, const T &v1=0, const T &v2=0, const T &v3=1) |
| | Convenience Constructor (note w = 1 by default).
|
Static Public Member Functions |
|
| static Point< N, T > | origin () |
| | Generates a point full of zeroes.
|
| static Point< N, T > | fill (const T &val) |
| | Generates a point filled with the specified value.
|
| static Point< N, T > | min (const Point< N, T > &v1, const Point< N, T > &v2) |
| static Point< N, T > | max (const Point< N, T > &v1, const Point< N, T > &v2) |
| static Point< N, T > | infinity () |
| | Generates a point filled with the maximum T (infinity).
|
| static Point< N, T > | negativeInfinity () |
| | Generates a point filled with the minimum T (negative infinity).
|
Public Attributes |
| T | data [(N)] |
| | Underlying data stored as an N-length array of type T.
|
Detailed Description
template<unsigned N = 4, typename T = real_t>
class Point< N, T >
A
Point is templated to store N elements of data of type T. If left off, T will default to a "real_t" data type.
Provides basic functionality for a homogeneous point.
Included in this definition are typedefs for the most commonly used points (Point4, Point3, etc), and these can be thought of as shortcuts to reference their associated Point templates. For example, Point4 can be used to refer to Point<4, real_t>.
A Point stores its data internally as an N-length array of type T.
- Author:
- Travis Fischer (fisch0920@gmail.com)
- Date:
- Fall 2008
Definition at line 33 of file Point.h.
Constructor & Destructor Documentation
template<unsigned N, typename T>
| Point< N, T >::Point |
( |
const T * |
srcData |
) |
[inline] |
Expects N arguments of type T
- Note:
- explicitly sets the homogeneous coordinate to 1 (w=1)
Definition at line 23 of file Point.inl.
template<unsigned N, typename T>
Constructs a point at the origin (w=1).
Definition at line 31 of file Point.inl.
template<unsigned N, typename T>
Copy Constructor.
Definition at line 39 of file Point.inl.
template<unsigned N, typename T>
| Point< N, T >::Point |
( |
const T & |
v0, |
|
|
const T & |
v1 = 0, |
|
|
const T & |
v2 = 0, |
|
|
const T & |
v3 = 1 | |
|
) |
| | [inline, explicit] |
Convenience Constructor (note w = 1 by default).
Definition at line 261 of file Point.inl.
Member Function Documentation
template<unsigned N = 4, typename T = real_t>
| static Point<N, T> Point< N, T >::origin |
( |
|
) |
[inline, static] |
Generates a point full of zeroes.
Definition at line 58 of file Point.h.
template<unsigned N = 4, typename T = real_t>
| static Point<N, T> Point< N, T >::fill |
( |
const T & |
val |
) |
[inline, static] |
Generates a point filled with the specified value.
Definition at line 63 of file Point.h.
template<unsigned N = 4, typename T = real_t>
| static Point<N, T> Point< N, T >::min |
( |
const Point< N, T > & |
v1, |
|
|
const Point< N, T > & |
v2 | |
|
) |
| | [inline, static] |
- Returns:
- the element-wise minimum point from the two given points
Definition at line 73 of file Point.h.
template<unsigned N = 4, typename T = real_t>
| static Point<N, T> Point< N, T >::max |
( |
const Point< N, T > & |
v1, |
|
|
const Point< N, T > & |
v2 | |
|
) |
| | [inline, static] |
- Returns:
- the element-wise maximum point from the two given points
Definition at line 83 of file Point.h.
template<unsigned N = 4, typename T = real_t>
| static Point<N, T> Point< N, T >::infinity |
( |
|
) |
[inline, static] |
Generates a point filled with the maximum T (infinity).
Definition at line 93 of file Point.h.
template<unsigned N = 4, typename T = real_t>
| static Point<N, T> Point< N, T >::negativeInfinity |
( |
|
) |
[inline, static] |
Generates a point filled with the minimum T (negative infinity).
Definition at line 98 of file Point.h.
template<unsigned N, typename T>
| const T & Point< N, T >::operator[] |
( |
const unsigned |
index |
) |
const [inline] |
- Returns:
- a const reference to the element at the given index
Definition at line 49 of file Point.inl.
template<unsigned N, typename T>
| T & Point< N, T >::operator[] |
( |
const unsigned |
index |
) |
[inline] |
- Returns:
- a reference to the element at the given index
- Note:
- changes to the returned element will affect this point
Definition at line 58 of file Point.inl.
template<unsigned N, typename T>
| const T * Point< N, T >::operator* |
( |
|
) |
const [inline] |
- Returns:
- a pointer to the underlying data (N-length array of type T)
Definition at line 66 of file Point.inl.
template<unsigned N, typename T>
| T * Point< N, T >::operator* |
( |
|
) |
[inline] |
- Returns:
- a pointer to the underlying data (N-length array of type T)
Definition at line 72 of file Point.inl.
template<unsigned N, typename T>
| bool Point< N, T >::operator== |
( |
const Point< N, T > & |
v |
) |
const [inline] |
template<unsigned N, typename T>
| bool Point< N, T >::operator!= |
( |
const Point< N, T > & |
v |
) |
const [inline] |
template<unsigned N, typename T>
| Point< N, T > & Point< N, T >::operator= |
( |
const Point< N, T > & |
v |
) |
[inline] |
template<unsigned N, typename T>
| Point< N, T > & Point< N, T >::operator+= |
( |
const Vector< N-1, T > & |
rhs |
) |
[inline] |
template<unsigned N, typename T>
| Point< N, T > & Point< N, T >::operator-= |
( |
const Vector< N-1, T > & |
rhs |
) |
[inline] |
template<unsigned N, typename T>
| Point< N, T > & Point< N, T >::operator*= |
( |
const T & |
scale |
) |
[inline] |
template<unsigned N, typename T>
| Point< N, T > & Point< N, T >::operator/= |
( |
const T & |
scale |
) |
[inline] |
template<unsigned N, typename T>
| Point< N, T > Point< N, T >::operator+ |
( |
const Vector< N-1, T > & |
rhs |
) |
const [inline] |
template<unsigned N, typename T>
| Point< N, T > Point< N, T >::operator- |
( |
const Vector< N-1, T > & |
rhs |
) |
const [inline] |
template<unsigned N, typename T>
| Vector< N-1, T > Point< N, T >::operator- |
( |
const Point< N, T > & |
rhs |
) |
const [inline] |
template<unsigned N, typename T>
| Point< N, T > Point< N, T >::operator* |
( |
const T & |
scale |
) |
const [inline] |
template<unsigned N, typename T>
| Point< N, T > Point< N, T >::operator/ |
( |
const T & |
scale |
) |
const [inline] |
template<unsigned N, typename T>
| bool Point< N, T >::isZero |
( |
|
) |
const [inline] |
- Returns:
- whether or not this Point is the origin
Definition at line 215 of file Point.inl.
template<unsigned N, typename T>
| T Point< N, T >::getDistance |
( |
const Point< N, T > & |
v |
) |
const [inline] |
- Returns:
- the magnitude of the vector connecting this point to the one passed in
Definition at line 227 of file Point.inl.
template<unsigned N, typename T>
| T Point< N, T >::getDistance2 |
( |
const Point< N, T > & |
v |
) |
const [inline] |
- Returns:
- the squared magnitude of the vector connecting this point to the one passed in
Definition at line 234 of file Point.inl.
template<unsigned N, typename T>
| T Point< N, T >::getSum |
( |
|
) |
const [inline] |
- Returns:
- the sum of the components in this Point
Definition at line 240 of file Point.inl.
template<unsigned N, typename T>
| T Point< N, T >::getAverage |
( |
|
) |
const [inline] |
- Returns:
- the average of the components in this Point
Definition at line 251 of file Point.inl.
template<unsigned N, typename T>
| void Point< N, T >::cleanup |
( |
|
) |
[inline] |
Cleans up point (0's out entries that are less than epsilon).
Definition at line 314 of file Point.inl.
Member Data Documentation
template<unsigned N = 4, typename T = real_t>
Underlying data stored as an N-length array of type T.
Definition at line 36 of file Point.h.
The documentation for this class was generated from the following files: