DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
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. More...
 
double myHalfWidth
 Cube HalfWidth. More...
 
double myPower
 Cube Power. More...
 

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 :
82 myCenter(aCenter),
83 myHalfWidth(aHalfWidth),
84 myPower(aPower)
85 {};

◆ ~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 DGtal::ImplicitRoundedHyperCube< TSpace >::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, TEuclideanRing, TContainer >::diagonal(), DGtal::ImplicitRoundedHyperCube< TSpace >::myCenter, and DGtal::ImplicitRoundedHyperCube< TSpace >::myHalfWidth.

◆ 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, TEuclideanRing, TContainer >::diagonal(), DGtal::ImplicitRoundedHyperCube< TSpace >::myCenter, and DGtal::ImplicitRoundedHyperCube< TSpace >::myHalfWidth.

◆ 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
const Point aPoint(3, 4)

References DGtal::ImplicitRoundedHyperCube< TSpace >::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 {
187 myCenter = newCenter;
188 }

References DGtal::ImplicitRoundedHyperCube< TSpace >::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 {
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:626
DGtal::uint32_t Dimension
Definition: Common.h:137
Z2i::RealPoint RealPoint

References aPoint(), 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().

◆ 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.

◆ 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 }
@ INSIDE
Definition: Common.h:142
@ OUTSIDE
Definition: Common.h:142
@ ON
Definition: Common.h:142

References 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

◆ myPower

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

Cube Power.

Definition at line 217 of file ImplicitRoundedHyperCube.h.

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


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