DGtal  1.5.beta
DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer > Class Template Reference

Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation of three given 2d points. More precisely, it returns: More...

#include <DGtal/geometry/tools/determinant/InHalfPlaneBy2x2DetComputer.h>

Public Types

typedef TPoint Point
 
typedef std::array< Point, 2 > PointArray
 
typedef PointArray::size_type SizeArray
 
typedef TDetComputer DetComputer
 
typedef TDetComputer::ArgumentInteger ArgumentInteger
 
typedef TDetComputer::ResultInteger Value
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((C2x2DetComputer< DetComputer >))
 
void init (const Point &aP, const Point &aQ)
 
void init (const PointArray &aA)
 
Value operator() (const Point &aR) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Static Public Attributes

static const SizeArray size = 2
 

Private Attributes

ArgumentInteger myA
 
ArgumentInteger myB
 
DetComputer myDetComputer
 

Detailed Description

template<typename TPoint, typename TDetComputer>
class DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >

Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation of three given 2d points. More precisely, it returns:

  • zero if the three points belong to the same line
  • strictly positive if the three points are counter-clockwise oriented
  • striclty negative if the three points are clockwise oriented. The orientation test is reduced to the computation of the determinant of a 2x2 matrix, the implementation of which is delegated to a determinant computer.

Basic usage:

...
typedef Z2i::Point Point;
typedef Simple2x2DetComputer<Z2i::Integer> DeterminantComputer;
typedef InHalfPlaneBy2x2DetComputer<Point, DeterminantComputer> MyType;
MyType orientationTest;
orientationTest.init( Point(0,0), Point(5,2) );
return orientationTest( Point(2,1) );
//a strictly positive value is returned because (0,0) (5,2) (2,1) are CCW oriented
Space::Point Point
Definition: StdDefs.h:95
Template Parameters
TPointa model of point
TDetComputera model of C2x2DetComputer

NB: The robustness of the computation depends on the robustness of the determinant computer. However, in order to be sure that the result will be exact, you should be sure that the chosen determinant computer can safely deal with integers coded with b+1 bits if the points coordinates are coded with b bits.

See also
Simple2x2DetComputer SimpleIncremental2x2DetComputer AvnaimEtAl2x2DetComputer FilteredDetComputer

Definition at line 92 of file InHalfPlaneBy2x2DetComputer.h.

Member Typedef Documentation

◆ ArgumentInteger

template<typename TPoint , typename TDetComputer >
typedef TDetComputer::ArgumentInteger DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::ArgumentInteger

Type of input integers for the determinant computer

NB: the type of the points coordinates are casted into ArgumentInteger before being passed to the determinant computer.

Definition at line 127 of file InHalfPlaneBy2x2DetComputer.h.

◆ DetComputer

template<typename TPoint , typename TDetComputer >
typedef TDetComputer DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::DetComputer

Type of determinant computer

Definition at line 118 of file InHalfPlaneBy2x2DetComputer.h.

◆ Point

template<typename TPoint , typename TDetComputer >
typedef TPoint DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::Point

Type of points

Definition at line 100 of file InHalfPlaneBy2x2DetComputer.h.

◆ PointArray

template<typename TPoint , typename TDetComputer >
typedef std::array<Point,2> DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::PointArray

Type of point array

Definition at line 105 of file InHalfPlaneBy2x2DetComputer.h.

◆ SizeArray

template<typename TPoint , typename TDetComputer >
typedef PointArray::size_type DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::SizeArray

Type used to represent the size of the array

Definition at line 109 of file InHalfPlaneBy2x2DetComputer.h.

◆ Value

template<typename TPoint , typename TDetComputer >
typedef TDetComputer::ResultInteger DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::Value

Type of integer for the result

Definition at line 132 of file InHalfPlaneBy2x2DetComputer.h.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TPoint , typename TDetComputer >
DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::BOOST_CONCEPT_ASSERT ( (C2x2DetComputer< DetComputer >)  )

◆ init() [1/2]

template<typename TPoint , typename TDetComputer >
void DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::init ( const Point aP,
const Point aQ 
)

Initialisation.

Parameters
aPfirst point
aQsecond point

◆ init() [2/2]

template<typename TPoint , typename TDetComputer >
void DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::init ( const PointArray aA)

Initialisation.

Parameters
aAarray of two points

◆ isValid()

template<typename TPoint , typename TDetComputer >
bool DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ operator()()

template<typename TPoint , typename TDetComputer >
Value DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::operator() ( const Point aR) const

Main operator.

Warning
InHalfPlaneBy2x2DetComputer::init() should be called before
Parameters
aRany point to test
Returns
orientation of the three points aP aQ aR :
  • zero if the three points belong to the same line
  • strictly positive if the three points are counter-clockwise oriented
  • striclty negative if the three points are clockwise oriented
See also
InHalfPlaneBy2x2DetComputer::init()

◆ selfDisplay()

template<typename TPoint , typename TDetComputer >
void DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

◆ myA

template<typename TPoint , typename TDetComputer >
ArgumentInteger DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::myA
private

Coordinates of the first point.

Definition at line 189 of file InHalfPlaneBy2x2DetComputer.h.

◆ myB

template<typename TPoint , typename TDetComputer >
ArgumentInteger DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::myB
private

Definition at line 189 of file InHalfPlaneBy2x2DetComputer.h.

◆ myDetComputer

template<typename TPoint , typename TDetComputer >
DetComputer DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::myDetComputer
mutableprivate

A 2x2 determinant computer

Definition at line 193 of file InHalfPlaneBy2x2DetComputer.h.

◆ size

template<typename TPoint , typename TDetComputer >
const SizeArray DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer >::size = 2
static

static size of the array, ie. 2

Definition at line 113 of file InHalfPlaneBy2x2DetComputer.h.


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