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

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

Inheritance diagram for DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >:
[legend]
Collaboration diagram for DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >:
[legend]

Public Types

typedef TPoint Point
 
typedef std::array< Point, 2 > PointArray
 
typedef PointArray::size_type SizeArray
 
typedef TInteger Integer
 
typedef SimpleMatrix< Integer, 3, 3 > Matrix
 
typedef Integer Value
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CEuclideanRing< Integer >))
 
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

Matrix myMatrix
 

Detailed Description

template<typename TPoint, typename TInteger>
class DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >

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 InHalfPlaneBySimple3x3Matrix<Point, Z2i::Integer> 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
TIntegera model of integer for the 3x3 matrix entries and the result, at least a model of CEuclideanRing

NB. In order to be sure that the result will be exact, you should be sure that TInteger can represent integers with 2b+3 bits if the points coordinates are coded with b bits.

See also
SimpleMatrix
InHalfPlaneBy2x2DetComputer
Examples:
geometry/tools/determinant/exampleInHalfPlane.cpp, geometry/tools/exampleAlphaShape.cpp, and geometry/tools/exampleConvexHull2D.cpp.

Definition at line 91 of file InHalfPlaneBySimple3x3Matrix.h.

Member Typedef Documentation

template<typename TPoint, typename TInteger>
typedef TInteger DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::Integer

Type of matrix integral entries

NB: the type of the points coordinates are casted into Integer before being stored into the matrix.

Definition at line 120 of file InHalfPlaneBySimple3x3Matrix.h.

template<typename TPoint, typename TInteger>
typedef SimpleMatrix<Integer, 3, 3> DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::Matrix

Type of matrix

Definition at line 126 of file InHalfPlaneBySimple3x3Matrix.h.

template<typename TPoint, typename TInteger>
typedef TPoint DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::Point

Type of points

Definition at line 99 of file InHalfPlaneBySimple3x3Matrix.h.

template<typename TPoint, typename TInteger>
typedef std::array<Point,2> DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::PointArray

Type of point array

Definition at line 104 of file InHalfPlaneBySimple3x3Matrix.h.

template<typename TPoint, typename TInteger>
typedef PointArray::size_type DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::SizeArray

Type used to represent the size of the array

Definition at line 108 of file InHalfPlaneBySimple3x3Matrix.h.

template<typename TPoint, typename TInteger>
typedef Integer DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::Value

Type of integer for the result

Definition at line 131 of file InHalfPlaneBySimple3x3Matrix.h.

Member Function Documentation

template<typename TPoint, typename TInteger>
DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::BOOST_CONCEPT_ASSERT ( (concepts::CEuclideanRing< Integer >)  )
template<typename TPoint, typename TInteger>
void DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::init ( const Point aP,
const Point aQ 
)

Initialisation. The first two column vectors are stored into myMatrix

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

Initialisation. The first two column vectors are stored into myMatrix

Parameters
aAarray of two points
template<typename TPoint, typename TInteger>
bool DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TPoint, typename TInteger>
Value DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::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 TInteger>
void DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::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 TInteger>
Matrix DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::myMatrix
mutableprivate

3x3 matrix whose determinant provides the expected result

Definition at line 179 of file InHalfPlaneBySimple3x3Matrix.h.

template<typename TPoint, typename TInteger>
const SizeArray DGtal::InHalfPlaneBySimple3x3Matrix< TPoint, TInteger >::size = 2
static

static size of the array, ie. 2

Definition at line 112 of file InHalfPlaneBySimple3x3Matrix.h.


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