29#if defined(SymmetricConvexExpander_RECURSES)
30#error Recursive header files inclusion detected in SymmetricConvexExpander.h
33#define SymmetricConvexExpander_RECURSES
35#if !defined SymmetricConvexExpander_h
37#define SymmetricConvexExpander_h
42#include "DGtal/base/Common.h"
43#include "DGtal/topology/CCellularGridSpaceND.h"
44#include "DGtal/geometry/volumes/DigitalConvexity.h"
62 template <
typename TKSpace,
63 typename TPointPredicate >
85 typedef std::pair< Point, Integer >
Node;
94 return p.second > q.second;
102 const Point& kcenter,
136 const auto n = points.
size();
140 for (
auto i = 0; i < n; i++ )
141 points[ i ][ k ] = y / 2;
145 points.resize( 2*n );
146 const auto z = (y-1)/2;
147 const auto z1 = z + 1;
148 for (
auto i = 0; i < n; i++ )
150 points[ i ][ k ] = z;
151 Point q = points[ i ];
158 for (
auto&& p : points )
161 if ( !
myM.count( p )
177 const auto p =
current().first;
233 const auto next_points =
next( p );
234 for (
auto&& q : next_points )
236 if ( !
myM.count( q ) )
251 else if ( ( q_in && ! sq_in ) || ( ! q_in && sq_in ) )
279 if ( d[ i ] >= 0 ) N.push_back( p +
Point::base( i, 1 ) );
280 if ( d[ i ] <= 0 ) N.push_back( p -
Point::base( i, 1 ) );
Aim: Represents an nD rational polytope, i.e. a convex polyhedron bounded by vertices with rational c...
Aim: A helper class to build polytopes from digital sets and to check digital k-convexity and full co...
bool isFullyConvex(const PointRange &X, bool convex0=false) const
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
static const constexpr Dimension dimension
static Self base(Dimension k, Component val=1)
Aim: SymmetricConvexExpander computes symmetric fully convex subsets of a given digital set.
std::vector< Point > PointRange
std::unordered_set< Point > PointSet
SymmetricConvexExpander(const PointPredicate &predicate, const Point &kcenter, const Point &lo, const Point &hi)
Constructor from predicate and symmetry center point.
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal::BoundedRationalPolytope< Space > RationalPolytope
DGtal::BoundedLatticePolytope< Space > LatticePolytope
PointRange next(const Point &p) const
std::pair< Point, Integer > Node
void init(const Point &kcenter)
const PointPredicate * myPredicate
The predicate that every point must satisfy.
Point symmetric(const Point &p) const
TPointPredicate PointPredicate
static const Dimension dimension
PointSet myM
Marked points, i.e. points already in the queue or in the object.
bool predicate(const Point &p) const
Point myKCenter
Symmetry center (with doubled coordinates to represent half-integers).
const Node & current() const
bool advance(bool enforce_full_convexity)
Advance of one symmetric point.
std::vector< Vector > VectorRange
std::priority_queue< Node, std::vector< Node >, NodeComparator > NodeQueue
DigitalConvexity< KSpace > myConvexity
The digital convexity object.
bool myPerfectSymmetry
True iff the set and its local complement are symmetric.
Integer myPerfectSymmetryRadius
Upper bound on the max distance of perfect symmetry.
DigitalConvexity< TKSpace > Self
PointSet myPoints
Symmetric range of lattice points, sorted.
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
NodeComparator()=default
Default constructor.
bool operator()(const Node &p, const Node &q) const
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...