#include <Shapes.h>
Public Member Functions |
| ~Shapes () |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
template<typename TDigitalSet , typename ShapeFunctor > |
void | digitalShaper (TDigitalSet &aSet, const ShapeFunctor &aFunctor) |
template<typename TDigitalSet , typename ShapeFunctor > |
void | euclideanShaper (TDigitalSet &aSet, const ShapeFunctor &aFunctor, const double h) |
Static Public Member Functions |
template<typename TDigitalSet , typename TShapeFunctor > |
static void | digitalShaper (TDigitalSet &aSet, const TShapeFunctor &aFunctor) |
template<typename TDigitalSet , typename TShapeFunctor > |
static void | euclideanShaper (TDigitalSet &aSet, const TShapeFunctor &aFunctor, const double h=1.0) |
template<typename DigitalSet , typename PointPredicate > |
static void | makeSetFromPointPredicate (DigitalSet &aSet, const PointPredicate &aPP) |
template<typename TDigitalSet > |
static void | addNorm1Ball (TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius) |
template<typename TDigitalSet > |
static void | addNorm2Ball (TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius) |
template<typename TDigitalSet > |
static void | removeNorm1Ball (TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius) |
template<typename TDigitalSet > |
static void | removeNorm2Ball (TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius) |
Protected Member Functions |
| Shapes () |
Detailed Description
template<typename TDomain>
class DGtal::Shapes< TDomain >
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Description of template class 'Shapes'
- Template Parameters:
-
TDomain | the type of the domain in which shapes are created. |
- Examples:
- arithmetic/lower-integer-convex-hull.cpp, io/boards/dgtalBoard2D-2-sets.cpp, io/boards/dgtalBoard2D-4-colormaps.cpp, io/boards/dgtalBoard3DTo2D-2-sets.cpp, io/boards/dgtalBoard3DTo2D-2bis-sets.cpp, io/boards/dgtalBoard3DTo2D-3-objects.cpp, io/boards/dgtalBoard3DTo2D-6.cpp, io/viewers/viewer3D-2-sets.cpp, io/viewers/viewer3D-3-objects.cpp, and io/viewers/viewer3D-6-clipping.cpp.
Definition at line 71 of file DGtal/shapes/Shapes.h.
Member Typedef Documentation
template<typename TDomain>
template<typename TDomain>
template<typename TDomain>
template<typename TDomain>
template<typename TDomain>
template<typename TDomain>
template<typename TDomain>
template<typename TDomain>
template<typename TDomain>
Constructor & Destructor Documentation
template<typename TDomain >
template<typename TDomain>
Constructor. Forbidden by default (protected to avoid g++ warnings).
template<typename TDomain>
Copy constructor.
- Parameters:
-
other | the object to clone. Forbidden by default. |
Member Function Documentation
template<typename TDomain >
template<typename TDigitalSet >
Adds the discrete ball (norm-1) of center [aCenter] and radius [aRadius] to the (perhaps non empty) set [aSet].
- Warning:
- deprecated Use implicitShaper instead.
- Template Parameters:
-
TDigitalSet | the type chosen for the digital set. |
- Parameters:
-
aSet | the set (modified) which will contain the discrete ball. |
aCenter | the center of the ball. |
aRadius | the radius of the ball. |
Adds the discrete ball (norm-1) of center [aCenter] and radius [aRadius] to the (perhaps non empty) set [aSet].
- Template Parameters:
-
TDigitalSet | the type chosen for the digital set. |
- Parameters:
-
aSet | the set (modified) which will contain the discrete ball. |
aCenter | the center of the ball. |
aRadius | the radius of the ball. |
Definition at line 100 of file DGtal/shapes/Shapes.ih.
{
Point v1( aCenter.diagonal( aRadius ) );
p1 -= v1;
p2 += v1;
const Domain & domain = aSet.domain();
LocalSpace ballDomain( p1, p2 );
for ( typename LocalSpace::ConstIterator it = ballDomain.begin();
it != ballDomain.end();
++it )
{
if ( domain.isInside( *it )
&& ( (*it - aCenter ).norm1() <= aRadius ) )
aSet.insert( *it );
}
}
template<typename TDomain >
template<typename TDigitalSet >
Adds the discrete ball (norm-2) of center [aCenter] and radius [aRadius] to the (perhaps non empty) set [aSet].
- Warning:
- deprecated Use implicitShaper instead.
- Template Parameters:
-
TDigitalSet | the type chosen for the digital set. |
- Parameters:
-
aSet | the set (modified) which will contain the discrete ball. |
aCenter | the center of the ball. |
aRadius | the radius of the ball. |
Adds the discrete ball (norm-2) of center [aCenter] and radius [aRadius] to the (perhaps non empty) set [aSet].
- Template Parameters:
-
TDigitalSet | the type chosen for the digital set. |
- Parameters:
-
aSet | the set (modified) which will contain the discrete ball. |
aCenter | the center of the ball. |
aRadius | the radius of the ball. |
Definition at line 174 of file DGtal/shapes/Shapes.ih.
{
Point v1( aCenter.diagonal( aRadius ) );
p1 -= v1;
p2 += v1;
const Domain & domain = aSet.domain();
LocalSpace ballDomain( p1, p2 );
for ( typename LocalSpace::ConstIterator it = ballDomain.begin();
it != ballDomain.end();
++it )
{
if ( domain.isInside( *it )
&& ( (*it - aCenter ).norm() <= aRadius ) )
aSet.insert( *it );
}
}
template<typename TDomain>
template<typename TDomain>
template<typename TDigitalSet , typename TShapeFunctor >
static void DGtal::Shapes< TDomain >::digitalShaper |
( |
TDigitalSet & |
aSet, |
|
|
const TShapeFunctor & |
aFunctor |
|
) |
| |
|
static |
Adds to the (perhaps non empty) set [aSet] an shape defined by an instance of ShapeFunctor. The shape functor must be a model of CDigitalOrientedShape and CDigitalBoundedShape.
- Parameters:
-
aSet | the set (modified) which will contain the shape. |
aFunctor | a functor defining the shape. |
- Template Parameters:
-
template<typename TDomain>
template<typename TDigitalSet , typename ShapeFunctor >
void DGtal::Shapes< TDomain >::digitalShaper |
( |
TDigitalSet & |
aSet, |
|
|
const ShapeFunctor & |
aFunctor |
|
) |
| |
Definition at line 199 of file DGtal/shapes/Shapes.ih.
References DGtal::INSIDE.
{
Point pLow = aFunctor.getLowerBound();
Point pUpp = aFunctor.getUpperBound();
LocalSpace implicitDomain( pLow, pUpp );
for ( typename LocalSpace::ConstIterator it = implicitDomain.begin();
it != implicitDomain.end();
++it )
{
if ( aFunctor.orientation( *it ) ==
INSIDE)
aSet.insert( *it );
}
}
template<typename TDomain>
template<typename TDigitalSet , typename TShapeFunctor >
static void DGtal::Shapes< TDomain >::euclideanShaper |
( |
TDigitalSet & |
aSet, |
|
|
const TShapeFunctor & |
aFunctor, |
|
|
const double |
h = 1.0 |
|
) |
| |
|
static |
Adds to the (perhaps non empty) set [aSet] an shape defined by an instance of ShapeFunctor.The shape functor must be a model of CEuclideanOrientedShape and CEuclideanBoundedShape. The underlying digitization process is a Gauss Digitizer with grid step h.
- Parameters:
-
aSet | the set (modified) which will contain the shape. |
aFunctor | a functor defining the shape. |
h | grid step for the Gauss digitization. |
- Template Parameters:
-
template<typename TDomain>
template<typename TDigitalSet , typename ShapeFunctor >
void DGtal::Shapes< TDomain >::euclideanShaper |
( |
TDigitalSet & |
aSet, |
|
|
const ShapeFunctor & |
aFunctor, |
|
|
const double |
h |
|
) |
| |
template<typename TDomain >
Checks the validity/consistency of the object.
- Returns:
- 'true' if the object is valid, 'false' otherwise.
Definition at line 289 of file DGtal/shapes/Shapes.ih.
template<typename TDomain >
template<typename DigitalSet , typename PointPredicate >
void DGtal::Shapes< TDomain >::makeSetFromPointPredicate |
( |
DigitalSet & |
aSet, |
|
|
const PointPredicate & |
aPP |
|
) |
| |
|
static |
Add to the set aSet the points of the domain that satisfies the predicate aPP.
- Parameters:
-
aSet | (modified) the digital set that will contain the points. |
aPP | a predicate on point. |
- Template Parameters:
-
DigitalSet | a model of CDigitalSet such that DigitalSet::Domain is Domain. |
PointPredicate | a model of CPointPredicate such that PointPredicate::Point is Point. |
Definition at line 247 of file DGtal/shapes/Shapes.ih.
{
BOOST_STATIC_ASSERT
(( ConceptUtils::SameType< Domain, typename DigitalSet::Domain >::value ));
BOOST_STATIC_ASSERT
(( ConceptUtils::SameType< Point, typename PointPredicate::Point >::value ));
for ( ConstIterator it = aSet.domain().begin(),
it_end = aSet.domain().end(); it != it_end; ++it )
if ( aPP( *it ) ) aSet.insert( *it );
}
template<typename TDomain>
Assignment.
- Parameters:
-
- Returns:
- a reference on 'this'. Forbidden by default.
template<typename TDomain >
template<typename TDigitalSet >
Removes the discrete ball (norm-1) of center [aCenter] and radius [aRadius] to the (perhaps non empty) set [aSet].
- Template Parameters:
-
TDigitalSet | the type chosen for the digital set. |
- Parameters:
-
aSet | the set (modified) which will contain the discrete ball. |
aCenter | the center of the ball. |
aRadius | the radius of the ball. |
Definition at line 65 of file DGtal/shapes/Shapes.ih.
{
Point v1( aCenter.diagonal( aRadius ) );
p1 -= v1;
p2 += v1;
const Domain & domain = aSet.domain();
LocalSpace ballDomain( p1, p2 );
for ( typename LocalSpace::ConstIterator it = ballDomain.begin();
it != ballDomain.end();
++it )
{
if ( domain.isInside( *it )
&& ( (*it - aCenter ).norm1() <= aRadius ) )
aSet.erase( *it );
}
}
template<typename TDomain >
template<typename TDigitalSet >
Removes the discrete ball (norm-2) of center [aCenter] and radius [aRadius] to the (perhaps non empty) set [aSet].
- Template Parameters:
-
TDigitalSet | the type chosen for the digital set. |
- Parameters:
-
aSet | the set (modified) which will contain the discrete ball. |
aCenter | the center of the ball. |
aRadius | the radius of the ball. |
Definition at line 137 of file DGtal/shapes/Shapes.ih.
{
Point v1( aCenter.diagonal( aRadius ) );
p1 -= v1;
p2 += v1;
const Domain & domain = aSet.domain();
LocalSpace ballDomain( p1, p2 );
for ( typename LocalSpace::ConstIterator it = ballDomain.begin();
it != ballDomain.end();
++it )
{
if ( domain.isInside( *it )
&& ( (*it - aCenter ).norm() <= aRadius ) )
aSet.erase( *it );
}
}
template<typename TDomain >
void DGtal::Shapes< TDomain >::selfDisplay |
( |
std::ostream & |
out | ) |
const |
|
inline |
Writes/Displays the object on an output stream.
- Parameters:
-
out | the output stream where the object is written. |
Definition at line 277 of file DGtal/shapes/Shapes.ih.
The documentation for this class was generated from the following files: