DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DGtal::ImplicitHyperCube< TSpace > Class Template Reference

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

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

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

Protected Member Functions

 ImplicitHyperCube ()
 

Private Member Functions

ImplicitHyperCubeoperator= (const ImplicitHyperCube &other)
 

Private Attributes

RealPoint myCenter
 Ball center. More...
 
double myHalfWidth
 Ball HalfWidth. More...
 

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

◆ RealPoint

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

Definition at line 65 of file ImplicitHyperCube.h.

◆ Self

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

Definition at line 63 of file ImplicitHyperCube.h.

◆ Space

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

Definition at line 64 of file ImplicitHyperCube.h.

◆ Value

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

Definition at line 66 of file ImplicitHyperCube.h.

Constructor & Destructor Documentation

◆ ImplicitHyperCube() [1/2]

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.

◆ ~ImplicitHyperCube()

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

Destructor.

◆ ImplicitHyperCube() [2/2]

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

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

Member Function Documentation

◆ center()

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

Definition at line 157 of file ImplicitHyperCube.h.

158 {
159 return myCenter;
160 }

References DGtal::ImplicitHyperCube< TSpace >::myCenter.

◆ getLowerBound()

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.

138 {
140 }
static Self diagonal(Component val=1)

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

◆ getUpperBound()

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.

150 {
152 }

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

◆ isInside()

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.

113 {
114 return this->operator()(aPoint) >0.0;
115 }
double operator()(const RealPoint &aPoint) const
const Point aPoint(3, 4)

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

◆ isValid()

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.

◆ moveTo()

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

Modify the shape center

Parameters
newCenterthe new center position

Definition at line 167 of file ImplicitHyperCube.h.

168 {
169 myCenter = newCenter;
170 }

References DGtal::ImplicitHyperCube< TSpace >::myCenter.

◆ operator()()

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.

100 {
101 return myHalfWidth - (aPoint - myCenter ).norm(RealPoint::L_infty);
102 }

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

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

◆ operator=()

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.

◆ orientation()

template<typename TSpace >
Orientation DGtal::ImplicitHyperCube< TSpace >::orientation ( const RealPoint aPoint) const
inline

Definition at line 119 of file ImplicitHyperCube.h.

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 }
@ 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::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

◆ myCenter

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

◆ myHalfWidth

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

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