DGtal
1.2.0
|
#include <cstddef>
#include <algorithm>
#include "DGtal/base/Common.h"
#include "DGtal/kernel/SpaceND.h"
#include "DGtal/kernel/domains/HyperRectDomain.h"
#include "DGtal/topology/KhalimskySpaceND.h"
#include "DGtal/topology/KhalimskyPreSpaceND.h"
#include "DGtal/topology/CCellularGridSpaceND.h"
#include "DGtal/topology/CPreCellularGridSpaceND.h"
#include "DGtal/topology/SurfelAdjacency.h"
#include "DGtal/topology/SurfelNeighborhood.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/topology/helpers/Surfaces.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/io/Color.h"
#include "DGtalCatch.h"
Go to the source code of this file.
Functions | |
template<typename KSpace > | |
void | testScan (KSpace const &K, typename KSpace::Point const &low, typename KSpace::Point const &high) |
template<typename KSpace , typename Cells > | |
void | cmpUCellsIfInside (KSpace const &K, typename KSpace::Cells const &u, Cells const &v) |
template<typename KSpace , typename Cells > | |
void | cmpSCellsIfInside (KSpace const &K, typename KSpace::SCells const &u, Cells const &v) |
template<typename KSpace > | |
void | testNeighborhood (KSpace const &K, typename KSpace::Point const &aPoint) |
template<typename KSpace > | |
void | testFaces (KSpace const &K, typename KSpace::Point const &aPoint) |
template<typename KSpace > | |
void | testIncidence (KSpace const &K, typename KSpace::Point const &aPoint) |
template<typename KSpace > | |
void | testDirectIncidence (KSpace const &K, typename KSpace::Point const &aPoint) |
template<typename KSpace > | |
void | testSurfelAdjacency (KSpace const &K) |
template<typename KSpace > | |
void | testCellDrawOnBoard (KSpace const &K) |
template<typename KSpace > | |
void | testFindABel (KSpace const &K) |
template<typename KSpace > | |
void | testCellularGridSpaceNDFaces (KSpace const &K) |
template<typename KSpace > | |
void | testCellularGridSpaceNDCoFaces (KSpace const &K) |
TEST_CASE ("Checking concepts") | |
TEST_CASE ("2D Khalimsky pre-space", "[KPreSpace][2D]") | |
TEST_CASE ("3D Khalimsky pre-space", "[KPreSpace][3D]") | |
TEST_CASE ("4D Khalimsky pre-space", "[KPreSpace][4D]") | |
TEST_CASE ("3D closed Khalimsky space", "[KSpace][3D][closed]") | |
TEST_CASE ("2D closed Khalimsky space", "[KSpace][2D][closed]") | |
TEST_CASE ("4D closed Khalimsky space", "[KSpace][4D][closed]") | |
TEST_CASE ("2D open Khalimsky space", "[KSpace][2D][open]") | |
TEST_CASE ("3D open Khalimsky space", "[KSpace][3D][open]") | |
TEST_CASE ("2D periodic Khalimsky space", "[KSpace][2D][periodic]") | |
TEST_CASE ("3D periodic Khalimsky space", "[KSpace][3D][periodic]") | |
TEST_CASE ("2D mixed Khalimsky space", "[KSpace][2D][closed][periodic]") | |
TEST_CASE ("3D mixed Khalimsky space", "[KSpace][3D][closed][periodic][open]") | |
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/.
Functions for testing classes KhalimskySpaceND and KhalimskyPreSpaceND.
This file is part of the DGtal library.
Definition in file testKhalimskySpaceND.cpp.
void cmpSCellsIfInside | ( | KSpace const & | K, |
typename KSpace::SCells const & | u, | ||
Cells const & | v | ||
) |
Comparing signed cells list that are inside a Khalimsky space.
KSpace | the Khalimsky space type. |
Cells | the second signed cell list. |
K | the Khalimsky space. |
u | an signed cell list from K. |
v | an signed cell list from an another Khalimsky space. |
Definition at line 170 of file testKhalimskySpaceND.cpp.
References cnt, K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), and DGtal::KhalimskySpaceND< dim, TInteger >::sIsInside().
Referenced by testNeighborhood().
void cmpUCellsIfInside | ( | KSpace const & | K, |
typename KSpace::Cells const & | u, | ||
Cells const & | v | ||
) |
Comparing unsigned cells list that are inside a Khalimsky space.
KSpace | the Khalimsky space type. |
Cells | the second unsigned cell list. |
K | the Khalimsky space. |
u | an unsigned cell list from K. |
v | an unsigned cell list from an another Khalimsky space. |
Definition at line 136 of file testKhalimskySpaceND.cpp.
References cnt, K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::uCell(), and DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside().
Referenced by testFaces(), and testNeighborhood().
TEST_CASE | ( | "2D closed Khalimsky space" | , |
"" | [KSpace][2D][closed] | ||
) |
Definition at line 782 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::CLOSED, DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, REQUIRE(), testCellDrawOnBoard(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "2D Khalimsky pre-space" | , |
"" | [KPreSpace][2D] | ||
) |
Definition at line 720 of file testKhalimskySpaceND.cpp.
References K, testCellDrawOnBoard(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testIncidence(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "2D mixed Khalimsky space" | , |
"" | [KSpace][2D][closed][periodic] | ||
) |
Definition at line 902 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::CLOSED, DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::PERIODIC, REQUIRE(), testCellDrawOnBoard(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "2D open Khalimsky space" | , |
"" | [KSpace][2D][open] | ||
) |
Definition at line 822 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::OPEN, REQUIRE(), testCellDrawOnBoard(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "2D periodic Khalimsky space" | , |
"" | [KSpace][2D][periodic] | ||
) |
Definition at line 862 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::PERIODIC, REQUIRE(), testCellDrawOnBoard(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "3D closed Khalimsky space" | , |
"" | [KSpace][3D][closed] | ||
) |
Definition at line 762 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::CLOSED, DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, REQUIRE(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testFindABel(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "3D Khalimsky pre-space" | , |
"" | [KPreSpace][3D] | ||
) |
Definition at line 734 of file testKhalimskySpaceND.cpp.
References K, testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFindABel(), testIncidence(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "3D mixed Khalimsky space" | , |
"" | [KSpace][3D][closed][periodic][open] | ||
) |
Definition at line 922 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::CLOSED, DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::OPEN, DGtal::KhalimskySpaceND< dim, TInteger >::PERIODIC, REQUIRE(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testFindABel(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "3D open Khalimsky space" | , |
"" | [KSpace][3D][open] | ||
) |
Definition at line 842 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::OPEN, REQUIRE(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testFindABel(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "3D periodic Khalimsky space" | , |
"" | [KSpace][3D][periodic] | ||
) |
Definition at line 882 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::PERIODIC, REQUIRE(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testFindABel(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "4D closed Khalimsky space" | , |
"" | [KSpace][4D][closed] | ||
) |
Definition at line 802 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::CLOSED, DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, REQUIRE(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFaces(), testFindABel(), testIncidence(), testNeighborhood(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "4D Khalimsky pre-space" | , |
"" | [KPreSpace][4D] | ||
) |
Definition at line 748 of file testKhalimskySpaceND.cpp.
References K, testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testDirectIncidence(), testFindABel(), testIncidence(), testScan(), and testSurfelAdjacency().
TEST_CASE | ( | "Checking concepts" | ) |
Definition at line 709 of file testKhalimskySpaceND.cpp.
void testCellDrawOnBoard | ( | KSpace const & | K | ) |
Testing Cell drawing on Board.
KSpace | a 2D Khalimsky space type. |
K | the 2D Khalimsky space. |
Definition at line 496 of file testKhalimskySpaceND.cpp.
References DGtal::HyperRectDomain< TSpace >::className(), DGtal::SignedKhalimskyCell< dim, TInteger >::className(), LibBoard::Board::clear(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, domain, K, DGtal::KhalimskySpaceND< dim, TInteger >::POS, REQUIRE(), LibBoard::Board::saveEPS(), LibBoard::Board::saveSVG(), DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirect(), LibBoard::Board::setUnit(), DGtal::KhalimskySpaceND< dim, TInteger >::sIncident(), LibBoard::Shape::SolidStyle, DGtal::KhalimskySpaceND< dim, TInteger >::uCell(), LibBoard::Board::UCentimeter, and DGtal::KhalimskySpaceND< dim, TInteger >::uIncident().
Referenced by TEST_CASE().
void testCellularGridSpaceNDCoFaces | ( | KSpace const & | K | ) |
Testing uCoFaces
KSpace | a Khalimsky space type. |
K | the Khalimsky space. |
Definition at line 663 of file testKhalimskySpaceND.cpp.
References CAPTURE(), K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::uCoFaces(), DGtal::KhalimskySpaceND< dim, TInteger >::uDim(), DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside(), DGtal::KhalimskySpaceND< dim, TInteger >::uPointel(), and DGtal::KhalimskyPreSpaceND< dim, TInteger >::uSpel().
Referenced by TEST_CASE().
void testCellularGridSpaceNDFaces | ( | KSpace const & | K | ) |
Testing uFaces
KSpace | a Khalimsky space type. |
K | the Khalimsky space. |
Definition at line 618 of file testKhalimskySpaceND.cpp.
References CAPTURE(), K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::uDim(), DGtal::KhalimskySpaceND< dim, TInteger >::uFaces(), DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside(), DGtal::KhalimskyPreSpaceND< dim, TInteger >::uSpel(), and DGtal::KhalimskySpaceND< dim, TInteger >::uSpel().
Referenced by TEST_CASE().
void testDirectIncidence | ( | KSpace const & | K, |
typename KSpace::Point const & | aPoint | ||
) |
Testing direct incidence
KSpace | the Khalimsky space type. |
K | the Khalimsky space. |
aPoint | a point where to test the incidences. |
Definition at line 369 of file testKhalimskySpaceND.cpp.
References aPoint(), K, DGtal::KhalimskySpaceND< dim, TInteger >::POS, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirect(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirectIncident(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirs(), DGtal::KhalimskySpaceND< dim, TInteger >::sIncident(), DGtal::KhalimskySpaceND< dim, TInteger >::sSign(), and DGtal::KhalimskySpaceND< dim, TInteger >::sSpel().
Referenced by TEST_CASE().
void testFaces | ( | KSpace const & | K, |
typename KSpace::Point const & | aPoint | ||
) |
Test faces and co-faces.
KSpace | the Khalimsky space type (auto-deduced). |
K | the Khalimsky space. |
aPoint | the point around which to check the neighborhoods. |
Definition at line 273 of file testKhalimskySpaceND.cpp.
References aPoint(), cmpUCellsIfInside(), K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), DGtal::KhalimskySpaceND< dim, TInteger >::sTopology(), DGtal::KhalimskySpaceND< dim, TInteger >::uCell(), DGtal::KhalimskySpaceND< dim, TInteger >::uCoFaces(), DGtal::KhalimskySpaceND< dim, TInteger >::uDim(), DGtal::KhalimskySpaceND< dim, TInteger >::uFaces(), DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside(), and DGtal::KhalimskySpaceND< dim, TInteger >::uTopology().
Referenced by TEST_CASE().
void testFindABel | ( | KSpace const & | K | ) |
Testing Surfaces::findABel
KSpace | a Khalimsky space type. |
K | the Khalimsky space. |
Definition at line 566 of file testKhalimskySpaceND.cpp.
References DGtal::KhalimskySpaceND< dim, TInteger >::dimension, domain, DGtal::Surfaces< TKSpace >::findABel(), K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside(), and DGtal::KhalimskyPreSpaceND< dim, TInteger >::uSpel().
Referenced by TEST_CASE().
void testIncidence | ( | KSpace const & | K, |
typename KSpace::Point const & | aPoint | ||
) |
Testing block incidence
KSpace | the Khalimsky space type. |
K | the Khalimsky space. |
aPoint | a point where to test the incidences. |
Definition at line 333 of file testKhalimskySpaceND.cpp.
References aPoint(), K, DGtal::KhalimskySpaceND< dim, TInteger >::POS, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirs(), DGtal::KhalimskySpaceND< dim, TInteger >::sIncident(), DGtal::KhalimskySpaceND< dim, TInteger >::sOpp(), and DGtal::KhalimskySpaceND< dim, TInteger >::sSpel().
Referenced by TEST_CASE().
void testNeighborhood | ( | KSpace const & | K, |
typename KSpace::Point const & | aPoint | ||
) |
Tests (proper) neighborhoods
KSpace | the Khalimsky space type (auto-deduced). |
K | the Khalimsky space. |
aPoint | the point around which to check the neighborhoods. |
Definition at line 202 of file testKhalimskySpaceND.cpp.
References aPoint(), cmpSCellsIfInside(), cmpUCellsIfInside(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), DGtal::KhalimskySpaceND< dim, TInteger >::sNeighborhood(), DGtal::KhalimskySpaceND< dim, TInteger >::sProperNeighborhood(), DGtal::KhalimskySpaceND< dim, TInteger >::sTopology(), DGtal::KhalimskySpaceND< dim, TInteger >::uCell(), DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside(), DGtal::KhalimskySpaceND< dim, TInteger >::uNeighborhood(), DGtal::KhalimskySpaceND< dim, TInteger >::uProperNeighborhood(), and DGtal::KhalimskySpaceND< dim, TInteger >::uTopology().
Referenced by TEST_CASE().
void testScan | ( | KSpace const & | K, |
typename KSpace::Point const & | low, | ||
typename KSpace::Point const & | high | ||
) |
Tests uNext and sNext
KSpace | the Khalimsky space type (auto-deduced). |
K | the Khalimsky space. |
low | the first point to scan. |
high | the last point to scan. |
Definition at line 68 of file testKhalimskySpaceND.cpp.
References domain, K, REQUIRE(), DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), DGtal::KhalimskySpaceND< dim, TInteger >::sNext(), DGtal::KhalimskySpaceND< dim, TInteger >::sTopology(), DGtal::KhalimskySpaceND< dim, TInteger >::uCell(), DGtal::KhalimskySpaceND< dim, TInteger >::uNext(), and DGtal::KhalimskySpaceND< dim, TInteger >::uTopology().
Referenced by TEST_CASE().
void testSurfelAdjacency | ( | KSpace const & | K | ) |
Testing SurfelAdjacency
KSpace | the Khalimsky space type. |
K | the Khalimsky space. |
Definition at line 413 of file testKhalimskySpaceND.cpp.
References DGtal::Shapes< TDomain >::addNorm1Ball(), CAPTURE(), DGtal::HyperRectDomain< TSpace >::className(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, domain, DGtal::SurfelNeighborhood< TKSpace >::getAdjacentOnDigitalSet(), DGtal::SurfelNeighborhood< TKSpace >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::POS, REQUIRE(), LibBoard::Board::saveEPS(), LibBoard::Board::saveSVG(), DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirect(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirectIncident(), LibBoard::Board::setUnit(), DGtal::KhalimskySpaceND< dim, TInteger >::sIncident(), DGtal::KhalimskySpaceND< dim, TInteger >::sOrthDir(), DGtal::Surfaces< TKSpace >::trackBoundary(), DGtal::Surfaces< TKSpace >::trackClosedBoundary(), LibBoard::Board::UCentimeter, DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside(), and DGtal::KhalimskyPreSpaceND< dim, TInteger >::uSpel().
Referenced by TEST_CASE().