34 #include "DGtal/base/Common.h"
35 #include "DGtal/kernel/SpaceND.h"
36 #include "DGtal/geometry/volumes/BoundedLatticePolytope.h"
37 #include "DGtal/geometry/volumes/BoundedLatticePolytopeCounter.h"
38 #include "DGtalCatch.h"
42 using namespace DGtal;
49 SCENARIO(
"BoundedLatticePolytopeCounter< Z2 > unit tests",
"[lattice_polytope][2d]" )
56 GIVEN(
"A triangle P at (0,3), (5,0), (15,7)" ) {
60 Polytope P { a, b, c };
61 int nbInside = P.count();
62 int nbInterior = P.countInterior();
64 int nb0 = C.countAlongAxis( 0 );
65 int nb1 = C.countAlongAxis( 1 );
66 int nb0_int = C.countInteriorAlongAxis( 0 );
67 int nb1_int = C.countInteriorAlongAxis( 1 );
68 THEN(
"Its longest axis is 0" )
70 REQUIRE( C.longestAxis() == 0 );
72 THEN(
"We can count its points per point or per axis" )
77 THEN(
"We can count its interior points per point or per axis" )
79 REQUIRE( nbInterior == nb0_int );
80 REQUIRE( nbInterior == nb1_int );
85 SCENARIO(
"BoundedLatticePolytope< Z3 > unit tests",
"[lattice_polytope][3d]" )
92 GIVEN(
"A closed arbitrary simplex P at (0,0,0), (6,3,0), (0,5,-10), (-6,4,8)" ) {
97 Polytope P { a, b, c, d };
98 int nbInside = P.count();
99 int nbInterior = P.countInterior();
101 int nb0 = C.countAlongAxis( 0 );
102 int nb1 = C.countAlongAxis( 1 );
103 int nb2 = C.countAlongAxis( 2 );
104 int nb0_int = C.countInteriorAlongAxis( 0 );
105 int nb1_int = C.countInteriorAlongAxis( 1 );
106 int nb2_int = C.countInteriorAlongAxis( 2 );
108 THEN(
"Its longest axis is 2" )
110 REQUIRE( C.longestAxis() == 2 );
112 THEN(
"We can count its points per point or per axis" )
118 THEN(
"We can count its interior points per point or per axis" )
120 REQUIRE( nbInterior == nb0_int );
121 REQUIRE( nbInterior == nb1_int );
122 REQUIRE( nbInterior == nb2_int );
Aim: Useful to compute quickly the lattice points within a polytope, i.e. a convex polyhedron.
Aim: Represents an nD lattice polytope, i.e. a convex polyhedron bounded with vertices with integer c...
DGtal is the top-level namespace which contains all DGtal functions and types.
SCENARIO("BoundedLatticePolytopeCounter< Z2 > unit tests", "[lattice_polytope][2d]")
GIVEN("A cubical complex with random 3-cells")
REQUIRE(domain.isInside(aPoint))