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

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

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

Public Types

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

Public Member Functions

 ImplicitRoundedHyperCube (const RealPoint &aCenter, const double &aHalfWidth, const double aPower)
 
 ~ImplicitRoundedHyperCube ()
 
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

 ImplicitRoundedHyperCube ()
 

Private Member Functions

ImplicitRoundedHyperCubeoperator= (const ImplicitRoundedHyperCube &other)
 

Private Attributes

RealPoint myCenter
 
double myHalfWidth
 
double myPower
 

Detailed Description

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

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

Description of template class 'ImplicitRoundedHyperCube'

Rounded hypercubes corresponds to balls for the \(l_p\) norm.

Template Parameters
TSpacethe Digital space definition.

Definition at line 62 of file ImplicitRoundedHyperCube.h.

Member Typedef Documentation

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

Definition at line 68 of file ImplicitRoundedHyperCube.h.

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

Definition at line 66 of file ImplicitRoundedHyperCube.h.

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

Definition at line 67 of file ImplicitRoundedHyperCube.h.

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

Definition at line 69 of file ImplicitRoundedHyperCube.h.

Constructor & Destructor Documentation

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

Constructor. Contructs a rounded hypercube with center aCenter and width aWidth.

Parameters
aCenterthe cube center.
aHalfWidththe cube half-width.
aPowerthe cube power.

Definition at line 79 of file ImplicitRoundedHyperCube.h.

81  :
82  myCenter(aCenter),
83  myHalfWidth(aHalfWidth),
84  myPower(aPower)
85  {};
template<typename TSpace>
DGtal::ImplicitRoundedHyperCube< TSpace >::~ImplicitRoundedHyperCube ( )

Destructor.

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

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

Member Function Documentation

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

Returns the lower bound of the Shape bounding box.

Returns
the lower bound point.

Definition at line 155 of file ImplicitRoundedHyperCube.h.

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

156  {
158  }
static Self diagonal(Component val=1)
template<typename TSpace>
RealPoint DGtal::ImplicitRoundedHyperCube< TSpace >::getUpperBound ( ) const
inline

Returns the upper bound of the Shape bounding box.

Returns
the upper bound point.

Definition at line 167 of file ImplicitRoundedHyperCube.h.

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

168  {
170  }
static Self diagonal(Component val=1)
template<typename TSpace>
bool DGtal::ImplicitRoundedHyperCube< 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
true if aPoint belongs to the shape.

Definition at line 123 of file ImplicitRoundedHyperCube.h.

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

124  {
125  return this->operator()(aPoint) >0.0;
126  }
double operator()(const RealPoint &aPoint) const
template<typename TSpace>
bool DGtal::ImplicitRoundedHyperCube< TSpace >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TSpace>
double DGtal::ImplicitRoundedHyperCube< 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 106 of file ImplicitRoundedHyperCube.h.

References DGtal::PointVector< dim, TEuclideanRing, TContainer >::dimension, DGtal::ImplicitRoundedHyperCube< TSpace >::myCenter, DGtal::ImplicitRoundedHyperCube< TSpace >::myHalfWidth, and DGtal::ImplicitRoundedHyperCube< TSpace >::myPower.

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

107  {
108  RealPoint dec = (aPoint - myCenter);
109  double partialpower=0;
110  for(Dimension i = 0; i < RealPoint::dimension; ++i)
111  partialpower += std::pow(std::abs((double)dec[i]), myPower);
112 
113  return std::pow(myHalfWidth, myPower) - partialpower;
114  }
static const Dimension dimension
Copy of the static dimension of the Point/Vector.
Definition: PointVector.h:167
DGtal::uint32_t Dimension
Definition: Common.h:120
template<typename TSpace>
ImplicitRoundedHyperCube& DGtal::ImplicitRoundedHyperCube< TSpace >::operator= ( const ImplicitRoundedHyperCube< TSpace > &  other)
private

Assignment.

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

orientation predicate (see CEuclideanOrientedShape).

Parameters
aPointan input point.
Returns
the orientation of the point.

Definition at line 136 of file ImplicitRoundedHyperCube.h.

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

137  {
138  if (this->operator()(aPoint) > 0.0)
139  return INSIDE;
140  else
141  if (this->operator()(aPoint) < 0.0)
142  return OUTSIDE;
143  else
144  return ON;
145  }
template<typename TSpace>
void DGtal::ImplicitRoundedHyperCube< 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::ImplicitRoundedHyperCube< TSpace >::myCenter
private
template<typename TSpace>
double DGtal::ImplicitRoundedHyperCube< TSpace >::myHalfWidth
private
template<typename TSpace>
double DGtal::ImplicitRoundedHyperCube< TSpace >::myPower
private

Cube Power.

Definition at line 199 of file ImplicitRoundedHyperCube.h.

Referenced by DGtal::ImplicitRoundedHyperCube< TSpace >::operator()().


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