LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::tpoint3D< T > Class Template Reference
[Geometry Data Structures]

Three dimensional point, containing the coordinates x, y and z. More...

#include <ltiPoint.h>

Inheritance diagram for lti::tpoint3D< T >:
Inheritance graph
[legend]

List of all members.

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)
distanceTo (const tpoint3D< T > &c) const
distanceSqr (const tpoint3D< T > &c) const
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)
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

x
y
z

Detailed Description

template<class T>
class lti::tpoint3D< T >

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.


Member Typedef Documentation

template<class T>
typedef int lti::tpoint3D< T >::size_type

Return type of the size() member.

template<class T>
typedef T lti::tpoint3D< T >::value_type

Used for the template-based interface for pixels as vectors.


Constructor & Destructor Documentation

template<class T>
lti::tpoint3D< T >::tpoint3D ( const T  newx = 0,
const T  newy = 0,
const T  newz = 0 
) [inline, explicit]

Default constructor.

template<class T>
template<class U >
lti::tpoint3D< T >::tpoint3D ( const tpoint3D< U > &  p  )  [inline]

Copy constructor.


Member Function Documentation

template<class T >
T lti::tpoint3D< T >::absSqr (  )  const [inline]
template<class T>
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.

template<class T>
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+=().

template<class T>
template<class U >
tpoint3D<T>& lti::tpoint3D< T >::castFrom ( const tpoint3D< U > &  p  )  [inline]

Copy constructor.

template<class T>
tpoint3D< T > & lti::tpoint3D< T >::copy ( const tpoint3D< T > &  p  )  [inline]
template<class T>
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().

template<class T>
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().

template<class T>
template<class U >
tpoint3D<T>& lti::tpoint3D< T >::divide ( const tpoint3D< T > &  other,
const U  c 
) [inline]

Divide each component of tpoint3D<T> with a given factor.

template<class T>
template<class U >
tpoint3D<T>& lti::tpoint3D< T >::divide ( const U  c  )  [inline]

Divide each component of tpoint3D<T> with a given factor.

template<class T>
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.

template<class T>
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.

template<class T>
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.

template<class T>
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.

template<class T>
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.

template<class T>
template<class U >
tpoint3D<T>& lti::tpoint3D< T >::multiply ( const tpoint3D< T > &  other,
const U  c 
) [inline]

Multiply tpoint3D<T> with a given factor.

template<class T>
template<class U >
tpoint3D<T>& lti::tpoint3D< T >::multiply ( const U  c  )  [inline]

Multiply tpoint3D<T> with a given factor.

template<class T>
bool lti::tpoint3D< T >::operator!= ( const tpoint3D< T > &  p  )  const [inline]
template<class T >
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.

template<class T>
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.

template<class T>
template<class U >
tpoint3D<T> lti::tpoint3D< T >::operator* ( const U  c  )  const [inline]

Multiply tpoint3D<T> with a given factor.

template<class T>
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.

template<class T>
template<class U >
tpoint3D<T>& lti::tpoint3D< T >::operator*= ( const U  c  )  [inline]

Multiply tpoint3D<T> with a given factor.

template<class T>
tpoint3D< T > lti::tpoint3D< T >::operator+ ( const tpoint3D< T > &  p  )  const [inline]
template<class T>
tpoint3D< T > & lti::tpoint3D< T >::operator+= ( const tpoint3D< T > &  p  )  [inline]

Operator +.

References lti::tpoint3D< T >::add().

template<class T>
tpoint3D< T > lti::tpoint3D< T >::operator- ( const tpoint3D< T > &  p  )  const [inline]
template<class T>
tpoint3D< T > lti::tpoint3D< T >::operator-= ( const tpoint3D< T > &  p  )  [inline]

Operator -.

References lti::tpoint3D< T >::subtract().

template<class T>
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.

template<class T>
template<class U >
tpoint3D<T> lti::tpoint3D< T >::operator/ ( const U  c  )  const [inline]

Divide each component of tpoint3D<T> with a given factor.

template<class T>
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.

template<class T>
template<class U >
tpoint3D<T>& lti::tpoint3D< T >::operator/= ( const U  c  )  [inline]

Divide each component of tpoint3D<T> with a given factor.

template<class T>
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.

template<class T>
tpoint3D<T>& lti::tpoint3D< T >::operator= ( const tpoint3D< T > &  p  )  [inline]

Operator =.

template<class T>
bool lti::tpoint3D< T >::operator== ( const tpoint3D< T > &  p  )  const [inline]
template<class T>
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.

template<class T>
const T& lti::tpoint3D< T >::operator[] ( const int  i  )  const [inline]

Used to simulate read-only vector access.

It is slower than the normal access to the elements x, y and z, but allow the use of point in templates expecting a vector-like structure.

The correspondence between the elements of the vector and the color components will be [0] for x and [1] for y

template<class T>
T& lti::tpoint3D< T >::operator[] ( const int  i  )  [inline]

Used to simulate vector access.

It is slower than the normal access to the elements x, y and z, but allow the use of point in templates expecting a vector-like structure.

The correspondence between the elements of the vector and the color components will be [0] for x and [1] for y

template<class T>
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.

template<class T>
int lti::tpoint3D< T >::size (  )  const [inline]

Used to simulate the vector size.

template<class T>
tpoint3D< T > & lti::tpoint3D< T >::subtract ( const tpoint3D< T > &  p1,
const tpoint3D< T > &  p2 
) [inline]
template<class T>
tpoint3D< T > & lti::tpoint3D< T >::subtract ( const tpoint3D< T > &  p  )  [inline]

Member Data Documentation

template<class T>
T lti::tpoint3D< T >::x
template<class T>
T lti::tpoint3D< T >::y
template<class T>
T lti::tpoint3D< T >::z

The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:26:44 2010 for LTI-Lib by Doxygen 1.6.1