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

#include <Preimage2D.h>

Collaboration diagram for DGtal::Preimage2D< Shape >:
Collaboration graph
[legend]

Public Types

typedef Shape::Point Point
typedef Shape::Point Vector

Public Member Functions

 Preimage2D (const Point &firstPoint, const Point &secondPoint, const Shape &aShape)
 ~Preimage2D ()
 Preimage2D (const Preimage2D &other)
Preimage2Doperator= (const Preimage2D &other)
bool operator== (const Preimage2D &other) const
bool operator!= (const Preimage2D &other) const
bool isLeftExteriorAtTheFront (const Point &aP, const Point &aQ)
bool isLeftExteriorAtTheBack (const Point &aP, const Point &aQ)
bool isRightExteriorAtTheFront (const Point &aP, const Point &aQ)
bool isRightExteriorAtTheBack (const Point &aP, const Point &aQ)
bool canBeAddedAtTheFront (const Point &aP, const Point &aQ)
bool canBeAddedAtTheBack (const Point &aP, const Point &aQ)
bool addFront (const Point &aP, const Point &aQ)
bool addBack (const Point &aP, const Point &aQ)
void selfDisplay (std::ostream &out) const
bool isValid () const
Point getUf () const
Point getUl () const
Point getLf () const
Point getLl () const
void getSeparatingStraightLine (double &alpha, double &beta, double &gamma) const
const Shape & shape () const
const ContainerpHull () const
const ContainerqHull () const
std::string className () const

Private Types

typedef std::list< PointContainer
typedef std::list< Point >
::iterator 
ForwardIterator
typedef std::list< Point >
::reverse_iterator 
BackwardIterator
typedef std::list< Point >
::const_iterator 
ConstForwardIterator
typedef std::list< Point >
::const_reverse_iterator 
ConstBackwardIterator
typedef Point2ShapePredicate
< Shape, false, true > 
PHullBackQHullFrontPred
typedef Point2ShapePredicate
< Shape, true, true > 
QHullBackPHullFrontPred
typedef Point2ShapePredicate
< Shape, true, true > 
PHullFrontQHullBackPred
typedef Point2ShapePredicate
< Shape, false, true > 
QHullFrontPHullBackPred
typedef Point2ShapePredicate
< Shape, true, false
FrontPHullUpdatePred
typedef Point2ShapePredicate
< Shape, false, false
FrontQHullUpdatePred
typedef Point2ShapePredicate
< Shape, false, false
BackPHullUpdatePred
typedef Point2ShapePredicate
< Shape, true, false
BackQHullUpdatePred

Private Member Functions

template<typename Iterator , typename Predicate >
void update (const Point &aPoint, Container &aContainer, Iterator &anIterator, const Iterator &anEndIterator)

Private Attributes

Shape myShape
Container myPHull
Container myQHull

Detailed Description

template<typename Shape>
class DGtal::Preimage2D< Shape >

Aim: Computes the preimage of the 2D Euclidean shapes crossing a sequence of n straigth segments in O(n), with the algorithm of O'Rourke (1981).

Note:
Joseph O'Rourke, An on-line algorithm for fitting straight lines between data ranges, Communications of the ACM, Volume 24, Issue 9, September 1981, 574–578.

For all i from 0 to n, the straight segment i is described by its two end points Pi and Qi. The set of shapes considered here are those that can be uniquely defined by two points and that separate the 2D plane into two disjoint parts (e.g. straight lines, circles passing through a given point). Consequently, the points Pi and the points Qi are assumed to lie in either side of the shape.

The user of this class has to decide from its input set of segments and the shape used whether a linear-time algorithm is possible or not. If yes (e.g. preimage of straight lines crossing a set of vertical segments of increasing x-coordinate) the algorithm of O'Rourke will return the right output.

Template Parameters:
Shapea model of COrientableHypersurface

You can define your preimage type from a given shape type as follows:

Here is another example:

Then, here is the basic usage of this class:

See also:
examplePreimage.cpp testPreimage.cpp

Definition at line 93 of file Preimage2D.h.


Member Typedef Documentation

template<typename Shape>
typedef Point2ShapePredicate<Shape,false,false> DGtal::Preimage2D< Shape >::BackPHullUpdatePred
private

Definition at line 129 of file Preimage2D.h.

template<typename Shape>
typedef Point2ShapePredicate<Shape,true,false> DGtal::Preimage2D< Shape >::BackQHullUpdatePred
private

