last update 20 Sep 2009 |
#include <cvrPoint3D.h>
Public Types | |
typedef T | value_type |
typedef int | size_type |
Public Member Functions | |
point3D (const T newx=T(), const T newy=T(), const T newz=T()) | |
template<typename U > | |
point3D (const point3D< U > &p) | |
template<typename U > | |
point3D< T > & | castFrom (const point3D< U > &p) |
point3D< T > & | set (const T tx, const T ty, const T tz) |
void | get (T &tx, T &ty, T &tz) const |
T | distanceSqr (const point3D< T > &c) const |
T | absSqr () const |
T | dot (const point3D< T > &p) const |
point3D< T > & | cross (const point3D< T > &c) |
point3D< T > & | cross (const point3D< T > &a, const point3D< T > &b) |
template<typename U > | |
point3D< T > & | multiply (const U c) |
template<typename U > | |
point3D< T > | operator* (const U c) const |
template<typename U > | |
point3D< T > & | multiply (const point3D< T > &other, const U c) |
template<typename U > | |
point3D< T > & | operator*= (const U c) |
point3D< T > | operator* (const point3D< T > &c) const |
point3D< T > & | operator*= (const point3D< T > &c) |
point3D< T > & | emultiply (const point3D< T > &c) |
point3D< T > & | emultiply (const point3D< T > &a, const point3D< T > &b) |
template<typename U > | |
point3D< T > & | divide (const U c) |
template<typename U > | |
point3D< T > & | divide (const point3D< T > &other, const U c) |
template<typename U > | |
point3D< T > | operator/ (const U c) const |
template<typename U > | |
point3D< T > & | operator/= (const U c) |
point3D< T > | operator/ (const point3D< T > &c) const |
point3D< T > & | operator/= (const point3D< T > &c) |
point3D< T > & | edivide (const point3D< T > &c) |
point3D< T > & | edivide (const point3D< T > &a, const point3D< T > &b) |
point3D< T > | operator% (const int c) const |
point3D< T > & | add (const point3D< T > &p) |
point3D< T > & | add (const point3D< T > &a, const point3D< T > &b) |
point3D< T > | operator+ (const point3D< T > &p) const |
point3D< T > & | operator+= (const point3D< T > &p) |
point3D< T > & | subtract (const point3D< T > &p) |
point3D< T > & | subtract (const point3D< T > &a, const point3D< T > &b) |
point3D< T > | operator- (const point3D< T > &p) const |
point3D< T > & | operator-= (const point3D< T > &p) |
point3D< T > & | copy (const point3D< T > &p) |
point3D< T > & | operator= (const point3D< T > &p) |
bool | operator== (const point3D< T > &p) const |
bool | operator!= (const point3D< T > &p) const |
bool | operator< (const point3D< T > &p) const |
bool | operator> (const point3D< T > &p) const |
Access as vector | |
T & | operator[] (const int i) |
const T & | operator[] (const int i) const |
size_type | size () const |
The template type T will be the one used for each coordinate. For example point3D<float> uses float for x, y, and z.
This data structure simplifies the manipulation of 3D points providing simple interfaces for adding, substracting, distance (L2), and more.
There are some alias to shorten the notation: -ipoint3D is equivalent to point3D<int> -fpoint3D is equivalent to point3D<sreal> -dpoint3D is equivalent to point3D<dreal>
typedef int cvr::point3D< T >::size_type |
Return type of the size() member.
typedef T cvr::point3D< T >::value_type |
Used for the template-based interface for pixels as vectors.
cvr::point3D< T >::point3D | ( | const T | newx = T() , |
|
const T | newy = T() , |
|||
const T | newz = T() | |||
) | [explicit] |
Default constructor.
cvr::point3D< T >::point3D | ( | const point3D< U > & | p | ) | [inline] |
Copy constructor.
T cvr::point3D< T >::absSqr | ( | ) | const [inline] |
Return the square of the magnitude of the point3D.
point3D<T>& cvr::point3D< T >::add | ( | const point3D< T > & | a, | |
const point3D< T > & | b | |||
) | [inline] |
point3D<T>& cvr::point3D< T >::add | ( | const point3D< T > & | p | ) | [inline] |
point3D<T>& cvr::point3D< T >::castFrom | ( | const point3D< U > & | p | ) | [inline] |
Casts all elements of p
to T and sets these values in this point.
point3D<T>& cvr::point3D< T >::copy | ( | const point3D< T > & | p | ) | [inline] |
Copy operator.
point3D<T>& cvr::point3D< T >::cross | ( | const point3D< T > & | a, | |
const point3D< T > & | b | |||
) | [inline] |
Cross product between the given two point3D.
point3D<T>& cvr::point3D< T >::cross | ( | const point3D< T > & | c | ) | [inline] |
Cross product with another point3D.
T cvr::point3D< T >::distanceSqr | ( | const point3D< T > & | c | ) | const [inline] |
Calculate square of distance to the point3D c.
This method is faster than distanceTo (because it does not compute the square root).
Referenced by cvr::euclideanDistance(), and cvr::euclideanDistanceSqr().
point3D<T>& cvr::point3D< T >::divide | ( | const point3D< T > & | other, | |
const U | c | |||
) | [inline] |
Divide each component of other other point3D<T> with a given factor.
point3D<T>& cvr::point3D< T >::divide | ( | const U | c | ) | [inline] |
Divide each component of point3D<T> with a given factor.
T cvr::point3D< T >::dot | ( | const point3D< T > & | p | ) | const [inline] |
point3D<T>& cvr::point3D< T >::edivide | ( | const point3D< T > & | a, | |
const point3D< T > & | b | |||
) | [inline] |
Elementwise division of each component of the point3Ds.
point3D<T>& cvr::point3D< T >::edivide | ( | const point3D< T > & | c | ) | [inline] |
Elementwise division of each component of the point3Ds.
point3D<T>& cvr::point3D< T >::emultiply | ( | const point3D< T > & | a, | |
const point3D< T > & | b | |||
) | [inline] |
point3D<T>& cvr::point3D< T >::emultiply | ( | const point3D< T > & | c | ) | [inline] |
void cvr::point3D< T >::get | ( | T & | tx, | |
T & | ty, | |||
T & | tz | |||
) | const [inline] |
Get the coordinate values.
point3D<T>& cvr::point3D< T >::multiply | ( | const point3D< T > & | other, | |
const U | c | |||
) | [inline] |
Multiply the other point3D point3D<T> with a given factor.
point3D<T>& cvr::point3D< T >::multiply | ( | const U | c | ) | [inline] |
Multiply point3D<T> with a given factor.
bool cvr::point3D< T >::operator!= | ( | const point3D< T > & | p | ) | const [inline] |
Operator !=.
point3D<T> cvr::point3D< T >::operator% | ( | const int | c | ) | const [inline] |
Modulo c of the integer part of each component of the point3D.
point3D<T> cvr::point3D< T >::operator* | ( | const point3D< T > & | c | ) | const [inline] |
point3D<T> cvr::point3D< T >::operator* | ( | const U | c | ) | const [inline] |
Multiply point3D<T> with a given factor.
point3D<T>& cvr::point3D< T >::operator*= | ( | const point3D< T > & | c | ) | [inline] |
point3D<T>& cvr::point3D< T >::operator*= | ( | const U | c | ) | [inline] |
Multiply point3D<T> with a given factor.
point3D<T> cvr::point3D< T >::operator+ | ( | const point3D< T > & | p | ) | const [inline] |
point3D<T>& cvr::point3D< T >::operator+= | ( | const point3D< T > & | p | ) | [inline] |
Operator += is an alias for add().
point3D<T> cvr::point3D< T >::operator- | ( | const point3D< T > & | p | ) | const [inline] |
Operator -.
point3D<T>& cvr::point3D< T >::operator-= | ( | const point3D< T > & | p | ) | [inline] |
Operator -=.
point3D<T> cvr::point3D< T >::operator/ | ( | const point3D< T > & | c | ) | const [inline] |
Elementwise division of each component of the point3Ds.
point3D<T> cvr::point3D< T >::operator/ | ( | const U | c | ) | const [inline] |
Divide each component of point3D<T> by a given factor.
point3D<T>& cvr::point3D< T >::operator/= | ( | const point3D< T > & | c | ) | [inline] |
Elementwise division of each component of the point3Ds.
point3D<T>& cvr::point3D< T >::operator/= | ( | const U | c | ) | [inline] |
Divide each component of point3D<T> by a given factor.
bool cvr::point3D< T >::operator< | ( | const point3D< T > & | p | ) | const [inline] |
point3D<T>& cvr::point3D< T >::operator= | ( | const point3D< T > & | p | ) | [inline] |
Operator =.
bool cvr::point3D< T >::operator== | ( | const point3D< T > & | p | ) | const [inline] |
Operator ==.
bool cvr::point3D< T >::operator> | ( | const point3D< T > & | p | ) | const [inline] |
const T& cvr::point3D< T >::operator[] | ( | const int | i | ) | const [inline] |
T& cvr::point3D< T >::operator[] | ( | const int | i | ) | [inline] |
point3D<T>& cvr::point3D< T >::set | ( | const T | tx, | |
const T | ty, | |||
const T | tz | |||
) | [inline] |
Set the coordinate values and return a reference to this point3D.
size_type cvr::point3D< T >::size | ( | ) | const [inline] |
Used to simulate the vector size.
point3D<T>& cvr::point3D< T >::subtract | ( | const point3D< T > & | a, | |
const point3D< T > & | b | |||
) | [inline] |
point3D<T>& cvr::point3D< T >::subtract | ( | const point3D< T > & | p | ) | [inline] |
Subtract.
value_type cvr::point3D< T >::data[3] |
Array that shares the same memory with x and y.
value_type cvr::point3D< T >::x |
Coordinate x.
value_type cvr::point3D< T >::y |
Coordinate y;.
value_type cvr::point3D< T >::z |
Coordinate z;.