This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
- Author
- Jacques-Olivier Lachaud (
jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr
) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
- Date
- 2017/02/06
Functions for testing class IndexedDigitalSurface.
This file is part of the DGtal library.
Definition in file testIndexedDigitalSurface.cpp.
SCENARIO |
( |
"IndexedDigitalSurface< DigitalSetBoundary > build tests" |
, |
|
|
"" |
[idxdsurf][build] |
|
) |
| |
Definition at line 54 of file testIndexedDigitalSurface.cpp.
58 Point p1( -5, -5, -5 );
61 K.
init( p1, p2,
true );
65 bool build_ok = dsurf.build(
new DigitalSurfaceContainer(
K, aSet ) );
66 GIVEN(
"A digital set boundary over a ball of radius 3" ) {
67 THEN(
"Build of underlying half-edge data structure should be ok" ) {
70 THEN(
"The indexed digital surface has 174 vertices, 348 edges, 176 edges, and Euler=2 as the sphere" ) {
71 REQUIRE( dsurf.nbVertices() == 174 );
72 REQUIRE( dsurf.nbEdges() == 348 );
73 REQUIRE( dsurf.nbFaces() == 176 );
76 THEN(
"All vertices have 4 neighbors" ) {
77 REQUIRE( dsurf.degree( 0 ) == 4 );
78 REQUIRE( dsurf.degree( 17 ) == 4 );
79 REQUIRE( dsurf.degree( 54) == 4 );
80 REQUIRE( dsurf.degree( 102 ) == 4 );
82 THEN(
"Vertices corresponds to surfels, Arcs to linels, Faces to pointels" ) {
90 THEN(
"Linels of opposite arcs are opposite cells" ) {
91 REQUIRE(
K.
sOpp( dsurf.linel( 15 ) ) == dsurf.linel( dsurf.opposite( 15 ) ) );
92 REQUIRE(
K.
sOpp( dsurf.linel( 34 ) ) == dsurf.linel( dsurf.opposite( 34 ) ) );
93 REQUIRE(
K.
sOpp( dsurf.linel( 112 ) ) == dsurf.linel( dsurf.opposite( 112 ) ) );
94 REQUIRE(
K.
sOpp( dsurf.linel( 200 ) ) == dsurf.linel( dsurf.opposite( 200 ) ) );
96 THEN(
"Breadth-first visiting the digital surface from vertex 0 goes to a distance 13." ) {
99 std::vector<int> distances;
100 while ( ! visitor.finished() )
102 vertices.push_back( visitor.current().first );
103 distances.push_back( visitor.current().second );
107 REQUIRE( distances.size() == 174 );
108 REQUIRE( distances.back() == 13 );
Aim: This class is useful to perform a breadth-first exploration of a graph given a starting point or...
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: Represents a digital surface with the topology of its dual surface. Its aim is to mimick the sta...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
SCell sOpp(const SCell &p) const
Creates the signed cell with the inverse sign of [p].
Dimension sDim(const SCell &p) const
Return the dimension of the cell [p].
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
std::pair< typename graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::vertex_iterator, typename graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::vertex_iterator > vertices(const DGtal::DigitalSurface< TDigitalSurfaceContainer > &digSurf)
GIVEN("A cubical complex with random 3-cells")
HyperRectDomain< Space > Domain
REQUIRE(domain.isInside(aPoint))
References DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::current(), DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::expand(), DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::finished(), GIVEN(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::sDim(), and DGtal::KhalimskySpaceND< dim, TInteger >::sOpp().