Definition at line 131 of file Preimage2D.h.

template<typename Shape>
typedef std::list<Point>::reverse_iterator DGtal::Preimage2D< Shape >::BackwardIterator
private

Definition at line 109 of file Preimage2D.h.

template<typename Shape>
typedef std::list<Point>::const_reverse_iterator DGtal::Preimage2D< Shape >::ConstBackwardIterator
private

Definition at line 111 of file Preimage2D.h.

template<typename Shape>
typedef std::list<Point>::const_iterator DGtal::Preimage2D< Shape >::ConstForwardIterator
private

Definition at line 110 of file Preimage2D.h.

template<typename Shape>
typedef std::list<Point> DGtal::Preimage2D< Shape >::Container
private

Definition at line 106 of file Preimage2D.h.

template<typename Shape>
typedef std::list<Point>::iterator DGtal::Preimage2D< Shape >::ForwardIterator
private

Definition at line 108 of file Preimage2D.h.

template<typename Shape>
typedef Point2ShapePredicate<Shape,true,false> DGtal::Preimage2D< Shape >::FrontPHullUpdatePred
private

Definition at line 125 of file Preimage2D.h.

template<typename Shape>
typedef Point2ShapePredicate<Shape,false,false> DGtal::Preimage2D< Shape >::FrontQHullUpdatePred
private

Definition at line 127 of file Preimage2D.h.

template<typename Shape>
typedef Point2ShapePredicate<Shape,false,true> DGtal::Preimage2D< Shape >::PHullBackQHullFrontPred
private

Definition at line 116 of file Preimage2D.h.

template<typename Shape>
typedef Point2ShapePredicate<Shape,true,true> DGtal::Preimage2D< Shape >::PHullFrontQHullBackPred
private

Definition at line 120 of file Preimage2D.h.

template<typename Shape>
typedef Shape::Point DGtal::Preimage2D< Shape >::Point

Definition at line 100 of file Preimage2D.h.

template<typename Shape>
typedef Point2ShapePredicate<Shape,true,true> DGtal::Preimage2D< Shape >::QHullBackPHullFrontPred
private

Definition at line 118 of file Preimage2D.h.

template<typename Shape>
typedef Point2ShapePredicate<Shape,false,true> DGtal::Preimage2D< Shape >::QHullFrontPHullBackPred
private

Definition at line 122 of file Preimage2D.h.

template<typename Shape>
typedef Shape::Point DGtal::Preimage2D< Shape >::Vector

Definition at line 101 of file Preimage2D.h.


Constructor & Destructor Documentation

template<typename Shape>
DGtal::Preimage2D< Shape >::Preimage2D ( const Point firstPoint,
const Point secondPoint,
const Shape &  aShape 
)
inline

Constructor.

Parameters:
firstPointthe end point of the first straight segment expected to lie in the interior of the separating shapes
secondPointthe end point of the first straight segment expected to lie in the exterior of the separating shapes
sShapeany shape

Definition at line 44 of file Preimage2D.ih.

References DGtal::Preimage2D< Shape >::myPHull, and DGtal::Preimage2D< Shape >::myQHull.

: myShape(aShape)
{
myPHull.push_front(firstPoint);
myQHull.push_front(secondPoint);
}
template<typename Shape >
DGtal::Preimage2D< Shape >::~Preimage2D ( )
inline

Destructor. Does nothing.

Definition at line 57 of file Preimage2D.ih.

{
}
template<typename Shape>
DGtal::Preimage2D< Shape >::Preimage2D ( const Preimage2D< Shape > &  other)
inline

Copy constructor.

Parameters:
otherthe object to clone.

Definition at line 63 of file Preimage2D.ih.

References DGtal::Preimage2D< Shape >::myPHull, and DGtal::Preimage2D< Shape >::myQHull.

: myShape(other.myShape)
{
myPHull = other.myPHull;
myQHull = other.myQHull;
}

Member Function Documentation

template<typename Shape >
bool DGtal::Preimage2D< Shape >::addBack ( const Point aP,
const Point aQ 
)
inline

Updates the current preimage with the constraints involved by the two end points of a new segment (adding to the back with respect to a clockwise-oriented scan)

Nb: in O(n)

Parameters:
aPthe end point of the new straight segment expected to lie in the interior of the separating shapes
aQthe end point of the new straight segment expected to lie in the exterior of the separating shapes
Returns:
'false' if the updated preimage is empty, 'true' otherwise.

