DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes
DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero > Class Template Reference

Aim: Small adapter to models of COrientationFunctor2. It is a model of concepts::CPointPredicate. It is also a ternary predicate on points, useful for basic geometric tasks such as convex hull computation. More...

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

Public Types

typedef TOrientationFunctor Functor
 
typedef Functor::Point Point
 
typedef functors::Thresholder< typename Functor::Value, acceptNeg, acceptZero > MyThresholder
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::COrientationFunctor2< Functor >))
 
 PredicateFromOrientationFunctor2 (Alias< Functor > aFunctor)
 
void init (const Point &aPoint1, const Point &aPoint2)
 
bool operator() (const Point &aPoint) const
 
bool operator() (const Point &aPoint1, const Point &aPoint2, const Point &aPoint3) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Private Attributes

Functor *const myFunctorPtr
 
const MyThresholder myThresholder
 

Detailed Description

template<typename TOrientationFunctor, bool acceptNeg = false, bool acceptZero = false>
class DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >

Aim: Small adapter to models of COrientationFunctor2. It is a model of concepts::CPointPredicate. It is also a ternary predicate on points, useful for basic geometric tasks such as convex hull computation.

Description of template class 'PredicateFromOrientationFunctor2'

Once a orientation functor is defined, you can adapt it as follows:

//geometric predicate
pointPredicate( orientationFunctor );
Aim: Small adapter to models of COrientationFunctor2. It is a model of concepts::CPointPredicate....

The test can be done in one or two separate steps as follows:

//initialization
pointPredicate.init( P, Q );
//which is equivalent to
//orientationFunctor.init( P, Q );
//because the predicate stores a pointer to the functor
//decision
isCCW = pointPredicate( R );
//which is equivalent to the following shortcut:
//isCCW = pointPredicate( P, Q, R );

The default behavior is to return 'true' for strictly positive functor values. You can however custom this behavior with the last two template parameters.

Template Parameters
TOrientationFunctora model of COrientationFunctor2
acceptNegbool equal to 'true' to get a predicate returning 'true' for strictly negative values of the functor, but equal to 'false' to get a predicate returning 'true' for strictly positive values (default).
acceptZerobool equal to 'true' to get a predicate returning 'true' for null values, but equal to 'false' for strictly positive or negative values (default).
Examples
geometry/tools/determinant/exampleInHalfPlane.cpp, geometry/tools/exampleAlphaShape.cpp, and geometry/tools/exampleConvexHull2D.cpp.

Definition at line 81 of file PredicateFromOrientationFunctor2.h.

Member Typedef Documentation

◆ Functor

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
typedef TOrientationFunctor DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::Functor

Type of the adapter orientation functor

Definition at line 88 of file PredicateFromOrientationFunctor2.h.

◆ MyThresholder

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
typedef functors::Thresholder<typename Functor::Value, acceptNeg, acceptZero> DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::MyThresholder

Type of the thresholder, which compares the result of the functor to zero

Definition at line 100 of file PredicateFromOrientationFunctor2.h.

◆ Point

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
typedef Functor::Point DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::Point

Type of input points

Definition at line 94 of file PredicateFromOrientationFunctor2.h.

Constructor & Destructor Documentation

◆ PredicateFromOrientationFunctor2()

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::PredicateFromOrientationFunctor2 ( Alias< Functor aFunctor)

Constructor

Parameters
aFunctorany orientation functor to alias

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::BOOST_CONCEPT_ASSERT ( (concepts::COrientationFunctor2< Functor >)  )

◆ init()

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
void DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::init ( const Point aPoint1,
const Point aPoint2 
)

Initialization of myFunctor

Parameters
aPoint1a first point
aPoint2a second point
Examples
geometry/tools/determinant/exampleInHalfPlane.cpp.

Referenced by basicUsage().

◆ isValid()

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
bool DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ operator()() [1/2]

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
bool DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::operator() ( const Point aPoint) const

Unary parenthesis operator

Parameters
aPointany point
Returns
return value of the thresholder applied on the underlying unary functor

◆ operator()() [2/2]

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
bool DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::operator() ( const Point aPoint1,
const Point aPoint2,
const Point aPoint3 
) const

Ternary parenthesis operator on three points

Parameters
aPoint1first point
aPoint2second point
aPoint3third point
Returns
return value of the thresholder applied on the underlying orientation functor

◆ selfDisplay()

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
void DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

◆ myFunctorPtr

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
Functor* const DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::myFunctorPtr
private

a pointer to an orientation functor

Definition at line 157 of file PredicateFromOrientationFunctor2.h.

◆ myThresholder

template<typename TOrientationFunctor , bool acceptNeg = false, bool acceptZero = false>
const MyThresholder DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::myThresholder
private

object that thresholds the result of the functor

Definition at line 162 of file PredicateFromOrientationFunctor2.h.


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