mln::point< G, C > Struct Template Reference

Generic point class. More...

#include <point.hh>

Inheritance diagram for mln::point< G, C >:

Inheritance graph

List of all members.

Public Types

enum  { dim = G::dim }
typedef C coord
 Coordinate associated type.
typedef dpoint< G, C > delta
 Delta associated type.
typedef dpoint< G, C > dpsite
 DPsite associated type.
typedef G grid
 Grid associated type.
typedef algebra::h_vec< G::dim,
float > 
h_vec
 Algebra hexagonal vector (hvec) associated type.
typedef algebra::vec< G::dim,
float > 
vec
 Algebra vector (vec) associated type.

Public Member Functions

C & last_coord ()
 Read-write access to the last coordinate.
const C & last_coord () const
 Read-only access to the last coordinate.
point< G, C > & operator+= (const delta &dp)
 Shifting by dp.
point< G, C > & operator-= (const delta &dp)
 Shifting by the inverse of dp.
C & operator[] (unsigned i)
 Read-write access to the i-th coordinate value.
const C & operator[] (unsigned i) const
 Read-only access to the i-th coordinate value.
template<typename F>
 point (const Function_v2v< F > &f)
 Constructor; coordinates are set by function f.
template<typename C2>
 point (const algebra::vec< dim, C2 > &v)
 Constructor from an algebra vector.
 point ()
 Constructor without argument.
void set_all (C c)
 Set all coordinates to the value c.
h_vec to_h_vec () const
 Transform to point in homogene coordinate system.
vec to_vec () const
 Explicit conversion towards mln::algebra::vec.
 point (const literal::origin_t &)
 Constructors/assignments with literals.
 point (C ind)

Static Public Member Functions

static const point< G, C > & minus_infty ()
 Point with all coordinates set to the mininum value.
static const point< G, C > & plus_infty ()
 Point with all coordinates set to the maximum value.

Static Public Attributes

static const point< G, C > origin = all_to(0)
 Origin point (all coordinates are 0).

Related Functions

(Note that these are not member functions.)

template<typename P, typename D>
operator+ (const Gpoint< P > &p, const Gdpoint< D > &dp)
 Add a delta-point rhs to a grid point lhs.
template<typename P, typename D>
P & operator+= (Gpoint< P > &p, const Gdpoint< D > &dp)
 Shift a point by a delta-point dp.
template<typename L, typename R>
L::delta operator- (const Gpoint< L > &lhs, const Gpoint< R > &rhs)
 Difference between a couple of grid point lhs and rhs.
template<typename P, typename D>
P & operator-= (Gpoint< P > &p, const Gdpoint< D > &dp)
 Shift a point by the negate of a delta-point dp.
template<typename P, typename D>
operator/ (const Gpoint< P > &p, const value::scalar_< D > &dp)
 Divise a point by a scalar s.
template<typename P>
std::ostream & operator<< (std::ostream &ostr, const Gpoint< P > &p)
 Print a grid point p into the output stream ostr.
template<typename L, typename R>
bool operator== (const Gpoint< L > &lhs, const Gpoint< R > &rhs)
 Equality comparison between a couple of grid point lhs and rhs.


Detailed Description

template<typename G, typename C>
struct mln::point< G, C >

Generic point class.

Parameters are n the dimension of the space and C the coordinate type in this space.


Member Typedef Documentation

template<typename G, typename C>
typedef C mln::point< G, C >::coord

Coordinate associated type.

template<typename G, typename C>
typedef dpoint<G,C> mln::point< G, C >::delta

Delta associated type.

template<typename G, typename C>
typedef dpoint<G,C> mln::point< G, C >::dpsite

DPsite associated type.

template<typename G, typename C>
typedef G mln::point< G, C >::grid

Grid associated type.

template<typename G, typename C>
typedef algebra::h_vec<G::dim, float> mln::point< G, C >::h_vec

Algebra hexagonal vector (hvec) associated type.

template<typename G, typename C>
typedef algebra::vec<G::dim, float> mln::point< G, C >::vec

Algebra vector (vec) associated type.


Member Enumeration Documentation

template<typename G, typename C>
anonymous enum

Enumerator:
dim  Dimension of the space.

Invariant:
dim > 0


Constructor & Destructor Documentation

template<typename G, typename C>
mln::point< G, C >::point (  )  [inline]

Constructor without argument.

template<typename G, typename C>
template<typename C2>
mln::point< G, C >::point ( const algebra::vec< dim, C2 > &  v  )  [inline]

Constructor from an algebra vector.

References mln::point< G, C >::dim.

template<typename G, typename C>
mln::point< G, C >::point ( ind  )  [inline, explicit]

Constructors with different numbers of arguments (coordinates) w.r.t. the dimension.

template<typename G, typename C>
mln::point< G, C >::point ( const literal::origin_t  )  [inline]

Constructors/assignments with literals.

template<typename G, typename C>
template<typename F>
mln::point< G, C >::point ( const Function_v2v< F > &  f  )  [inline]

Constructor; coordinates are set by function f.

References mln::point< G, C >::dim.


Member Function Documentation

template<typename G, typename C>
C & mln::point< G, C >::last_coord (  )  [inline]

Read-write access to the last coordinate.

