DGtal  1.4.beta
DGtal::concepts::CPolarPointComparator2D< T > Struct Template Reference

Aim: This concept gathers classes that are able to compare the position of two given points $$P, Q$$ around a pole $$O$$. More precisely, they compare the oriented angles lying between the horizontal line passing by $$O$$ and the rays $$[OP)$$ and $$[OQ)$$ (in a counter-clockwise orientation). This is equivalent to compare the angle in radians from 0 (included) to 2 π (excluded). More...

#include <DGtal/geometry/tools/CPolarPointComparator2D.h>

Inheritance diagram for DGtal::concepts::CPolarPointComparator2D< T >:
[legend]

## Public Types

typedef T::Point Point

## Public Member Functions

BOOST_CONCEPT_USAGE (CPolarPointComparator2D)

void checkConstConstraints () const

myX

Point myP

bool myB

## Detailed Description

### template<typename T> struct DGtal::concepts::CPolarPointComparator2D< T >

Aim: This concept gathers classes that are able to compare the position of two given points $$P, Q$$ around a pole $$O$$. More precisely, they compare the oriented angles lying between the horizontal line passing by $$O$$ and the rays $$[OP)$$ and $$[OQ)$$ (in a counter-clockwise orientation). This is equivalent to compare the angle in radians from 0 (included) to 2 π (excluded).

Description of concept 'CPolarPointComparator2D'

The main method is the operator() applied on two points. It returns 'true' if the first point is located strictly before the second one, 'false' otherwise. A point $$P$$ is located strictly before a point $$Q$$ iff the oriented angle done by $$P$$ is smaller than the one of $$Q$$ or its euclidean norm is shorter if $$O, P, Q$$ are aligned. Note that it returns 'false' if $$P = Q$$.

# Associated types

• Point : type of points

# Notation

• X : A type that is a model of CPolarPointComparator2D
• x : object of type X
• P : type of points
• p, p1, p2 : objects type P

# Valid expressions and semantics

| Name | Expression | Type requirements | Return type | Precondition | Semantics | Post condition | Complexity | |------------------—+-----------—+-------------------—+----------—+-----------—+----------------------------------------------------—+-------------—+--------------—| | pole setter | x.setPole(p) | p is of type P | | | the pole is set to p | | O(1) | | comparison function | x(p1, p2) | p1, p2 are of type P | bool | | tells whether p1 is located strictly before p2 or not | | model-dependant |

# Models

PolarPointComparator2DBy2x2DetComputer.

Template Parameters
 T the type that should be a model of CPolarPointComparator2D.

Definition at line 96 of file CPolarPointComparator2D.h.

## ◆ Point

template<typename T >
 typedef T::Point DGtal::concepts::CPolarPointComparator2D< T >::Point

Definition at line 101 of file CPolarPointComparator2D.h.

## ◆ BOOST_CONCEPT_USAGE()

template<typename T >
 DGtal::concepts::CPolarPointComparator2D< T >::BOOST_CONCEPT_USAGE ( CPolarPointComparator2D< T > )
inline

Definition at line 103 of file CPolarPointComparator2D.h.

104  {
105  myX.setPole( myP );
106
108  }

## ◆ checkConstConstraints()

template<typename T >
 void DGtal::concepts::CPolarPointComparator2D< T >::checkConstConstraints ( ) const
inline

Definition at line 109 of file CPolarPointComparator2D.h.

110  {
111  // const method dummyConst should take parameter myA of type A and return
112  // something of type B
114  }

## ◆ myB

template<typename T >
 bool DGtal::concepts::CPolarPointComparator2D< T >::myB
private

Definition at line 119 of file CPolarPointComparator2D.h.

## ◆ myP

template<typename T >
 private

Definition at line 118 of file CPolarPointComparator2D.h.

## ◆ myX

template<typename T >
 T DGtal::concepts::CPolarPointComparator2D< T >::myX
private

Definition at line 117 of file CPolarPointComparator2D.h.

The documentation for this struct was generated from the following file:
DGtal::concepts::CPolarPointComparator2D::checkConstConstraints
void checkConstConstraints() const
Definition: CPolarPointComparator2D.h:109
DGtal::concepts::CPolarPointComparator2D::myB
bool myB
Definition: CPolarPointComparator2D.h:119
DGtal::concepts::ConceptUtils::sameType
void sameType(const T &, const T &)
Definition: ConceptUtils.h:117
DGtal::concepts::CPolarPointComparator2D::myP
Point myP
Definition: CPolarPointComparator2D.h:118