Definition at line 285 of file Preimage2D.ih.

References DGtal::isEmpty().

Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().

{
bool isEmpty = false;
//critical points
ForwardIterator PHullFront = myPHull.begin();
BackwardIterator QHullBack = myQHull.rbegin();
ForwardIterator QHullFront = myQHull.begin();
BackwardIterator PHullBack = myPHull.rbegin();
//predicates definition from critical shapes
myShape.init(*PHullFront, *QHullBack);
myShape.init(*QHullFront, *PHullBack);
if ( p1(aP) && p2(aQ) ) {
if ( p2(aP) ) { //constraint involved by aP
//update myPHull
update<BackwardIterator,BackPHullUpdatePred>
(aP, myPHull, PHullBack, myPHull.rend());
//add aP to myPHull
if (aP != *myPHull.rbegin()) myPHull.push_back(aP);
//update myQHull
update<ForwardIterator,BackQHullUpdatePred>
(aP, myQHull, QHullFront, myQHull.end());
} //else nothing to do
if ( p1(aQ) ) { //constraint involved by aQ
//update myQHull
update<BackwardIterator,BackQHullUpdatePred>
(aQ, myQHull, QHullBack, myQHull.rend());
//add aQ to myQHull
if (aQ != *myQHull.rbegin()) myQHull.push_back(aQ);
//update myPHull
update<ForwardIterator,BackPHullUpdatePred>
(aQ, myPHull, PHullFront, myPHull.end());
} //else nothing to do
} else isEmpty = true;
return (!isEmpty);
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::addFront ( const Point aP,
const Point aQ 
)
inline

Updates the current preimage with the constraints involved by the two end points of a new segment (adding to the front with respect to a clockwise-oriented scan)

Nb: in O(n)

Parameters:
aPthe end point of the new straight segment expected to lie in the interior of the separating shapes
aQthe end point of the new straight segment expected to lie in the exterior of the separating shapes
Returns:
'false' if the updated preimage is empty, 'true' otherwise.

Definition at line 227 of file Preimage2D.ih.

References DGtal::isEmpty().

Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().

{
bool isEmpty = false;
//critical points
BackwardIterator PHullBack = myPHull.rbegin();
ForwardIterator QHullFront = myQHull.begin();
BackwardIterator QHullBack = myQHull.rbegin();
ForwardIterator PHullFront = myPHull.begin();
//predicates definition from critical shapes
myShape.init(*PHullBack, *QHullFront);
myShape.init(*QHullBack, *PHullFront);
if ( p1(aP) && p2(aQ) ) {
if ( p2(aP) ) { //constraint involved by aP
//update myPHull
update<ForwardIterator,FrontPHullUpdatePred>
(aP, myPHull, PHullFront, myPHull.end());
//add aP to myPHull
if (aP != *myPHull.begin()) myPHull.push_front(aP);
//update myQHull
update<BackwardIterator,FrontQHullUpdatePred>
(aP, myQHull, QHullBack, myQHull.rend());
} //else nothing to do
if ( p1(aQ) ) { //constraint involved by aQ
//update myQHull
update<ForwardIterator,FrontQHullUpdatePred>
(aQ, myQHull, QHullFront, myQHull.end());
//add aQ to myQHull
if (aQ != *myQHull.begin()) myQHull.push_front(aQ);
//update myPHull
update<BackwardIterator,FrontPHullUpdatePred>
(aQ, myPHull, PHullBack, myPHull.rend());
} //else nothing to do
} else isEmpty = true;
return (!isEmpty);
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::canBeAddedAtTheBack ( const Point aP,
const Point aQ 
)
inline

Decide whether a new constraint can be added at the back (with respect to a clockwise-oriented scan) without making the preimage empty or not

Parameters:
aPthe end point of the new straight segment expected to lie in the interior of the separating shapes
aQthe end point of the new straight segment expected to lie in the exterior of the separating shapes
Returns:
'false' if the new constraint make the preimage empty 'true' otherwise.

Definition at line 203 of file Preimage2D.ih.

{
//critical points
ForwardIterator PHullFront = myPHull.begin();
BackwardIterator QHullBack = myQHull.rbegin();
ForwardIterator QHullFront = myQHull.begin();
BackwardIterator PHullBack = myPHull.rbegin();
//predicates definition from critical shapes
myShape.init(*PHullFront, *QHullBack);
myShape.init(*QHullFront, *PHullBack);
return ( p1(aP) && p2(aQ) );
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::canBeAddedAtTheFront ( const Point aP,
const Point aQ 
)
inline

Decide whether a new constraint can be added at the front (with respect to a clockwise-oriented scan) without making the preimage empty or not

Parameters:
aPthe end point of the new straight segment expected to lie in the interior of the separating shapes
aQthe end point of the new straight segment expected to lie in the exterior of the separating shapes
Returns:
'false' if the new constraint make the preimage empty 'true' otherwise.

Definition at line 181 of file Preimage2D.ih.

{
//critical points
BackwardIterator PHullBack = myPHull.rbegin();
ForwardIterator QHullFront = myQHull.begin();
BackwardIterator QHullBack = myQHull.rbegin();
ForwardIterator PHullFront = myPHull.begin();
//predicates definition from critical shapes
myShape.init(*PHullBack, *QHullFront);
myShape.init(*QHullBack, *PHullFront);
return ( p1(aP) && p2(aQ) );
}
template<typename Shape >
std::string DGtal::Preimage2D< Shape >::className ( ) const
inline

Default drawing style object.

Returns:
the dyn. alloc. default style for this object.
the style name used for drawing this object.

Definition at line 389 of file Preimage2D.ih.

{
return "Preimage2D";
}
template<typename Shape >
DGtal::Preimage2D< Shape >::Point DGtal::Preimage2D< Shape >::getLf ( ) const
inline
Returns:
first lower leaning point.

Definition at line 441 of file Preimage2D.ih.

Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().

{
return *myQHull.rbegin();
}
template<typename Shape >
DGtal::Preimage2D< Shape >::Point DGtal::Preimage2D< Shape >::getLl ( ) const
inline
Returns:
last lower leaning point.

Definition at line 449 of file Preimage2D.ih.

Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().

{
return *myQHull.begin();
}
template<typename Shape >
void DGtal::Preimage2D< Shape >::getSeparatingStraightLine ( double &  alpha,
double &  beta,
double &  gamma 
) const
inline

Get the parameters of one separating straight line

Parameters:
alpha(returned) y-component of the normal
beta(returned) x-component of the normal
gamma(returned) intercept

Definition at line 457 of file Preimage2D.ih.

References DGtal::NumberTraits< T >::castToDouble().

{
//critical points
Point Uf = getUf();
Point Ul = getUl();
Point Lf = getLf();
Point Ll = getLl();
//parameters
typedef typename Point::Coordinate Coordinate;
double a = -NumberTraits<Coordinate>::castToDouble(Ll[1]-Uf[1]);
double b = NumberTraits<Coordinate>::castToDouble(Ll[0]-Uf[0]);
double c = -NumberTraits<Coordinate>::castToDouble(Uf[0])*a
-NumberTraits<Coordinate>::castToDouble(Uf[1])*b;
double ap = -NumberTraits<Coordinate>::castToDouble(Ul[1]-Lf[1]);
double bp = NumberTraits<Coordinate>::castToDouble(Ul[0]-Lf[0]);
double cp = -NumberTraits<Coordinate>::castToDouble(Lf[0])*ap
-NumberTraits<Coordinate>::castToDouble(Lf[1])*bp;
double x, y;
double det = (ap*b-bp*a);
if (det != 0)
{
//intersection point
x = -(b*cp-bp*c)/det;
y = -(a*cp-ap*c)/(-det);
//normalisation of (ap,bp) with respect to (a,b)
double l = std::sqrt(a*a + b*b);
double lp = std::sqrt(ap*ap + bp*bp);
double apn = ap/lp*l;
double bpn = bp/lp*l;
//slope bisector of (UfLl) and (UlLf)
alpha = (a+apn)/2.0;
beta = (b+bpn)/2.0;
//intercept
gamma = -alpha*x - beta*y;
}
else
{//parallel case
alpha = a;
beta = b;
gamma = c;
}
}
template<typename Shape >
DGtal::Preimage2D< Shape >::Point DGtal::Preimage2D< Shape >::getUf ( ) const
inline
Returns:
first upper leaning point.

Definition at line 425 of file Preimage2D.ih.

Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().

{
return *myPHull.rbegin();
}
template<typename Shape >
DGtal::Preimage2D< Shape >::Point DGtal::Preimage2D< Shape >::getUl ( ) const
inline
Returns:
last upper leaning point.

Definition at line 433 of file Preimage2D.ih.

Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().

{
return *myPHull.begin();
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::isLeftExteriorAtTheBack ( const Point aP,
const Point aQ 
)
inline

Decide whether a new constraint that is added at the back (with respect to a clockwise-oriented scan) makes the preimage empty because of point aQ or not

Parameters:
aPthe end point of the new straight segment expected to lie in the interior of the separating shapes
aQthe end point of the new straight segment expected to lie in the exterior of the separating shapes
Returns:
'true' if the new constraint makes the preimage empty because of point aQ and 'false' otherwise.

Definition at line 127 of file Preimage2D.ih.

{
//critical points
ForwardIterator QHullFront = myQHull.begin();
BackwardIterator PHullBack = myPHull.rbegin();
//predicates definition from critical shapes
myShape.init(*QHullFront, *PHullBack);
return (!p2(aQ));
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::isLeftExteriorAtTheFront ( const Point aP,
const Point aQ 
)
inline

Decide whether a new constraint that is added at the front (with respect to a clockwise-oriented scan) makes the preimage empty because of point aP or not

Parameters:
aPthe end point of the new straight segment expected to lie in the interior of the separating shapes
aQthe end point of the new straight segment expected to lie in the exterior of the separating shapes
Returns:
'true' if the new constraint makes the preimage empty because of point aP and 'false' otherwise.

Definition at line 109 of file Preimage2D.ih.

{
//critical points
BackwardIterator PHullBack = myPHull.rbegin();
ForwardIterator QHullFront = myQHull.begin();
//predicates definition from critical shapes
myShape.init(*PHullBack, *QHullFront);
return (!p1(aP));
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::isRightExteriorAtTheBack ( const Point aP,
const Point aQ 
)
inline

Decide whether a new constraint that is added at the front (with respect to a clockwise-oriented scan) makes the preimage empty because of point aP or not

Parameters:
aPthe end point of the new straight segment expected to lie in the interior of the separating shapes
aQthe end point of the new straight segment expected to lie in the exterior of the separating shapes
Returns:
'true' if the new constraint makes the preimage empty because of point aP and 'false' otherwise.

Definition at line 163 of file Preimage2D.ih.

{
//critical points
ForwardIterator PHullFront = myPHull.begin();
BackwardIterator QHullBack = myQHull.rbegin();
//predicates definition from critical shapes
myShape.init(*PHullFront, *QHullBack);
return (!p1(aP));
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::isRightExteriorAtTheFront ( const Point aP,
const Point aQ 
)
inline

Decide whether a new constraint that is added at the front (with respect to a clockwise-oriented scan) makes the preimage empty because of point aQ or not

Parameters:
aPthe end point of the new straight segment expected to lie in the interior of the separating shapes
aQthe end point of the new straight segment expected to lie in the exterior of the separating shapes
Returns:
'true' if the new constraint makes the preimage empty because of point aQ and 'false' otherwise.

Definition at line 145 of file Preimage2D.ih.

{
//critical points
BackwardIterator QHullBack = myQHull.rbegin();
ForwardIterator PHullFront = myPHull.begin();
//predicates definition from critical shapes
myShape.init(*QHullBack, *PHullFront);
return (!p2(aQ));
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 417 of file Preimage2D.ih.

{
return true;
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::operator!= ( const Preimage2D< Shape > &  other) const
inline

Difference operator

Parameters:
otherthe object to compare with.
Returns:
'true' if not equal, 'false' otherwise.

Definition at line 101 of file Preimage2D.ih.

{
return !(*this == other);
}
template<typename Shape >
DGtal::Preimage2D< Shape > & DGtal::Preimage2D< Shape >::operator= ( const Preimage2D< Shape > &  other)
inline

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'.

Definition at line 72 of file Preimage2D.ih.

References DGtal::Preimage2D< Shape >::myPHull, DGtal::Preimage2D< Shape >::myQHull, and DGtal::Preimage2D< Shape >::myShape.

{
if ( this != &other )
{
myShape = other.myShape;
myPHull = other.myPHull;
myQHull = other.myQHull;
}
return *this;
}
template<typename Shape >
bool DGtal::Preimage2D< Shape >::operator== ( const Preimage2D< Shape > &  other) const
inline

Equality operator

Parameters:
otherthe object to compare with.
Returns:
'true' if the points of myPHull match to those of other.myPHull and if the points of myQHull match to those of other.myQHull, 'false' otherwise.

NB: linear in the size of myPHull and myQHull

Definition at line 86 of file Preimage2D.ih.

References DGtal::Preimage2D< Shape >::myPHull, and DGtal::Preimage2D< Shape >::myQHull.

{
if ( (std::equal(myPHull.begin(),myPHull.end(),other.myPHull.begin())
&&std::equal(myQHull.begin(),myQHull.end(),other.myQHull.begin()))
|| (std::equal(myPHull.begin(),myPHull.end(),other.myPHull.rbegin())
&&std::equal(myQHull.begin(),myQHull.end(),other.myQHull.rbegin()))
)
return true;
else
return false;
}
template<typename Shape>
const Container& DGtal::Preimage2D< Shape >::pHull ( ) const
inline
Returns:
the lower part of the preimage.

Definition at line 347 of file Preimage2D.h.

References DGtal::Preimage2D< Shape >::myPHull.

Referenced by DGtal::Display2DFactory::draw().

{
return myPHull;
};
template<typename Shape>
const Container& DGtal::Preimage2D< Shape >::qHull ( ) const
inline
Returns:
the upper part of the preimage.

Definition at line 355 of file Preimage2D.h.

References DGtal::Preimage2D< Shape >::myQHull.

Referenced by DGtal::Display2DFactory::draw().

{
return myQHull;
};
template<typename Shape >
void DGtal::Preimage2D< Shape >::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 397 of file Preimage2D.ih.

{
out << "[Preimage2D]\n";
out << "first part: \n";
for (ConstForwardIterator i = myPHull.begin();
i != myPHull.end(); ++i) {
out << *i << ", ";
}
out << "\n";
out << "second part: \n";
for (ConstForwardIterator i = myQHull.begin();
i != myQHull.end(); ++i) {
out << *i << ", ";
}
out << "\n";
}
template<typename Shape>
const Shape& DGtal::Preimage2D< Shape >::shape ( ) const
inline
Returns:
the shape used to separate the input points.

Definition at line 339 of file Preimage2D.h.

References DGtal::Preimage2D< Shape >::myShape.

Referenced by DGtal::Display2DFactory::draw().

{
return myShape;
};
template<typename Shape >
template<typename Iterator , typename Predicate >
void DGtal::Preimage2D< Shape >::update ( const Point aPoint,
Container aContainer,
Iterator &  anIterator,
const Iterator &  anEndIterator 
)
inlineprivate

Updates the current preimage

Nb: in O(n)

Parameters:
aPointa new vertex of the preimage,
aContainerthe STL-like container to be updated,
anIteratoran iterator to its front (resp. back)
anEndIteratoran iterator pointing after its back (resp. before its front).
Template Parameters:
Iteratorthe type of Iterator (either Container::iterator or Container::reverse_iterator)
Predicatethe type of Predicate

Definition at line 346 of file Preimage2D.ih.

{
Point p, q;
q = *anIterator;
anIterator++;
if (anIterator != anEndIterator) {
p = *anIterator;
myShape.init(p,q);
Predicate pred( myShape );
while ( (anIterator != anEndIterator) &&
(pred(aPoint)) ) {
//deletion
anIterator--;
anIterator =
::erase(aContainer, anIterator);
//update of pred
q = p;
anIterator++;
if (anIterator != anEndIterator) {
p = *anIterator;
myShape.init(p,q);
pred = Predicate( myShape );
}
}
}
}

Field Documentation

template<typename Shape>
Container DGtal::Preimage2D< Shape >::myPHull
private

Lower part of the preimage (whose vertices are Pi points)

Definition at line 387 of file Preimage2D.h.

Referenced by DGtal::Preimage2D< Shape >::operator=(), DGtal::Preimage2D< Shape >::operator==(), DGtal::Preimage2D< Shape >::pHull(), and DGtal::Preimage2D< Shape >::Preimage2D().

template<typename Shape>
Container DGtal::Preimage2D< Shape >::myQHull
private

Upper part of the preimage. (whose vertices are Qi points)

Definition at line 392 of file Preimage2D.h.

Referenced by DGtal::Preimage2D< Shape >::operator=(), DGtal::Preimage2D< Shape >::operator==(), DGtal::Preimage2D< Shape >::Preimage2D(), and DGtal::Preimage2D< Shape >::qHull().

template<typename Shape>
Shape DGtal::Preimage2D< Shape >::myShape
private

Shape used to separate the input points

Definition at line 380 of file Preimage2D.h.

Referenced by DGtal::Preimage2D< Shape >::operator=(), and DGtal::Preimage2D< Shape >::shape().


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