CVR-Lib last update 20 Sep 2009

cvr::point3D< T > Class Template Reference
[Geometry Data Structures]

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

#include <cvrPoint3D.h>

List of all members.

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
distanceSqr (const point3D< T > &c) const
absSqr () const
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


Detailed Description

template<typename T>
class cvr::point3D< T >

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

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>


Member Typedef Documentation

template<typename T>
typedef int cvr::point3D< T >::size_type

Return type of the size() member.

template<typename T>
typedef T cvr::point3D< T >::value_type

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


Constructor & Destructor Documentation

template<typename T>
cvr::point3D< T >::point3D ( const T  newx = T(),
const T  newy = T(),
const T  newz = T() 
) [explicit]

Default constructor.

template<typename T>
template<typename U >
cvr::point3D< T >::point3D ( const point3D< U > &  p  )  [inline]

Copy constructor.


Member Function Documentation

template<typename T>
T cvr::point3D< T >::absSqr (  )  const [inline]

Return the square of the magnitude of the point3D.

template<typename T>
point3D<T>& cvr::point3D< T >::add ( const point3D< T > &  a,
const point3D< T > &  b 
) [inline]

Add the two other point3Ds and leave the result here.

Parameters:
a first point3D to be added
b second point3D to be added
Returns:
a reference to this point3D, which will contain a+b

template<typename T>
point3D<T>& cvr::point3D< T >::add ( const point3D< T > &  p  )  [inline]

Add given point3D to this point3D and leave the result here.

Parameters:
p the other point3D to be added to this one
Returns:
a reference to this point3D

template<typename T>
template<typename U >
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.

template<typename T>
point3D<T>& cvr::point3D< T >::copy ( const point3D< T > &  p  )  [inline]

Copy operator.

template<typename T>
point3D<T>& cvr::point3D< T >::cross ( const point3D< T > &  a,
const point3D< T > &  b 
) [inline]

Cross product between the given two point3D.

template<typename T>
point3D<T>& cvr::point3D< T >::cross ( const point3D< T > &  c  )  [inline]

Cross product with another point3D.

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

template<typename T>
template<typename U >
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.

template<typename T>
template<typename U >
point3D<T>& cvr::point3D< T >::divide ( const U  c  )  [inline]

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

template<typename T>
T cvr::point3D< T >::dot ( const point3D< T > &  p  )  const [inline]

Dot product with another point3D.

Returns:
this->x*p.x + this->y*p.y + this->z*p.z.

template<typename T>
point3D<T>& cvr::point3D< T >::edivide ( const point3D< T > &  a,
const point3D< T > &  b 
) [inline]

Elementwise division of each component of the point3Ds.

template<typename T>
point3D<T>& cvr::point3D< T >::edivide ( const point3D< T > &  c  )  [inline]

Elementwise division of each component of the point3Ds.

template<typename T>
point3D<T>& cvr::point3D< T >::emultiply ( const point3D< T > &  a,
const point3D< T > &  b 
) [inline]

Multiplies elementwise the components of a and b and leave the result here.

See also:
dot(),cross()

template<typename T>
point3D<T>& cvr::point3D< T >::emultiply ( const point3D< T > &  c  )  [inline]

Multiplies elementwise the components of this and the point3D c, and leave the result here.

See also:
dot(),cross()

template<typename T>
void cvr::point3D< T >::get ( T &  tx,
T &  ty,
T &  tz 
) const [inline]

Get the coordinate values.

template<typename T>
template<typename U >
point3D<T>& cvr::point3D< T >::multiply ( const point3D< T > &  other,
const U  c 
) [inline]

Multiply the other point3D point3D<T> with a given factor.

template<typename T>
template<typename U >
point3D<T>& cvr::point3D< T >::multiply ( const U  c  )  [inline]

Multiply point3D<T> with a given factor.

template<typename T>
bool cvr::point3D< T >::operator!= ( const point3D< T > &  p  )  const [inline]

Operator !=.

template<typename T>
point3D<T> cvr::point3D< T >::operator% ( const int  c  )  const [inline]

Modulo c of the integer part of each component of the point3D.

template<typename T>
point3D<T> cvr::point3D< T >::operator* ( const point3D< T > &  c  )  const [inline]

