latest version v1.9 - last update 10 Apr 2010 |
Three dimensional point, containing the coordinates x, y and z. More...
#include <ltiPoint.h>
Public Types | |
typedef T | value_type |
typedef int | size_type |
Public Member Functions | |
tpoint3D (const T newx=0, const T newy=0, const T newz=0) | |
template<class U > | |
tpoint3D (const tpoint3D< U > &p) | |
template<class U > | |
tpoint3D< T > & | castFrom (const tpoint3D< U > &p) |
tpoint3D< T > & | set (const T tx, const T ty, const T tz) |
T | distanceTo (const tpoint3D< T > &c) const |
T | distanceSqr (const tpoint3D< T > &c) const |
T | absSqr () const |
template<class U > | |
tpoint3D< T > & | multiply (const U c) |
template<class U > | |
tpoint3D< T > & | multiply (const tpoint3D< T > &other, const U c) |
template<class U > | |
tpoint3D< T > | operator* (const U c) const |
template<class U > | |
tpoint3D< T > & | operator*= (const U c) |
tpoint3D< T > | operator* (const tpoint3D< T > &c) const |
tpoint3D< T > & | operator*= (const tpoint3D< T > &c) |
tpoint3D< T > & | emultiply (const tpoint3D< T > &a, const tpoint3D< T > &b) |
tpoint3D< T > & | emultiply (const tpoint3D< T > &c) |
template<class U > | |
tpoint3D< T > & | divide (const U c) |
template<class U > | |
tpoint3D< T > & | divide (const tpoint3D< T > &other, const U c) |
template<class U > | |
tpoint3D< T > | operator/ (const U c) const |
template<class U > | |
tpoint3D< T > & | operator/= (const U c) |
tpoint3D< T > | operator/ (const tpoint3D< T > &c) const |
tpoint3D< T > & | operator/= (const tpoint3D< T > &c) |
tpoint3D< T > & | edivide (const tpoint3D< T > &c) |
tpoint3D< T > & | edivide (const tpoint3D< T > &a, const tpoint3D< T > &b) |
tpoint3D< T > | operator% (const int c) const |
tpoint3D< T > & | add (const tpoint3D< T > &p) |
tpoint3D< T > & | add (const tpoint3D< T > &p1, const tpoint3D< T > &p2) |
tpoint3D< T > | operator+ (const tpoint3D< T > &p) const |
tpoint3D< T > & | operator+= (const tpoint3D< T > &p) |
tpoint3D< T > & | subtract (const tpoint3D< T > &p) |
tpoint3D< T > & | subtract (const tpoint3D< T > &p1, const tpoint3D< T > &p2) |
tpoint3D< T > | operator- (const tpoint3D< T > &p) const |
tpoint3D< T > | operator-= (const tpoint3D< T > &p) |
T | dot (const tpoint3D< T > &p) const |
tpoint3D< T > & | copy (const tpoint3D< T > &p) |
tpoint3D< T > & | operator= (const tpoint3D< T > &p) |
bool | operator== (const tpoint3D< T > &p) const |
bool | operator!= (const tpoint3D< T > &p) const |
bool | operator< (const tpoint3D< T > &p) const |
bool | operator> (const tpoint3D< T > &p) const |
access as vector | |
T & | operator[] (const int i) |
const T & | operator[] (const int i) const |
int | size () const |
Public Attributes | |
T | x |
T | y |
T | z |
Three dimensional point, containing the coordinates x, y and z.
The template type T will be the one used for each coordinate.
This data structure simplifies the manipulation of 3D points providing simple interfaces for adding, substracting, distance (L2), and more.
typedef int lti::tpoint3D< T >::size_type |
Return type of the size() member.
typedef T lti::tpoint3D< T >::value_type |
Used for the template-based interface for pixels as vectors.
lti::tpoint3D< T >::tpoint3D | ( | const T | newx = 0 , |
|
const T | newy = 0 , |
|||
const T | newz = 0 | |||
) | [inline, explicit] |
Default constructor.
lti::tpoint3D< T >::tpoint3D | ( | const tpoint3D< U > & | p | ) | [inline] |
Copy constructor.
T lti::tpoint3D< T >::absSqr | ( | ) | const [inline] |
Return the square of the magnitude of this point.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
Referenced by lti::tpoint3D< T >::distanceSqr(), and lti::tpoint3D< T >::distanceTo().
tpoint3D< T > & lti::tpoint3D< T >::add | ( | const tpoint3D< T > & | p1, | |
const tpoint3D< T > & | p2 | |||
) | [inline] |
Add the points p1 and p2 and leave the result in this point.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > & lti::tpoint3D< T >::add | ( | const tpoint3D< T > & | p | ) | [inline] |
Add the content of this point with the other point p and leave the result in this point.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
Referenced by lti::tpoint3D< T >::operator+=().
tpoint3D<T>& lti::tpoint3D< T >::castFrom | ( | const tpoint3D< U > & | p | ) | [inline] |
Copy constructor.
tpoint3D< T > & lti::tpoint3D< T >::copy | ( | const tpoint3D< T > & | p | ) | [inline] |
Copy operator.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
Referenced by lti::tpoint3D< int >::operator=(), and lti::draw3D< T >::parameters::setCamera().
T lti::tpoint3D< T >::distanceSqr | ( | const tpoint3D< T > & | c | ) | const [inline] |
Calculate square of distance to the point c.
This method is faster than distanceTo (because it does not calculate the root of a*a + b*b).
References lti::tpoint3D< T >::absSqr().
Referenced by lti::distanceSqr().
T lti::tpoint3D< T >::distanceTo | ( | const tpoint3D< T > & | c | ) | const [inline] |
Calculate distance to the point c.
References lti::tpoint3D< T >::absSqr(), and lti::sqrt().
tpoint3D<T>& lti::tpoint3D< T >::divide | ( | const tpoint3D< T > & | other, | |
const U | c | |||
) | [inline] |
Divide each component of tpoint3D<T> with a given factor.
Divide each component of tpoint3D<T> with a given factor.
T lti::tpoint3D< T >::dot | ( | const tpoint3D< T > & | p | ) | const [inline] |
Dot product with another point.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > & lti::tpoint3D< T >::edivide | ( | const tpoint3D< T > & | a, | |
const tpoint3D< T > & | b | |||
) | [inline] |
Elementwise division of each component of the points.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > & lti::tpoint3D< T >::edivide | ( | const tpoint3D< T > & | c | ) | [inline] |
Elementwise division of each component of the points.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > & lti::tpoint3D< T >::emultiply | ( | const tpoint3D< T > & | c | ) | [inline] |
Multiplies elementwise the components of this and the point c, and leave the result here.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > & lti::tpoint3D< T >::emultiply | ( | const tpoint3D< T > & | a, | |
const tpoint3D< T > & | b | |||
) | [inline] |
Multiplies elementwise the components of a and b and leave the result here.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D<T>& lti::tpoint3D< T >::multiply | ( | const tpoint3D< T > & | other, | |
const U | c | |||
) | [inline] |
Multiply tpoint3D<T> with a given factor.
tpoint3D<T>& lti::tpoint3D< T >::multiply | ( | const U | c | ) | [inline] |
Multiply tpoint3D<T> with a given factor.
bool lti::tpoint3D< T >::operator!= | ( | const tpoint3D< T > & | p | ) | const [inline] |
Operator !=.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > lti::tpoint3D< T >::operator% | ( | const int | c | ) | const [inline] |
Modulo c of the integer part of each component of the point3D.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > lti::tpoint3D< T >::operator* | ( | const tpoint3D< T > & | c | ) | const [inline] |
Multiply element-wise tpoint3D<T> with another point.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D<T> lti::tpoint3D< T >::operator* | ( | const U | c | ) | const [inline] |
Multiply tpoint3D<T> with a given factor.
tpoint3D< T > & lti::tpoint3D< T >::operator*= | ( | const tpoint3D< T > & | c | ) | [inline] |
Multiply element-wise tpoint3D<T> with another point c.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D<T>& lti::tpoint3D< T >::operator*= | ( | const U | c | ) | [inline] |
Multiply tpoint3D<T> with a given factor.
tpoint3D< T > lti::tpoint3D< T >::operator+ | ( | const tpoint3D< T > & | p | ) | const [inline] |
Operator +.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > & lti::tpoint3D< T >::operator+= | ( | const tpoint3D< T > & | p | ) | [inline] |
Operator +.
References lti::tpoint3D< T >::add().
tpoint3D< T > lti::tpoint3D< T >::operator- | ( | const tpoint3D< T > & | p | ) | const [inline] |
Operator -.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > lti::tpoint3D< T >::operator-= | ( | const tpoint3D< T > & | p | ) | [inline] |
Operator -.
References lti::tpoint3D< T >::subtract().
tpoint3D< T > lti::tpoint3D< T >::operator/ | ( | const tpoint3D< T > & | c | ) | const [inline] |
Elementwise division of each component of the points.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D<T> lti::tpoint3D< T >::operator/ | ( | const U | c | ) | const [inline] |
Divide each component of tpoint3D<T> with a given factor.
tpoint3D< T > & lti::tpoint3D< T >::operator/= | ( | const tpoint3D< T > & | c | ) | [inline] |
Element-wise division.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D<T>& lti::tpoint3D< T >::operator/= | ( | const U | c | ) | [inline] |
Divide each component of tpoint3D<T> with a given factor.
bool lti::tpoint3D< T >::operator< | ( | const tpoint3D< T > & | p | ) | const [inline] |
Operator<.
A point3D is smaller than another one if its z component is smaller, or if both z components are equal, if its y component is smaller, of if both y are equal, if its x component is smaller
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D<T>& lti::tpoint3D< T >::operator= | ( | const tpoint3D< T > & | p | ) | [inline] |
Operator =.
bool lti::tpoint3D< T >::operator== | ( | const tpoint3D< T > & | p | ) | const [inline] |
Operator ==.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
bool lti::tpoint3D< T >::operator> | ( | const tpoint3D< T > & | p | ) | const [inline] |
Operator>.
A point3D is smaller than another one if its z component is smaller, or if both z components are equal, if its y component is smaller, of if both y are equal, if its x component is smaller
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
const T& lti::tpoint3D< T >::operator[] | ( | const int | i | ) | const [inline] |
T& lti::tpoint3D< T >::operator[] | ( | const int | i | ) | [inline] |
tpoint3D<T>& lti::tpoint3D< T >::set | ( | const T | tx, | |
const T | ty, | |||
const T | tz | |||
) | [inline] |
Set the coordinate values and return a reference to this point.
int lti::tpoint3D< T >::size | ( | ) | const [inline] |
Used to simulate the vector size.
tpoint3D< T > & lti::tpoint3D< T >::subtract | ( | const tpoint3D< T > & | p1, | |
const tpoint3D< T > & | p2 | |||
) | [inline] |
Subtract.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
tpoint3D< T > & lti::tpoint3D< T >::subtract | ( | const tpoint3D< T > & | p | ) | [inline] |
Subtract.
References lti::tpoint3D< T >::x, lti::tpoint3D< T >::y, and lti::tpoint3D< T >::z.
Referenced by lti::draw3D< T >::triangle::getNormal(), and lti::tpoint3D< T >::operator-=().
T lti::tpoint3D< T >::x |
Coordinate x.
Referenced by lti::tpoint3D< T >::absSqr(), lti::tpoint3D< T >::add(), lti::tpoint3D< int >::castFrom(), lti::hPoint3D< T >::castFrom(), lti::hPoint3D< T >::castTo(), lti::cityBlockDistance(), lti::tpoint3D< T >::copy(), lti::hPoint3D< T >::copy(), lti::tpoint3D< int >::divide(), lti::tpoint3D< T >::dot(), lti::tpoint3D< T >::edivide(), lti::tpoint3D< T >::emultiply(), lti::draw3D< T >::triangle::getNormal(), lti::tbox< T, S >::isInside(), lti::tpoint3D< int >::multiply(), lti::tpoint3D< T >::operator!=(), lti::tpoint3D< T >::operator%(), lti::tpoint3D< T >::operator*(), lti::tpoint3D< int >::operator*(), lti::draw3D< T >::hmatrix::operator*(), lti::tpoint3D< T >::operator*=(), lti::tpoint3D< int >::operator*=(), lti::tpoint3D< T >::operator+(), lti::tpoint3D< T >::operator-(), lti::tpoint3D< T >::operator/(), lti::tpoint3D< int >::operator/(), lti::tpoint3D< T >::operator/=(), lti::tpoint3D< int >::operator/=(), lti::tpoint3D< T >::operator<(), lti::tpoint3D< T >::operator==(), lti::tpoint3D< T >::operator>(), lti::tpoint3D< int >::operator[](), lti::read(), lti::tbox< T, S >::resize(), lti::geometricTransform::rotate(), lti::tpoint3D< int >::set(), lti::draw3D< T >::parameters::setCamera(), lti::tbox< T, S >::setCenter(), lti::tpoint3D< T >::subtract(), lti::draw3D< T >::triangle::visible(), and lti::write().
T lti::tpoint3D< T >::y |
Coordinate y;.
Referenced by lti::tpoint3D< T >::absSqr(), lti::tpoint3D< T >::add(), lti::tpoint3D< int >::castFrom(), lti::hPoint3D< T >::castFrom(), lti::hPoint3D< T >::castTo(), lti::cityBlockDistance(), lti::tpoint3D< T >::copy(), lti::hPoint3D< T >::copy(), lti::tpoint3D< int >::divide(), lti::tpoint3D< T >::dot(), lti::tpoint3D< T >::edivide(), lti::tpoint3D< T >::emultiply(), lti::draw3D< T >::triangle::getNormal(), lti::tbox< T, S >::isInside(), lti::tpoint3D< int >::multiply(), lti::tpoint3D< T >::operator!=(), lti::tpoint3D< T >::operator%(), lti::tpoint3D< T >::operator*(), lti::tpoint3D< int >::operator*(), lti::draw3D< T >::hmatrix::operator*(), lti::tpoint3D< T >::operator*=(), lti::tpoint3D< int >::operator*=(), lti::tpoint3D< T >::operator+(), lti::tpoint3D< T >::operator-(), lti::tpoint3D< T >::operator/(), lti::tpoint3D< int >::operator/(), lti::tpoint3D< T >::operator/=(), lti::tpoint3D< int >::operator/=(), lti::tpoint3D< T >::operator<(), lti::tpoint3D< T >::operator==(), lti::tpoint3D< T >::operator>(), lti::tpoint3D< int >::operator[](), lti::read(), lti::tbox< T, S >::resize(), lti::geometricTransform::rotate(), lti::tpoint3D< int >::set(), lti::draw3D< T >::parameters::setCamera(), lti::tbox< T, S >::setCenter(), lti::tpoint3D< T >::subtract(), lti::draw3D< T >::triangle::visible(), and lti::write().
T lti::tpoint3D< T >::z |
Coordinate z;.
Referenced by lti::tpoint3D< T >::absSqr(), lti::tpoint3D< T >::add(), lti::tpoint3D< int >::castFrom(), lti::hPoint3D< T >::castFrom(), lti::hPoint3D< T >::castTo(), lti::cityBlockDistance(), lti::tpoint3D< T >::copy(), lti::hPoint3D< T >::copy(), lti::tpoint3D< int >::divide(), lti::tpoint3D< T >::dot(), lti::tpoint3D< T >::edivide(), lti::tpoint3D< T >::emultiply(), lti::draw3D< T >::triangle::getNormal(), lti::tbox< T, S >::isInside(), lti::tpoint3D< int >::multiply(), lti::tpoint3D< T >::operator!=(), lti::tpoint3D< T >::operator%(), lti::tpoint3D< T >::operator*(), lti::tpoint3D< int >::operator*(), lti::draw3D< T >::hmatrix::operator*(), lti::tpoint3D< T >::operator*=(), lti::tpoint3D< int >::operator*=(), lti::tpoint3D< T >::operator+(), lti::tpoint3D< T >::operator-(), lti::tpoint3D< T >::operator/(), lti::tpoint3D< int >::operator/(), lti::tpoint3D< T >::operator/=(), lti::tpoint3D< int >::operator/=(), lti::tpoint3D< T >::operator<(), lti::tpoint3D< T >::operator==(), lti::tpoint3D< T >::operator>(), lti::tpoint3D< int >::operator[](), lti::read(), lti::tbox< T, S >::resize(), lti::geometricTransform::rotate(), lti::tpoint3D< int >::set(), lti::draw3D< T >::parameters::setCamera(), lti::tbox< T, S >::setCenter(), lti::tpoint3D< T >::subtract(), lti::draw3D< T >::triangle::visible(), and lti::write().