DGtal
0.6.devel
|
#include <Preimage2D.h>
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) | |
Preimage2D & | operator= (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 Container & | pHull () const |
const Container & | qHull () const |
std::string | className () const |
Private Types | |
typedef std::list< Point > | Container |
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 |
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).
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.
Shape | a 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:
Definition at line 93 of file Preimage2D.h.
|
private |
Definition at line 129 of file Preimage2D.h.
|
private |
Definition at line 131 of file Preimage2D.h.
|
private |
Definition at line 109 of file Preimage2D.h.
|
private |
Definition at line 111 of file Preimage2D.h.
|
private |
Definition at line 110 of file Preimage2D.h.
|
private |
Definition at line 106 of file Preimage2D.h.
|
private |
Definition at line 108 of file Preimage2D.h.
|
private |
Definition at line 125 of file Preimage2D.h.
|
private |
Definition at line 127 of file Preimage2D.h.
|
private |
Definition at line 116 of file Preimage2D.h.
|
private |
Definition at line 120 of file Preimage2D.h.
typedef Shape::Point DGtal::Preimage2D< Shape >::Point |
Definition at line 100 of file Preimage2D.h.
|
private |
Definition at line 118 of file Preimage2D.h.
|
private |
Definition at line 122 of file Preimage2D.h.
typedef Shape::Point DGtal::Preimage2D< Shape >::Vector |
Definition at line 101 of file Preimage2D.h.
|
inline |
Constructor.
firstPoint | the end point of the first straight segment expected to lie in the interior of the separating shapes |
secondPoint | the end point of the first straight segment expected to lie in the exterior of the separating shapes |
sShape | any shape |
Definition at line 44 of file Preimage2D.ih.
References DGtal::Preimage2D< Shape >::myPHull, and DGtal::Preimage2D< Shape >::myQHull.
|
inline |
|
inline |
Copy constructor.
other | the object to clone. |
Definition at line 63 of file Preimage2D.ih.
References DGtal::Preimage2D< Shape >::myPHull, and DGtal::Preimage2D< Shape >::myQHull.
|
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)
aP | the end point of the new straight segment expected to lie in the interior of the separating shapes |
aQ | the end point of the new straight segment expected to lie in the exterior of the separating shapes |
Definition at line 285 of file Preimage2D.ih.
References DGtal::isEmpty().
Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().
|
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)
aP | the end point of the new straight segment expected to lie in the interior of the separating shapes |
aQ | the end point of the new straight segment expected to lie in the exterior of the separating shapes |
Definition at line 227 of file Preimage2D.ih.
References DGtal::isEmpty().
Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().
|
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
aP | the end point of the new straight segment expected to lie in the interior of the separating shapes |
aQ | the end point of the new straight segment expected to lie in the exterior of the separating shapes |
Definition at line 203 of file Preimage2D.ih.
|
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
aP | the end point of the new straight segment expected to lie in the interior of the separating shapes |
aQ | the end point of the new straight segment expected to lie in the exterior of the separating shapes |
Definition at line 181 of file Preimage2D.ih.
|
inline |
Default drawing style object.
Definition at line 389 of file Preimage2D.ih.
|
inline |
Definition at line 441 of file Preimage2D.ih.
Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().
|
inline |
Definition at line 449 of file Preimage2D.ih.
Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().
|
inline |
Get the parameters of one separating straight line
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().
|
inline |
Definition at line 425 of file Preimage2D.ih.
Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().
|
inline |
Definition at line 433 of file Preimage2D.ih.
Referenced by DGtal::GeometricalDCA< TConstIterator >::isCircularlySeparable().
|
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
aP | the end point of the new straight segment expected to lie in the interior of the separating shapes |
aQ | the end point of the new straight segment expected to lie in the exterior of the separating shapes |
Definition at line 127 of file Preimage2D.ih.
|
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
aP | the end point of the new straight segment expected to lie in the interior of the separating shapes |
aQ | the end point of the new straight segment expected to lie in the exterior of the separating shapes |
Definition at line 109 of file Preimage2D.ih.
|
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
aP | the end point of the new straight segment expected to lie in the interior of the separating shapes |
aQ | the end point of the new straight segment expected to lie in the exterior of the separating shapes |
Definition at line 163 of file Preimage2D.ih.
|
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
aP | the end point of the new straight segment expected to lie in the interior of the separating shapes |
aQ | the end point of the new straight segment expected to lie in the exterior of the separating shapes |
Definition at line 145 of file Preimage2D.ih.
|
inline |
Checks the validity/consistency of the object.
Definition at line 417 of file Preimage2D.ih.
|
inline |
Difference operator
other | the object to compare with. |
Definition at line 101 of file Preimage2D.ih.
|
inline |
Assignment.
other | the object to copy. |
Definition at line 72 of file Preimage2D.ih.
References DGtal::Preimage2D< Shape >::myPHull, DGtal::Preimage2D< Shape >::myQHull, and DGtal::Preimage2D< Shape >::myShape.
|
inline |
Equality operator
other | the object to compare with. |
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.
|
inline |
Definition at line 347 of file Preimage2D.h.
References DGtal::Preimage2D< Shape >::myPHull.
Referenced by DGtal::Display2DFactory::draw().
|
inline |
Definition at line 355 of file Preimage2D.h.
References DGtal::Preimage2D< Shape >::myQHull.
Referenced by DGtal::Display2DFactory::draw().
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 397 of file Preimage2D.ih.
|
inline |
Definition at line 339 of file Preimage2D.h.
References DGtal::Preimage2D< Shape >::myShape.
Referenced by DGtal::Display2DFactory::draw().
|
inlineprivate |
Updates the current preimage
Nb: in O(n)
aPoint | a new vertex of the preimage, |
aContainer | the STL-like container to be updated, |
anIterator | an iterator to its front (resp. back) |
anEndIterator | an iterator pointing after its back (resp. before its front). |
Iterator | the type of Iterator (either Container::iterator or Container::reverse_iterator) |
Predicate | the type of Predicate |
Definition at line 346 of file Preimage2D.ih.
|
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().
|
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().
|
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().