DGtal 1.4.0
|
Aim: Class that implements a binary point predicate, which is able to compare the position of two given points \( P, Q \) around a pole \( O \). More precisely, it compares the oriented angles lying between the horizontal line passing by \( O \) and the rays \( [OP) \) and \( [OQ) \) (in a counter-clockwise orientation). More...
#include <DGtal/geometry/tools/PolarPointComparatorBy2x2DetComputer.h>
Public Types | |
typedef TPoint | Point |
typedef Point::Coordinate | Coordinate |
typedef Point | Vector |
typedef TDetComputer | DetComputer |
typedef DetComputer::ResultInteger | ResultInteger |
typedef functors::Thresholder< ResultInteger, false, false > | CustomThresholder |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((C2x2DetComputer< DetComputer >)) | |
PolarPointComparatorBy2x2DetComputer () | |
PolarPointComparatorBy2x2DetComputer (const Point &aPoint) | |
PolarPointComparatorBy2x2DetComputer (const PolarPointComparatorBy2x2DetComputer &other) | |
PolarPointComparatorBy2x2DetComputer & | operator= (const PolarPointComparatorBy2x2DetComputer &other) |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
void | setPole (const Point &aPole) |
bool | operator() (const Point &aPoint1, const Point &aPoint2) const |
Private Member Functions | |
bool | isBefore (const Point &aU, const Point &aV) const |
Private Attributes | |
Point | myPole |
DetComputer | myDetComputer |
CustomThresholder | myThresholder |
Aim: Class that implements a binary point predicate, which is able to compare the position of two given points \( P, Q \) around a pole \( O \). More precisely, it compares the oriented angles lying between the horizontal line passing by \( O \) and the rays \( [OP) \) and \( [OQ) \) (in a counter-clockwise orientation).
See PolarPointComparatorBy2x2DetComputer::operator() and PolarPointComparatorBy2x2DetComputer::isBefore for more details about the comparison (especially in degenerate cases).
TPoint | type of points to compare |
TDetComputer | a model of C2x2DetComputer. By default, Simple2x2DetComputer is chosen. |
Definition at line 79 of file PolarPointComparatorBy2x2DetComputer.h.
typedef Point::Coordinate DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::Coordinate |
Type of point coordinates
Definition at line 91 of file PolarPointComparatorBy2x2DetComputer.h.
typedef functors::Thresholder<ResultInteger, false, false> DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::CustomThresholder |
Type of the object that returns a bool from the determinant returned by myDetComputer.
Definition at line 113 of file PolarPointComparatorBy2x2DetComputer.h.
typedef TDetComputer DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::DetComputer |
Type of the object that computes the determinant of 2x2 matrix in order to determine the orientation of three points or compare the norm of two vectors.
Definition at line 101 of file PolarPointComparatorBy2x2DetComputer.h.
typedef TPoint DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::Point |
Type of 2D points to compare
Definition at line 87 of file PolarPointComparatorBy2x2DetComputer.h.
typedef DetComputer::ResultInteger DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::ResultInteger |
Type of integer returned by the determinant computer
Definition at line 107 of file PolarPointComparatorBy2x2DetComputer.h.
typedef Point DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::Vector |
Type of 2D vectors
Definition at line 95 of file PolarPointComparatorBy2x2DetComputer.h.
DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::PolarPointComparatorBy2x2DetComputer | ( | ) |
Default constructor. myPole is set to (0,0).
DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::PolarPointComparatorBy2x2DetComputer | ( | const Point & | aPoint | ) |
Constructor.
aPoint | pole used for the polar comparison |
DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::PolarPointComparatorBy2x2DetComputer | ( | const PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer > & | other | ) |
Copy constructor.
other | the object to clone. |
DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::BOOST_CONCEPT_ASSERT | ( | (C2x2DetComputer< DetComputer >) | ) |
|
private |
Method that compares two given points both belonging to the upward (positive y-coordinates) or downward (negative y-coordinates) half-plane.
The first argument aU lies before the second one aV iff the triple myPole , aU , aV are counter-clockwise oriented.
If myPole , aU , aV are aligned aU lies before aV iff its (L2) norm is shorter.
Note that if aU or aV are equal to myPole, its norm is the shortest possible.
If aU and aV are equal, this methods returns 'false', because no point is strictly located before the other.
aU | first point |
aV | second point |
bool DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
bool DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::operator() | ( | const Point & | aPoint1, |
const Point & | aPoint2 ) const |
Main operator, which compares two given points aPoint1 and aPoint2.
This method first checks whether the two points are located on the same side of the horizontal line passing by myPole or not. If so, it calls PolarPointComparatorBy2x2DetComputer::isBefore. Otherwise it concludes.
aPoint1 | first point |
aPoint2 | second point |
PolarPointComparatorBy2x2DetComputer & DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::operator= | ( | const PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer > & | other | ) |
Assignment.
other | the object to copy. |
void DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
void DGtal::functors::PolarPointComparatorBy2x2DetComputer< TPoint, TDetComputer >::setPole | ( | const Point & | aPole | ) |
Sets the pole.
aPole | new pole for the polar comparison. |
Referenced by convexHull(), and testSort().
|
mutableprivate |
Object that computes the determinant of 2x2 matrix in order to determine the orientation of three points or compare the norm of two vectors
Definition at line 222 of file PolarPointComparatorBy2x2DetComputer.h.
|
private |
Point used as the origin for the polar comparison of two given points
Definition at line 216 of file PolarPointComparatorBy2x2DetComputer.h.
|
private |
Object that returns a bool from the determinant returned by myDetComputer
Definition at line 227 of file PolarPointComparatorBy2x2DetComputer.h.