References mln::point< G, C >::dim.

template<typename G, typename C>
const C & mln::point< G, C >::last_coord (  )  const [inline]

Read-only access to the last coordinate.

References mln::point< G, C >::dim.

Referenced by mln::p_run< P >::end(), mln::p_run< P >::operator[](), and mln::debug::put_word().

template<typename G, typename C>
const point< G, C > & mln::point< G, C >::minus_infty (  )  [inline, static]

Point with all coordinates set to the mininum value.

template<typename G, typename C>
point< G, C > & mln::point< G, C >::operator+= ( const delta dp  )  [inline]

Shifting by dp.

References mln::point< G, C >::dim.

template<typename G, typename C>
point< G, C > & mln::point< G, C >::operator-= ( const delta dp  )  [inline]

Shifting by the inverse of dp.

References mln::point< G, C >::dim.

template<typename G, typename C>
C & mln::point< G, C >::operator[] ( unsigned  i  )  [inline]

Read-write access to the i-th coordinate value.

Parameters:
[in] i The coordinate index.
Precondition:
i < dim

References mln::point< G, C >::dim.

template<typename G, typename C>
const C & mln::point< G, C >::operator[] ( unsigned  i  )  const [inline]

Read-only access to the i-th coordinate value.

Parameters:
[in] i The coordinate index.
Precondition:
i < dim

References mln::point< G, C >::dim.

template<typename G, typename C>
const point< G, C > & mln::point< G, C >::plus_infty (  )  [inline, static]

Point with all coordinates set to the maximum value.

template<typename G, typename C>
void mln::point< G, C >::set_all ( c  )  [inline]

Set all coordinates to the value c.

template<typename G, typename C>
point< G, C >::h_vec mln::point< G, C >::to_h_vec (  )  const [inline]

Transform to point in homogene coordinate system.

References mln::point< G, C >::dim.

template<typename G, typename C>
point< G, C >::vec mln::point< G, C >::to_vec (  )  const [inline]

Explicit conversion towards mln::algebra::vec.

References mln::point< G, C >::dim.

Referenced by mln::io::dicom::load().


Friends And Related Function Documentation

template<typename P, typename D>
P operator+ ( const Gpoint< P > &  p,
const Gdpoint< D > &  dp 
) [related, inherited]

Add a delta-point rhs to a grid point lhs.

Parameters:
[in] p A grid point.
[in] dp A delta-point.
The type of dp has to compatible with the type of p.

Returns:
A point (temporary object).
See also:
mln::Gdpoint

template<typename P, typename D>
P & operator+= ( Gpoint< P > &  p,
const Gdpoint< D > &  dp 
) [related, inherited]

Shift a point by a delta-point dp.

Parameters:
[in,out] p The targeted point.
[in] dp A delta-point.
Returns:
A reference to the point p once translated by dp.
Precondition:
The type of dp has to be compatible with the type of p.

template<typename L, typename R>
L::delta operator- ( const Gpoint< L > &  lhs,
const Gpoint< R > &  rhs 
) [related, inherited]

Difference between a couple of grid point lhs and rhs.

Parameters:
[in] lhs A first grid point.
[in] rhs A second grid point.
Warning:
There is no type promotion in Milena so the client has to make sure that both points are defined with the same type of coordinates.
Precondition:
Both lhs and rhs have to be defined on the same topology and with the same type of coordinates; otherwise this test does not compile.
Postcondition:
The result, dp, is such as lhs == rhs + dp.
Returns:
A delta point (temporary object).
See also:
mln::Gdpoint

template<typename P, typename D>
P & operator-= ( Gpoint< P > &  p,
const Gdpoint< D > &  dp 
) [related, inherited]

Shift a point by the negate of a delta-point dp.

Parameters:
[in,out] p The targeted point.
[in] dp A delta-point.
Returns:
A reference to the point p once translated by - dp.
Precondition:
The type of dp has to be compatible with the type of p.

template<typename P, typename D>
P operator/ ( const Gpoint< P > &  p,
const value::scalar_< D > &  dp 
) [related, inherited]

Divise a point by a scalar s.

Parameters:
[in,out] p The targeted point.
[in] dp A scalar.
Returns:
A reference to the point p once divised by s.

template<typename P>
std::ostream & operator<< ( std::ostream &  ostr,
const Gpoint< P > &  p 
) [related, inherited]

Print a grid point p into the output stream ostr.

Parameters:
[in,out] ostr An output stream.
[in] p A grid point.
Returns:
The modified output stream ostr.

References mln::debug::format().

template<typename L, typename R>
bool operator== ( const Gpoint< L > &  lhs,
const Gpoint< R > &  rhs 
) [related, inherited]

Equality comparison between a couple of grid point lhs and rhs.

Parameters:
[in] lhs A first grid point.
[in] rhs A second grid point.
Precondition:
Both lhs and rhs have to be defined on the same topology; otherwise this test does not compile.
Returns:
True if both grid points have the same coordinates, otherwise false.


Member Data Documentation

template<typename G, typename C>
const point< G, C > mln::point< G, C >::origin = all_to(0) [inline, static]

Origin point (all coordinates are 0).


Generated on Thu Sep 9 19:30:57 2010 for Milena (Olena) by  doxygen 1.5.6