latest version v1.9 - last update 10 Apr 2010 |
Homogeneous point in three dimensions. More...
#include <ltiHTypes.h>
Public Member Functions | |
hPoint3D (const T newx=0, const T newy=0, const T newz=0, const T newh=T(1)) | |
hPoint3D (const hPoint3D< T > &p) | |
hPoint3D (const hPoint2D< T > &p) | |
hPoint3D (const tpoint< T > &p) | |
hPoint3D (const tpoint3D< T > &p) | |
template<class U > | |
hPoint3D< T > & | castFrom (const hPoint3D< U > &p) |
template<class U > | |
hPoint3D< T > & | castFrom (const tpoint3D< U > &p) |
tpoint3D< T > & | castTo (tpoint3D< T > &p) const |
hPoint2D< T > & | project (hPoint2D< T > &p) const |
tpoint< T > & | project (tpoint< T > &p) const |
hPoint3D< T > & | multiply (const T c) |
hPoint3D< T > | operator* (const T c) const |
hPoint3D< T > | operator* (const hPoint3D< T > &c) const |
hPoint3D< T > & | operator*= (const hPoint3D< T > &c) |
hPoint3D< T > & | divide (const T c) |
hPoint3D< T > | operator/ (const T c) const |
hPoint3D< T > | operator/ (const hPoint3D< T > &c) const |
hPoint3D< T > & | operator/= (const hPoint3D< T > &c) |
hPoint3D< T > & | add (const hPoint3D< T > &p) |
hPoint3D< T > | operator+ (const hPoint3D< T > &p) const |
hPoint3D< T > & | operator+= (const hPoint3D< T > &p) |
hPoint3D< T > & | subtract (const hPoint3D< T > &p) |
hPoint3D< T > | operator- (const hPoint3D< T > &p) const |
hPoint3D< T > & | operator-= (const hPoint3D< T > &p) |
T | dot (const hPoint3D< T > &p) const |
T | dot (const vector< T > &p) const |
hPoint3D< T > & | copy (const hPoint3D< T > &p) |
hPoint3D< T > & | copy (const hPoint2D< T > &p) |
hPoint3D< T > & | operator= (const hPoint3D< T > &p) |
hPoint3D< T > & | copy (const tpoint3D< T > &p) |
hPoint3D< T > & | copy (const tpoint< T > &p) |
hPoint3D< T > & | operator= (const tpoint3D< T > &p) |
bool | operator== (const hPoint3D< T > &p) const |
bool | operator!= (const hPoint3D< T > &p) const |
hPoint3D< T > & | normalize () |
hPoint3D< T > & | normalize (const hPoint3D< T > &p) |
T & | operator[] (const int &i) |
const T & | operator[] (const int &i) const |
T | absSqr () const |
Public Attributes | |
T & | x |
T & | y |
T & | z |
T & | h |
Static Public Attributes | |
static const int | totalDimensionality = 4 |
Protected Attributes | |
T | data [4] |
Homogeneous point in three dimensions.
Note that an homogeneous three-dimensional point has four elements: x,y,z and h. All arithmetical operations will be calculated for the corresponding non-homogeneous 3D point, and then homogenized. For example the addition of two hPoints3D will be:
lti::hPoint3D< T >::hPoint3D | ( | const T | newx = 0 , |
|
const T | newy = 0 , |
|||
const T | newz = 0 , |
|||
const T | newh = T(1) | |||
) | [inline, explicit] |
default constructor
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
lti::hPoint3D< T >::hPoint3D | ( | const hPoint3D< T > & | p | ) | [inline] |
copy constructor
References lti::hPoint3D< T >::copy().
lti::hPoint3D< T >::hPoint3D | ( | const hPoint2D< T > & | p | ) | [inline] |
copy constructor
References lti::hPoint3D< T >::copy().
lti::hPoint3D< T >::hPoint3D | ( | const tpoint< T > & | p | ) | [inline] |
copy constructor
References lti::hPoint3D< T >::copy().
lti::hPoint3D< T >::hPoint3D | ( | const tpoint3D< T > & | p | ) | [inline] |
copy constructor
References lti::hPoint3D< T >::copy().
T lti::hPoint3D< T >::absSqr | ( | ) | const [inline] |
return the square of the magnitud of this point (after its normalization)
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::add | ( | const hPoint3D< T > & | p | ) | [inline] |
add
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
Referenced by lti::hPoint3D< T >::operator+=().
hPoint3D<T>& lti::hPoint3D< T >::castFrom | ( | const tpoint3D< U > & | p | ) | [inline] |
copy constructor
References lti::hPoint3D< T >::h, lti::tpoint3D< T >::x, lti::hPoint3D< T >::x, lti::tpoint3D< T >::y, lti::hPoint3D< T >::y, lti::tpoint3D< T >::z, and lti::hPoint3D< T >::z.
hPoint3D<T>& lti::hPoint3D< T >::castFrom | ( | const hPoint3D< U > & | p | ) | [inline] |
copy constructor
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
tpoint3D<T>& lti::hPoint3D< T >::castTo | ( | tpoint3D< T > & | p | ) | const [inline] |
copy this point normalized into the given tpoint and return a reference to it
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::tpoint3D< T >::x, lti::hPoint3D< T >::y, lti::tpoint3D< T >::y, lti::hPoint3D< T >::z, and lti::tpoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::copy | ( | const tpoint< T > & | p | ) | [inline] |
copy operator (assume z=0)
References lti::hPoint3D< T >::h, lti::tpoint< T >::x, lti::hPoint3D< T >::x, lti::tpoint< T >::y, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::copy | ( | const tpoint3D< T > & | p | ) | [inline] |
copy operator
References lti::hPoint3D< T >::h, lti::tpoint3D< T >::x, lti::hPoint3D< T >::x, lti::tpoint3D< T >::y, lti::hPoint3D< T >::y, lti::tpoint3D< T >::z, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::copy | ( | const hPoint2D< T > & | p | ) | [inline] |
copy operator (assume z=0)
References lti::hPoint2D< T >::h, lti::hPoint3D< T >::h, lti::hPoint2D< T >::x, lti::hPoint3D< T >::x, lti::hPoint2D< T >::y, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::copy | ( | const hPoint3D< T > & | p | ) | [inline] |
copy operator
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
Referenced by lti::hPoint3D< T >::hPoint3D(), and lti::hPoint3D< T >::operator=().
hPoint3D< T > & lti::hPoint3D< T >::divide | ( | const T | c | ) | [inline] |
divide each component of hPoint3D<T> (x,y only) with a given factor
References lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
T lti::hPoint3D< T >::dot | ( | const vector< T > & | p | ) | const [inline] |
Dot product with a 4D vector.
Typically, this would be a transformation vector (e.g. a row of an hMatrix) which projects the point onto an axis. The result is a normal dot product, i.e. x*p.at(0)+...+h*p.at(3).
Please note that this result differs considerably from the dot product with another hPoint, as the latter case normalizes the x, y and z components by the h one, and then makes a dot product of only the x, y and z normalized components, while the former one assumes the hPoint and the vector as 4D points and makes their product.
p | four dimensional vector |
References lti::genericVector< T >::at(), lti::hPoint3D< T >::h, lti::genericVector< T >::size(), lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
T lti::hPoint3D< T >::dot | ( | const hPoint3D< T > & | p | ) | const [inline] |
Dot product with another point.
This consider the normalized x, y and z components only! i.e. the result will be (x*p.x + y*p.y + z*p.z)/(h*p.h)
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::multiply | ( | const T | c | ) | [inline] |
multiply hPoint3D<T> with a given factor This will affect the (x,y) values! (multiplying h would had no effect!)
References lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::normalize | ( | const hPoint3D< T > & | p | ) | [inline] |
normalize this point.
This makes the h component 1
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::normalize | ( | ) | [inline] |
normalize this point.
This makes the h component 1
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
bool lti::hPoint3D< T >::operator!= | ( | const hPoint3D< T > & | p | ) | const [inline] |
operator !=
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > lti::hPoint3D< T >::operator* | ( | const hPoint3D< T > & | c | ) | const [inline] |
this product multiplies elementwise the components of this and the point c.
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > lti::hPoint3D< T >::operator* | ( | const T | c | ) | const [inline] |
multiply hPoint3D<T> with a given factor This will affect the (x,y) values! (multiplying h would had no effect!)
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::operator*= | ( | const hPoint3D< T > & | c | ) | [inline] |
this product multiplies elementwise the components of this and the point c
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > lti::hPoint3D< T >::operator+ | ( | const hPoint3D< T > & | p | ) | const [inline] |
operator +
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::operator+= | ( | const hPoint3D< T > & | p | ) | [inline] |
operator +=
References lti::hPoint3D< T >::add().
hPoint3D< T > lti::hPoint3D< T >::operator- | ( | const hPoint3D< T > & | p | ) | const [inline] |
operator -
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::operator-= | ( | const hPoint3D< T > & | p | ) | [inline] |
operator -=
References lti::hPoint3D< T >::subtract().
hPoint3D< T > lti::hPoint3D< T >::operator/ | ( | const hPoint3D< T > & | c | ) | const [inline] |
elementwise division of each component of the points
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > lti::hPoint3D< T >::operator/ | ( | const T | c | ) | const [inline] |
divide each component of hPoint3D<T> with a given factor
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D< T > & lti::hPoint3D< T >::operator/= | ( | const hPoint3D< T > & | c | ) | [inline] |
elementwise division of each component of the points
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
hPoint3D<T>& lti::hPoint3D< T >::operator= | ( | const tpoint3D< T > & | p | ) | [inline] |
operator =
References lti::hPoint3D< T >::copy().
hPoint3D<T>& lti::hPoint3D< T >::operator= | ( | const hPoint3D< T > & | p | ) | [inline] |
operator =
References lti::hPoint3D< T >::copy().
bool lti::hPoint3D< T >::operator== | ( | const hPoint3D< T > & | p | ) | const [inline] |
operator == This compares the normalized x and y coordinates, i.e.
x*p.h == p.x*h and the same thing for y
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
const T & lti::hPoint3D< T >::operator[] | ( | const int & | i | ) | const [inline] |
operator to access the point as a vector.
The position x corresponds to the element 0. The position y corresponds to the element 1. The position z corresponds to the element 2. The position h corresponds to the element 3.
References lti::hPoint3D< T >::data, and lti::hPoint3D< T >::totalDimensionality.
T & lti::hPoint3D< T >::operator[] | ( | const int & | i | ) | [inline] |
operator to access the point as a vector.
The position x corresponds to the element 0. The position y corresponds to the element 1. The position z corresponds to the element 2. The position h corresponds to the element 3.
References lti::hPoint3D< T >::data, and lti::hPoint3D< T >::totalDimensionality.
tpoint<T>& lti::hPoint3D< T >::project | ( | tpoint< T > & | p | ) | const [inline] |
copy this point normalized into the given tpoint and return a reference to it.
The z coordinate will be ignored (this corresponds to an orthogonal projection of the point in the x-y plane
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::tpoint< T >::x, lti::hPoint3D< T >::y, and lti::tpoint< T >::y.
hPoint2D<T>& lti::hPoint3D< T >::project | ( | hPoint2D< T > & | p | ) | const [inline] |
copy this point into the given hPoint2D and return a reference to it.
The z coordinate will be ignored (this corresponds to an orthogonal projection of the point in the x-y plane
References lti::hPoint3D< T >::h, lti::hPoint2D< T >::h, lti::hPoint3D< T >::x, lti::hPoint2D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint2D< T >::y.
hPoint3D< T > & lti::hPoint3D< T >::subtract | ( | const hPoint3D< T > & | p | ) | [inline] |
subtract
References lti::hPoint3D< T >::h, lti::hPoint3D< T >::x, lti::hPoint3D< T >::y, and lti::hPoint3D< T >::z.
Referenced by lti::hPoint3D< T >::operator-=().
T lti::hPoint3D< T >::data[4] [protected] |
the content of the point
Referenced by lti::hPoint3D< T >::operator[]().
T& lti::hPoint3D< T >::h |
component h
Referenced by lti::hPoint3D< T >::absSqr(), lti::hPoint3D< T >::add(), lti::hPoint3D< T >::castFrom(), lti::hPoint3D< T >::castTo(), lti::hPoint3D< T >::copy(), lti::hPoint3D< T >::dot(), lti::hPoint3D< T >::hPoint3D(), lti::hPoint3D< T >::normalize(), lti::hPoint3D< T >::operator!=(), lti::hPoint3D< T >::operator*(), lti::hPoint3D< T >::operator*=(), lti::hPoint3D< T >::operator+(), lti::hPoint3D< T >::operator-(), lti::hPoint3D< T >::operator/(), lti::hPoint3D< T >::operator/=(), lti::hPoint3D< T >::operator==(), lti::hPoint3D< T >::project(), lti::read(), lti::scene3D< rgbPixel >::set3D(), lti::draw3D< rgbPixel >::set3D(), lti::hPoint3D< T >::subtract(), and lti::write().
const int lti::hPoint3D< T >::totalDimensionality = 4 [inline, static] |
This constant value indicates the dimensionality of this point as vector: i.e.
this will contain the value 4
Referenced by lti::hPoint3D< T >::operator[]().
T& lti::hPoint3D< T >::x |
coordinate x
Referenced by lti::hPoint3D< T >::absSqr(), lti::hPoint3D< T >::add(), lti::hPoint3D< T >::castFrom(), lti::hPoint3D< T >::castTo(), lti::hPoint3D< T >::copy(), lti::hPoint3D< T >::divide(), lti::hPoint3D< T >::dot(), lti::hPoint3D< T >::hPoint3D(), lti::hPoint3D< T >::multiply(), lti::hPoint3D< T >::normalize(), lti::hPoint3D< T >::operator!=(), lti::hPoint3D< T >::operator*(), lti::hPoint3D< T >::operator*=(), lti::hPoint3D< T >::operator+(), lti::hPoint3D< T >::operator-(), lti::hPoint3D< T >::operator/(), lti::hPoint3D< T >::operator/=(), lti::hPoint3D< T >::operator==(), lti::hPoint3D< T >::project(), lti::read(), lti::scene3D< rgbPixel >::set3D(), lti::draw3D< rgbPixel >::set3D(), lti::hPoint3D< T >::subtract(), and lti::write().
T& lti::hPoint3D< T >::y |
coordinate y;
Referenced by lti::hPoint3D< T >::absSqr(), lti::hPoint3D< T >::add(), lti::hPoint3D< T >::castFrom(), lti::hPoint3D< T >::castTo(), lti::hPoint3D< T >::copy(), lti::hPoint3D< T >::divide(), lti::hPoint3D< T >::dot(), lti::hPoint3D< T >::hPoint3D(), lti::hPoint3D< T >::multiply(), lti::hPoint3D< T >::normalize(), lti::hPoint3D< T >::operator!=(), lti::hPoint3D< T >::operator*(), lti::hPoint3D< T >::operator*=(), lti::hPoint3D< T >::operator+(), lti::hPoint3D< T >::operator-(), lti::hPoint3D< T >::operator/(), lti::hPoint3D< T >::operator/=(), lti::hPoint3D< T >::operator==(), lti::hPoint3D< T >::project(), lti::read(), lti::scene3D< rgbPixel >::set3D(), lti::draw3D< rgbPixel >::set3D(), lti::hPoint3D< T >::subtract(), and lti::write().
T& lti::hPoint3D< T >::z |
coordinate z;
Referenced by lti::hPoint3D< T >::absSqr(), lti::hPoint3D< T >::add(), lti::hPoint3D< T >::castFrom(), lti::hPoint3D< T >::castTo(), lti::hPoint3D< T >::copy(), lti::hPoint3D< T >::divide(), lti::hPoint3D< T >::dot(), lti::hPoint3D< T >::hPoint3D(), lti::hPoint3D< T >::multiply(), lti::hPoint3D< T >::normalize(), lti::hPoint3D< T >::operator!=(), lti::hPoint3D< T >::operator*(), lti::hPoint3D< T >::operator*=(), lti::hPoint3D< T >::operator+(), lti::hPoint3D< T >::operator-(), lti::hPoint3D< T >::operator/(), lti::hPoint3D< T >::operator/=(), lti::hPoint3D< T >::operator==(), lti::read(), lti::scene3D< rgbPixel >::set3D(), lti::draw3D< rgbPixel >::set3D(), lti::hPoint3D< T >::subtract(), and lti::write().