DGtal  0.9.3beta
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DGtal::ImplicitHyperCube< TSpace > Class Template Reference

#include <DGtal/shapes/implicit/ImplicitHyperCube.h>

Collaboration diagram for DGtal::ImplicitHyperCube< TSpace >:
[legend]

Public Types

typedef ImplicitHyperCube< TSpace > Self
 
typedef TSpace Space
 
typedef Space::RealPoint RealPoint
 
typedef double Value
 

Public Member Functions

 ImplicitHyperCube (const RealPoint &aCenter, const double &aHalfWidth)
 
 ~ImplicitHyperCube ()
 
double operator() (const RealPoint &aPoint) const
 
bool isInside (const RealPoint &aPoint) const
 
Orientation orientation (const RealPoint &aPoint) const
 
RealPoint getLowerBound () const
 
RealPoint getUpperBound () const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Protected Member Functions

 ImplicitHyperCube ()
 

Private Member Functions

ImplicitHyperCubeoperator= (const ImplicitHyperCube &other)
 

Private Attributes

RealPoint myCenter
 
double myHalfWidth
 

Detailed Description

template<typename TSpace>
class DGtal::ImplicitHyperCube< TSpace >

Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create an hypercube in nD..

Description of template class 'ImplicitHyperCube'

Template Parameters
TSpacethe Digital space definition.

Definition at line 59 of file ImplicitHyperCube.h.

Member Typedef Documentation

template<typename TSpace >
typedef Space::RealPoint DGtal::ImplicitHyperCube< TSpace >::RealPoint

Definition at line 65 of file ImplicitHyperCube.h.

template<typename TSpace >
typedef ImplicitHyperCube<TSpace> DGtal::ImplicitHyperCube< TSpace >::Self

Definition at line 63 of file ImplicitHyperCube.h.

template<typename TSpace >
typedef TSpace DGtal::ImplicitHyperCube< TSpace >::Space

Definition at line 64 of file ImplicitHyperCube.h.

template<typename TSpace >
typedef double DGtal::ImplicitHyperCube< TSpace >::Value

Definition at line 66 of file ImplicitHyperCube.h.

Constructor & Destructor Documentation

template<typename TSpace >
DGtal::ImplicitHyperCube< TSpace >::ImplicitHyperCube ( const RealPoint aCenter,
const double &  aHalfWidth 
)
inline

Constructor. Contructs a ball with center aCenter and width aWidth.

Parameters
aCenterthe cube center.
aHalfWidththe cube half-width.

Definition at line 75 of file ImplicitHyperCube.h.

75  :
76  myCenter(aCenter),
77  myHalfWidth(aHalfWidth)
78  {};
RealPoint myCenter
Ball center.
double myHalfWidth
Ball HalfWidth.
template<typename TSpace >
DGtal::ImplicitHyperCube< TSpace >::~ImplicitHyperCube ( )

Destructor.

template<typename TSpace >
DGtal::ImplicitHyperCube< TSpace >::ImplicitHyperCube ( )
protected

Constructor. Forbidden by default (protected to avoid g++ warnings).

Member Function Documentation

template<typename TSpace >
RealPoint DGtal::ImplicitHyperCube< TSpace >::getLowerBound ( ) const
inline

Returns the lower bound of the Shape bounding box.

Returns
the lower bound point.

Definition at line 137 of file ImplicitHyperCube.h.

References DGtal::PointVector< dim, TEuclideanRing, TContainer >::diagonal(), DGtal::ImplicitHyperCube< TSpace >::myCenter, and DGtal::ImplicitHyperCube< TSpace >::myHalfWidth.

138  {
140  }
static Self diagonal(Component val=1)
RealPoint myCenter
Ball center.
double myHalfWidth
Ball HalfWidth.
template<typename TSpace >
RealPoint DGtal::ImplicitHyperCube< TSpace >::getUpperBound ( ) const
inline

Returns the upper bound of the Shape bounding box.

Returns
the upper bound point.

Definition at line 149 of file ImplicitHyperCube.h.

References DGtal::PointVector< dim, TEuclideanRing, TContainer >::diagonal(), DGtal::ImplicitHyperCube< TSpace >::myCenter, and DGtal::ImplicitHyperCube< TSpace >::myHalfWidth.

150  {
152  }
static Self diagonal(Component val=1)
RealPoint myCenter
Ball center.
double myHalfWidth
Ball HalfWidth.
template<typename TSpace >
bool DGtal::ImplicitHyperCube< TSpace >::isInside ( const RealPoint aPoint) const
inline

Return true if the given point belongs to the shape.

Parameters
aPointthe point to evalute the function at.
Returns
the distance of aPoint to the ball center.

Definition at line 112 of file ImplicitHyperCube.h.

References DGtal::ImplicitHyperCube< TSpace >::operator()().

113  {
114  return this->operator()(aPoint) >0.0;
115  }
double operator()(const RealPoint &aPoint) const
template<typename TSpace >
bool DGtal::ImplicitHyperCube< TSpace >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TSpace >
double DGtal::ImplicitHyperCube< TSpace >::operator() ( const RealPoint aPoint) const
inline

Operator() of the implicit function. Given a point, it returns the function value at p. In Shapes, positive values are used to construct a set.

Parameters
aPointthe point to evalute the function at.
Returns
the distance of aPoint to the ball center.

Definition at line 99 of file ImplicitHyperCube.h.

References DGtal::PointVector< dim, TEuclideanRing, TContainer >::L_infty, DGtal::ImplicitHyperCube< TSpace >::myCenter, and DGtal::ImplicitHyperCube< TSpace >::myHalfWidth.

Referenced by DGtal::ImplicitHyperCube< TSpace >::isInside().

100  {
101  return myHalfWidth - (aPoint - myCenter ).norm(RealPoint::L_infty);
102  }
RealPoint myCenter
Ball center.
double myHalfWidth
Ball HalfWidth.
template<typename TSpace >
ImplicitHyperCube& DGtal::ImplicitHyperCube< TSpace >::operator= ( const ImplicitHyperCube< TSpace > &  other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.
template<typename TSpace >
Orientation DGtal::ImplicitHyperCube< TSpace >::orientation ( const RealPoint aPoint) const
inline

Definition at line 119 of file ImplicitHyperCube.h.

References DGtal::INSIDE, DGtal::ON, and DGtal::OUTSIDE.

120  {
121  if (this->operator()(aPoint) > 0.0)
122  return INSIDE;
123  else
124  if (this->operator()(aPoint) < 0.0)
125  return OUTSIDE;
126  else
127  return ON;
128  }
template<typename TSpace >
void DGtal::ImplicitHyperCube< TSpace >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

template<typename TSpace >
RealPoint DGtal::ImplicitHyperCube< TSpace >::myCenter
private
template<typename TSpace >
double DGtal::ImplicitHyperCube< TSpace >::myHalfWidth
private

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