53SCENARIO(
"PConvexity< Z2 > P-convexity tests",
"[p_convexity][2d]" )
62 REQUIRE( pconv.is0Convex( V1 ) );
63 REQUIRE( pconv.isPConvex( V1 ) );
64 REQUIRE( pconv.convexityMeasure( V1 ) == 1.0 );
65 REQUIRE( pconv.fullConvexityMeasure( V1 ) == 1.0 );
67 REQUIRE( ! pconv.is0Convex( V2 ) );
68 REQUIRE( ! pconv.isPConvex( V2 ) );
69 REQUIRE( pconv.convexityMeasure( V2 ) < 1.0 );
70 REQUIRE( pconv.fullConvexityMeasure( V2 ) < 1.0 );
72 REQUIRE( pconv.is0Convex( V3 ) );
73 REQUIRE( pconv.isPConvex( V3 ) );
74 REQUIRE( pconv.convexityMeasure( V3 ) == 1.0 );
75 REQUIRE( pconv.fullConvexityMeasure( V3 ) == 1.0 );
78 REQUIRE( pconv.is0Convex( V4 ) );
79 REQUIRE( pconv.isPConvex( V4 ) );
81 REQUIRE( pconv.is0Convex( V5 ) );
82 REQUIRE( ! pconv.isPConvex( V5 ) );
83 REQUIRE( pconv.convexityMeasure( V5 ) == 1.0 );
84 REQUIRE( pconv.fullConvexityMeasure( V5 ) < 1.0 );
148SCENARIO(
"DigitalConvexity< Z3 > fully convex and p-convex tetrahedra",
"[p_convexity][full_convexity][convex_simplices][3d]" )
158 DConvexity dconv(
Point( -1, -1, -1 ),
Point( 4, 4, 4 ) );
161 WHEN(
"Computing many tetrahedra in domain (0,0,0)-(4,4,4)." ) {
162 const unsigned int nb = 100;
163 unsigned int nbsimplex= 0;
164 unsigned int nb0 = 0;
165 unsigned int nb1 = 0;
166 unsigned int nb2 = 0;
167 unsigned int nb3 = 0;
168 unsigned int nb012_not3 = 0;
169 unsigned int nbf = 0;
170 unsigned int nbfg = 0;
171 unsigned int nbffast = 0;
172 unsigned int nbp = 0;
173 unsigned int nb0123 = 0;
174 for (
unsigned int i = 0; i < nb; ++i )
176 Point a( rand() % 5, rand() % 5, rand() % 5 );
177 Point b( rand() % 5, rand() % 5, rand() % 5 );
178 Point c( rand() % 5, rand() % 5, rand() % 5 );
179 Point d( rand() % 5, rand() % 5, rand() % 5 );
180 if ( ! dconv.isSimplexFullDimensional( { a, b, c, d } ) )
continue;
181 auto tetra = dconv.makeSimplex( { a, b, c, d } );
182 std::vector< Point > X;
183 tetra.getPoints( X );
184 bool cvx0 = dconv.isKConvex( tetra, 0 );
185 bool cvx1 = dconv.isKConvex( tetra, 1 );
186 bool cvx2 = dconv.isKConvex( tetra, 2 );
187 bool cvx3 = dconv.isKConvex( tetra, 3 );
188 bool cvxf = dconv.isFullyConvex( tetra );
189 bool cvxfg = dconv.isFullyConvex( X,
false );
190 bool cvxffast = dconv.isFullyConvexFast( X );
192 if ( cvxf != cvxfg || cvxf != cvxffast || cvxf != cvxp ) {
193 std::cout <<
"[" << cvx0 << cvx1 << cvx2 << cvx3 <<
"] "
194 <<
"[" << cvxf <<
"] [" << cvxfg
195 <<
"] [" << cvxffast <<
"]"
196 <<
"] [" << cvxp <<
"]"
197 << a << b << c << d << std::endl;
205 nbfg += cvxfg ? 1 : 0;
206 nbffast += cvxffast ? 1 : 0;
208 nb0123 += ( cvx0 && cvx1 && cvx2 && cvx3 ) ? 1 : 0;
209 nb012_not3+= ( cvx0 && cvx1 && cvx2 && ! cvx3 ) ? 1 : 0;
211 THEN(
"All valid tetrahedra are 0-convex." ) {
214 THEN(
"There are less 1-convex, 2-convex and 3-convex than 0-convex." ) {
219 THEN(
"When the tetrahedron is 0-convex, 1-convex and 2-convex, then it is 3-convex, so fully convex and also P-convex." ) {
226 THEN(
"All methods for computing full convexity and P-convexity agree." ) {