31#if defined(BoundedLatticePolytope_RECURSES)
32#error Recursive header files inclusion detected in BoundedLatticePolytope.h
35#define BoundedLatticePolytope_RECURSES
37#if !defined BoundedLatticePolytope_h
39#define BoundedLatticePolytope_h
47#include "DGtal/base/Common.h"
48#include "DGtal/kernel/CSpace.h"
49#include "DGtal/kernel/domains/HyperRectDomain.h"
50#include "DGtal/arithmetic/IntegerComputer.h"
51#include "DGtal/arithmetic/ClosedIntegerHalfPlane.h"
72 template <
typename TSpace >
125 :
dims( l.begin(), l.end() ) {}
138 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
133 friend std::ostream& {
…}
152 :
dims( l.begin(), l.end() ) {}
165 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
160 friend std::ostream& {
…}
179 :
dims( l.begin(), l.end() ) {}
192 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
187 friend std::ostream& {
…}
234 template <
typename Po
intIterator>
256 template <
typename HalfSpaceIterator>
258 HalfSpaceIterator itB, HalfSpaceIterator itE,
259 bool valid_edge_constraints =
false,
260 bool check_duplicate_constraints =
false );
281 template <
typename HalfSpaceIterator>
283 HalfSpaceIterator itB, HalfSpaceIterator itE,
284 bool valid_edge_constraints =
false,
285 bool check_duplicate_constraints =
false );
300 template <
typename Po
intIterator>
301 bool init( PointIterator itB, PointIterator itE );
363 const std::vector<bool>&
getI()
const;
446 bool valid_edge_constraint =
false );
465 bool valid_edge_constraint =
false );
664 template <
typename Po
intSet>
683 template <
typename Po
intSet>
797 template <
typename Po
intSet>
881 template <DGtal::Dimension N,
typename TInteger>
904 const std::vector<Point>& )
906 trace.error() <<
"[BoundedLatticePolytopeHelper::addEdgeConstraint]"
907 <<
" this method is only implemented in 3D." << std::endl;
915 trace.error() <<
"[BoundedLatticePolytopeHelper::crossProduct]"
916 <<
" this method is only implemented in 3D." << std::endl;
928 template <
typename TInteger>
948 const std::vector<Point>& pts )
950 Vector ab = pts[ i ] - pts[ j ];
951 for (
int s = 0; s < 2; s++ )
956 std::size_t nb_in = 0;
957 for (
auto p : pts ) {
959 if ( v < b ) nb_in++;
961 if ( nb_in == pts.size() - 2 ) {
962 P.
cut( n, b,
true,
true );
987 template <
typename TSpace>
998 template <
typename TSpace>
1011 template <
typename TSpace>
1023 template <
typename TSpace>
1035 template <
typename TSpace>
1047 template <
typename TSpace>
1059 template <
typename TSpace>
1071 template <
typename TSpace>
1083#include "BoundedLatticePolytope.ih"
1090#undef BoundedLatticePolytope_RECURSES
void init(const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false, bool check_duplicate_constraints=false)
Self & operator*=(Integer t)
Integer countWithin(Point low, Point hi) const
void getInteriorPoints(std::vector< Point > &pts) const
Integer countBoundary() const
unsigned int nbHalfSpaces() const
BoundedLatticePolytope(PointIterator itB, PointIterator itE)
void getInteriorPointsByScanning(std::vector< Point > &pts) const
bool isInside(const Point &p) const
Integer countByScanning() const
BoundedLatticePolytope(const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false, bool check_duplicate_constraints=false)
Integer getB(unsigned int i) const
BoundedLatticePolytope(const Self &other)=default
Self & operator+=(UnitCell c)
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
BoundedLatticePolytope()=default
Integer countInteriorByScanning() const
void getKPoints(std::vector< Point > &pts, const Point &alpha_shift) const
void clear()
Clears the polytope.
unsigned int cut(Dimension k, bool pos, Integer b, bool large=true)
ClosedIntegerHalfPlane< Space > HalfSpace
Integer countUpToByScanning(Integer max) const
void swap(BoundedLatticePolytope &other)
bool isLarge(unsigned int i) const
unsigned int cut(const Vector &a, Integer b, bool large=true, bool valid_edge_constraint=false)
std::vector< Vector > InequalityMatrix
bool init(PointIterator itB, PointIterator itE)
bool internalInitFromSegment2D(Point a, Point b)
const InequalityVector & getB() const
~BoundedLatticePolytope()=default
Self & operator+=(LeftStrictUnitCell c)
BoundedLatticePolytope interiorPolytope() const
unsigned int cut(const HalfSpace &hs, bool large=true, bool valid_edge_constraint=false)
Integer countBoundaryByScanning() const
std::vector< Integer > InequalityVector
BoundedLatticePolytope< TSpace > Self
bool internalInitFromTriangle3D(Point a, Point b, Point c)
void getBoundaryPoints(std::vector< Point > &pts) const
Integer countWithinByScanning(Point low, Point hi) const
bool isBoundary(const Point &p) const
const Domain & getDomain() const
void getPointsByScanning(std::vector< Point > &pts) const
void selfDisplay(std::ostream &out) const
Self & operator+=(RightStrictUnitCell c)
const Vector & getA(unsigned int i) const
const std::vector< bool > & getI() const
DGtal::BigInteger BigInteger
HyperRectDomain< Space > Domain
void insertKPoints(PointSet &pts_set, const Point &alpha_shift) const
void getBoundaryPointsByScanning(std::vector< Point > &pts) const
std::string className() const
bool internalInitFromSegment3D(Point a, Point b)
Integer countUpTo(Integer max) const
Self & operator+=(RightStrictUnitSegment s)
bool isDomainPointInside(const Point &p) const
Self & operator+=(LeftStrictUnitSegment s)
static const Dimension dimension
Self & operator+=(UnitSegment s)
BoundedLatticePolytope(std::initializer_list< Point > l)
bool myValidEdgeConstraints
const InequalityMatrix & getA() const
Self & operator=(const Self &other)=default
BoundedLatticePolytope closurePolytope() const
Integer countInterior() const
bool isInterior(const Point &p) const
void insertPointsByScanning(PointSet &pts_set) const
void insertPoints(PointSet &pts_set) const
void getPoints(std::vector< Point > &pts) const
static Self base(Dimension k, Component val=1)
auto dot(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::dotProduct(*this, v))
Dot product with a PointVector.
auto crossProduct(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::crossProduct(*this, v))
Cross product with a PointVector.
PointVector< dim, Integer > Point
static const Dimension dimension
PointVector< dim, Integer > Vector
detail namespace gathers internal classes and functions.
DGtal is the top-level namespace which contains all DGtal functions and types.
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
Circulator< TIterator > operator+(typename IteratorCirculatorTraits< TIterator >::Difference d, Circulator< TIterator > &object)
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>, boost::multiprecision::et_off > BigInteger
std::vector< Dimension > dims
friend std::ostream & operator<<(std::ostream &out, const LeftStrictUnitCell &object)
LeftStrictUnitCell(std::initializer_list< Dimension > l)
LeftStrictUnitSegment(Dimension d)
std::vector< Dimension > dims
RightStrictUnitCell(std::initializer_list< Dimension > l)
friend std::ostream & operator<<(std::ostream &out, const RightStrictUnitCell &object)
RightStrictUnitSegment(Dimension d)
std::vector< Dimension > dims
friend std::ostream & operator<<(std::ostream &out, const UnitCell &object)
UnitCell(std::initializer_list< Dimension > l)
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
static void addEdgeConstraint(Polytope &P, unsigned int i, unsigned int j, const std::vector< Point > &pts)
BoundedLatticePolytope< Space > Polytope
static const Dimension dimension
SpaceND< 3, Integer > Space
static Vector crossProduct(const Vector &v1, const Vector &v2)
Aim: It is just a helper class for BoundedLatticePolytope to add dimension specific static methods.
static Vector crossProduct(const Vector &, const Vector &)
static void addEdgeConstraint(Polytope &, unsigned int, unsigned int, const std::vector< Point > &)
SpaceND< N, Integer > Space
static const Dimension dimension
BoundedLatticePolytope< Space > Polytope