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:
UpClosedHalfPlane hp(line);
trace.
info() <<
"Does " << r1 <<
" belongs to hp (no)?" << std::endl;
You should get:
[StraightLine] passing through:
[PointVector] {0, 0}[PointVector] {5, 2}
(upward oriented, closed)
Does [PointVector] {2, 0} belongs to hp (no)?
no
This class is a model of concepts::CPointPredicate.
- See also
- testHalfPlane.cpp
Definition at line 95 of file Point2ShapePredicate.h.