Processing math: 100%
DGtal 2.0.0
DGtal::ImplicitRoundedHyperCube< TSpace > Class Template Reference

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

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

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
RealPoint center () const
void moveTo (const RealPoint &newCenter)
void selfDisplay (std::ostream &out) const
bool isValid () const

Protected Member Functions

 ImplicitRoundedHyperCube ()

Private Member Functions

ImplicitRoundedHyperCubeoperator= (const ImplicitRoundedHyperCube &other)

Private Attributes

RealPoint myCenter
 Cube center.
double myHalfWidth
 Cube HalfWidth.
double myPower
 Cube Power.

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

◆ RealPoint

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

Definition at line 68 of file ImplicitRoundedHyperCube.h.

◆ Self

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

Definition at line 66 of file ImplicitRoundedHyperCube.h.

◆ Space

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

Definition at line 67 of file ImplicitRoundedHyperCube.h.

◆ Value

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

Definition at line 69 of file ImplicitRoundedHyperCube.h.

Constructor & Destructor Documentation

◆ ImplicitRoundedHyperCube() [1/2]

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 :
85 {};
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a rounded hypercu...

References myCenter, myHalfWidth, and myPower.

Referenced by operator=().

◆ ~ImplicitRoundedHyperCube()

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

Destructor.

◆ ImplicitRoundedHyperCube() [2/2]

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

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

Member Function Documentation

◆ center()

template<typename TSpace>
RealPoint DGtal::ImplicitRoundedHyperCube< TSpace >::center ( ) const
inline
Returns
the center of the star-shaped object.

Definition at line 175 of file ImplicitRoundedHyperCube.h.

176 {
177 return myCenter;
178 }

References myCenter.

◆ getLowerBound()

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.

156 {
158 }
static Self diagonal(Component val=1)

References DGtal::PointVector< dim, double >::diagonal(), myCenter, and myHalfWidth.

Referenced by main().

◆ getUpperBound()

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.

168 {
170 }

References DGtal::PointVector< dim, double >::diagonal(), myCenter, and myHalfWidth.

Referenced by main().

◆ isInside()

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.

124 {
125 return this->operator()(aPoint) >0.0;
126 }
double operator()(const RealPoint &aPoint) const

References aPoint, and operator()().

◆ isValid()

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.

◆ moveTo()

template<typename TSpace>
void DGtal::ImplicitRoundedHyperCube< TSpace >::moveTo ( const RealPoint & newCenter)
inline

Modify the shape center

Parameters
newCenterthe new center position

Definition at line 185 of file ImplicitRoundedHyperCube.h.

186 {
188 }

References myCenter.

◆ operator()()

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.

107 {
109 double partialpower=0;
110 for(Dimension i = 0; i < RealPoint::dimension; ++i)
111 partialpower += std::pow(std::abs((double)dec[i]), myPower);
112
114 }
static const Dimension dimension

References aPoint, DGtal::PointVector< dim, double >::dimension, myCenter, myHalfWidth, and myPower.

Referenced by isInside().

◆ operator=()

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.

References ImplicitRoundedHyperCube().

◆ orientation()

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.

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 }

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

◆ selfDisplay()

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

◆ myCenter

template<typename TSpace>
RealPoint DGtal::ImplicitRoundedHyperCube< TSpace >::myCenter
private

◆ myHalfWidth

template<typename TSpace>
double DGtal::ImplicitRoundedHyperCube< TSpace >::myHalfWidth
private

Cube HalfWidth.

Definition at line 214 of file ImplicitRoundedHyperCube.h.

Referenced by getLowerBound(), getUpperBound(), ImplicitRoundedHyperCube(), and operator()().

◆ myPower

template<typename TSpace>
double DGtal::ImplicitRoundedHyperCube< TSpace >::myPower
private

Cube Power.

Definition at line 217 of file ImplicitRoundedHyperCube.h.

Referenced by ImplicitRoundedHyperCube(), and operator()().


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