DGtal  0.9.4beta
Public Types | Public Member Functions | Static Public Attributes | Private Attributes
DGtal::InHalfPlaneBy2x2DetComputer< TPoint, TDetComputer > Class Template Reference

#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:

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
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
Examples:
geometry/tools/determinant/exampleInHalfPlane.cpp.

Definition at line 92 of file InHalfPlaneBy2x2DetComputer.h.

Member Typedef Documentation

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.

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

Type of determinant computer

Definition at line 118 of file InHalfPlaneBy2x2DetComputer.h.

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

Type of points

Definition at line 100 of file InHalfPlaneBy2x2DetComputer.h.

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.

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.

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

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

Initialisation.

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

Initialisation.

Parameters
aAarray of two points
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.
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()
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

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.

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

Definition at line 189 of file InHalfPlaneBy2x2DetComputer.h.

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

A 2x2 determinant computer

Definition at line 193 of file InHalfPlaneBy2x2DetComputer.h.

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: