DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DGtal::ImplicitRoundedHyperCube< TSpace > Class Template Reference

#include <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
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.

Definition at line 78 of file ImplicitRoundedHyperCube.h.

:
myCenter(aCenter),
myHalfWidth(aHalfWidth),
myPower(aPower)
{};
template<typename T >
DGtal::ImplicitRoundedHyperCube< T >::~ImplicitRoundedHyperCube ( )
inline

Destructor.

Definition at line 46 of file ImplicitRoundedHyperCube.ih.

{
}
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 154 of file ImplicitRoundedHyperCube.h.

References DGtal::ImplicitRoundedHyperCube< TSpace >::myCenter, and DGtal::ImplicitRoundedHyperCube< TSpace >::myHalfWidth.

{
return (myCenter - RealPoint::diagonal(myHalfWidth));
}
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 166 of file ImplicitRoundedHyperCube.h.

References DGtal::ImplicitRoundedHyperCube< TSpace >::myCenter, and DGtal::ImplicitRoundedHyperCube< TSpace >::myHalfWidth.

{
return (myCenter + RealPoint::diagonal(myHalfWidth));
}
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 122 of file ImplicitRoundedHyperCube.h.

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

{
return this->operator()(aPoint) >0.0;
}
template<typename T >
bool DGtal::ImplicitRoundedHyperCube< T >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Definition at line 72 of file ImplicitRoundedHyperCube.ih.

{
return true;
}
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 105 of file ImplicitRoundedHyperCube.h.

References DGtal::ImplicitRoundedHyperCube< TSpace >::myCenter, DGtal::ImplicitRoundedHyperCube< TSpace >::myHalfWidth, and DGtal::ImplicitRoundedHyperCube< TSpace >::myPower.

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

{
RealPoint dec = (aPoint - myCenter);
double partialpower=0;
for(Dimension i = 0; i < RealPoint::dimension; ++i)
partialpower += std::pow(std::abs((double)dec[i]), myPower);
return std::pow(myHalfWidth, myPower) - partialpower;
}
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 135 of file ImplicitRoundedHyperCube.h.

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

{
if (this->operator()(aPoint) > 0.0)
return INSIDE;
else
if (this->operator()(aPoint) < 0.0)
return OUTSIDE;
else
return ON;
}
template<typename T >
void DGtal::ImplicitRoundedHyperCube< T >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 60 of file ImplicitRoundedHyperCube.ih.

{
out << "[ImplicitRoundedHyperCube] center="<<myCenter<<" halfwidth="<<myHalfWidth<<" power="<<myPower;
}

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 198 of file ImplicitRoundedHyperCube.h.

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


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