Multiplies elementwise the components of this and the point3D c.

See also:
dot(),cross()

template<typename T>
template<typename U >
point3D<T> cvr::point3D< T >::operator* ( const U  c  )  const [inline]

Multiply point3D<T> with a given factor.

template<typename T>
point3D<T>& cvr::point3D< T >::operator*= ( const point3D< T > &  c  )  [inline]

Multiplies elementwise the components of this and the point3D c.

See also:
dot(),cross()

template<typename T>
template<typename U >
point3D<T>& cvr::point3D< T >::operator*= ( const U  c  )  [inline]

Multiply point3D<T> with a given factor.

template<typename T>
point3D<T> cvr::point3D< T >::operator+ ( const point3D< T > &  p  )  const [inline]

Operator + is simmilar to add, but a new point3D is returned, i.e.

this point3D will not change.

template<typename T>
point3D<T>& cvr::point3D< T >::operator+= ( const point3D< T > &  p  )  [inline]

Operator += is an alias for add().

template<typename T>
point3D<T> cvr::point3D< T >::operator- ( const point3D< T > &  p  )  const [inline]

Operator -.

template<typename T>
point3D<T>& cvr::point3D< T >::operator-= ( const point3D< T > &  p  )  [inline]

Operator -=.

template<typename T>
point3D<T> cvr::point3D< T >::operator/ ( const point3D< T > &  c  )  const [inline]

Elementwise division of each component of the point3Ds.

template<typename T>
template<typename U >
point3D<T> cvr::point3D< T >::operator/ ( const U  c  )  const [inline]

Divide each component of point3D<T> by a given factor.

template<typename T>
point3D<T>& cvr::point3D< T >::operator/= ( const point3D< T > &  c  )  [inline]

Elementwise division of each component of the point3Ds.

template<typename T>
template<typename U >
point3D<T>& cvr::point3D< T >::operator/= ( const U  c  )  [inline]

Divide each component of point3D<T> by a given factor.

template<typename T>
bool cvr::point3D< T >::operator< ( const point3D< T > &  p  )  const [inline]

Operator <.

A point3D is "smaller" than another one if its coordinates produce an earlier display of the point3D in the monitor. i.e. if it has a smaller y component or (if the y components are the same) if the x component is smaller

template<typename T>
point3D<T>& cvr::point3D< T >::operator= ( const point3D< T > &  p  )  [inline]

Operator =.

template<typename T>
bool cvr::point3D< T >::operator== ( const point3D< T > &  p  )  const [inline]

Operator ==.

template<typename T>
bool cvr::point3D< T >::operator> ( const point3D< T > &  p  )  const [inline]

Operator >.

A point3D is "bigger" than another one if its coordinates produce an later display of the point3D in the monitor. i.e. if it has a bigger y component or (if the y components are the same) if the x component is bigger

template<typename T>
const T& cvr::point3D< T >::operator[] ( const int  i  )  const [inline]

Used to simulate read-only vector access.

It allows the use of point3D in templates expecting a vector-like structure.

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

template<typename T>
T& cvr::point3D< T >::operator[] ( const int  i  )  [inline]

Used to simulate vector access.

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

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

template<typename T>
size_type cvr::point3D< T >::size (  )  const [inline]

Used to simulate the vector size.

template<typename T>
point3D<T>& cvr::point3D< T >::subtract ( const point3D< T > &  a,
const point3D< T > &  b 
) [inline]

Subtract the two other point3Ds and leave the result here.

Parameters:
a first point3D
b point3D to be subtracted from the first one
Returns:
a reference to this point3D, which will contain a-b

template<typename T>
point3D<T>& cvr::point3D< T >::subtract ( const point3D< T > &  p  )  [inline]

Subtract.


Member Data Documentation

template<typename T>
value_type cvr::point3D< T >::data[3]

Array that shares the same memory with x and y.

template<typename T>
value_type cvr::point3D< T >::x

Coordinate x.

template<typename T>
value_type cvr::point3D< T >::y

Coordinate y;.

template<typename T>
value_type cvr::point3D< T >::z

Coordinate z;.


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

Generated on Sun Sep 20 22:09:08 2009 for CVR-Lib by Doxygen 1.5.8