DGtal  1.5.beta
DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed > Class Template Reference

#include <DGtal/shapes/fromPoints/Point2ShapePredicate.h>

Public Types

typedef TSurface::Point Point
 
typedef TSurface::Distance Distance
 

Public Member Functions

 Point2ShapePredicate (const TSurface &aSurface)
 
 Point2ShapePredicate (const Point2ShapePredicate &other)
 
Point2ShapePredicateoperator= (const Point2ShapePredicate &other)=default
 
bool operator() (const Point &p) const
 
void selfDisplay (std::ostream &out) const
 
 ~Point2ShapePredicate ()
 

Private Attributes

TSurface myS
 

Detailed Description

template<typename TSurface, bool isUpward, bool isClosed>
class DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >

 \brief Aim: Predicate returning 'true' iff a given point is in 
 the 'interior' of a given shape, 'false' otherwise

 @tparam TSurface  a type that is a model of COrientableHypersurface.
 Must separate the space in two disjoints parts (the 'interior' and the 'exterior')
 and must be able to return for any given point (of type TSurface::Point) 
 the signed distance to itself (of type TSurface::Distance) by a method called signedDistance() 
 @tparam isUpward  a bool for the orientation ('true' means that the interior 
 is the set of points of positive distance)
 @tparam isClosed  a bool for the closure ('true' means that the surface is included)

 For instance, in 2d, you can define four shapes from one straight line of equation @f$ y = ax + b @f$:
  • the set \( \{(x,y) | y > ax + b \} \)
  • \( \{(x,y) | y \geq ax + b \} \)
  • \( \{(x,y) | y < ax + b \} \)
  • \( \{(x,y) | y \leq ax + b \} \)

    The second set can be defined as follows:

    typedef Point2ShapePredicate<StraightLine,true,true> UpClosedHalfPlane;

    Then, you can create and use your half-plane as shown below:

    //line is an instance of StraightLine
    UpClosedHalfPlane hp(line);
    trace.info() << hp << std::endl;
    trace.info() << "Does " << r1 << " belongs to hp (no)?" << std::endl;
    REQUIRE( !hp(r1) );
    std::ostream & info()
    Trace trace
    Definition: Common.h:153
    REQUIRE(domain.isInside(aPoint))

    You should get:

    [StraightLine] passing through:
    [PointVector] {0, 0}[PointVector] {5, 2}
    (upward oriented, closed)
    Does [PointVector] {2, 0} belongs to hp (no)?
    no
    Point2ShapePredicate(const TSurface &aSurface)

    This class is a model of concepts::CPointPredicate.

    See also
    testHalfPlane.cpp

Definition at line 95 of file Point2ShapePredicate.h.

Member Typedef Documentation

◆ Distance

template<typename TSurface , bool isUpward, bool isClosed>
typedef TSurface::Distance DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::Distance

Definition at line 101 of file Point2ShapePredicate.h.

◆ Point

template<typename TSurface , bool isUpward, bool isClosed>
typedef TSurface::Point DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::Point

Definition at line 100 of file Point2ShapePredicate.h.

Constructor & Destructor Documentation

◆ Point2ShapePredicate() [1/2]

template<typename TSurface , bool isUpward, bool isClosed>
DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::Point2ShapePredicate ( const TSurface &  aSurface)

Constructor.

Parameters
aSurfaceany Surface

◆ Point2ShapePredicate() [2/2]

template<typename TSurface , bool isUpward, bool isClosed>
DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::Point2ShapePredicate ( const Point2ShapePredicate< TSurface, isUpward, isClosed > &  other)

Copy constructor.

Parameters
otherthe object to clone.

◆ ~Point2ShapePredicate()

template<typename TSurface , bool isUpward, bool isClosed>
DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::~Point2ShapePredicate ( )

Destructor. Does nothing

Member Function Documentation

◆ operator()()

template<typename TSurface , bool isUpward, bool isClosed>
bool DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::operator() ( const Point p) const
Parameters
pany point.
Returns
true iff p is in the interior of the shape.

◆ operator=()

template<typename TSurface , bool isUpward, bool isClosed>
Point2ShapePredicate& DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::operator= ( const Point2ShapePredicate< TSurface, isUpward, isClosed > &  other)
default

Default assignment operator.

Parameters
otherthe object to copy.

◆ selfDisplay()

template<typename TSurface , bool isUpward, bool isClosed>
void DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

◆ myS

template<typename TSurface , bool isUpward, bool isClosed>
TSurface DGtal::functors::Point2ShapePredicate< TSurface, isUpward, isClosed >::myS
private

The surface with respect to the points have to be located

Definition at line 147 of file Point2ShapePredicate.h.


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