DGtal 1.4.0
Loading...
Searching...
No Matches
testPlaneProbingTetrahedronEstimator.cpp File Reference
#include <iostream>
#include <vector>
#include "DGtal/base/Common.h"
#include "ConfigTest.h"
#include "DGtalCatch.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/arithmetic/IntegerComputer.h"
#include "DGtal/geometry/surfaces/DigitalPlanePredicate.h"
#include "DGtal/geometry/surfaces/estimation/PlaneProbingTetrahedronEstimator.h"
Include dependency graph for testPlaneProbingTetrahedronEstimator.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("Testing PlaneProbingTetrahedronEstimator")
 

Variables

static const Z3i::Vector NORMALS [100]
 
static const Z3i::Vector NORMALS_BIG [2]
 

Detailed Description

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
Jocelyn Meyron (jocel.nosp@m.yn.m.nosp@m.eyron.nosp@m.@lir.nosp@m.is.cn.nosp@m.rs.f.nosp@m.r ) Laboratoire d'InfoRmatique en Image et Systemes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2020/12/09

Functions for testing class DGtal::PlaneProbingTetrahedronEstimator.

This file is part of the DGtal library.

Definition in file testPlaneProbingTetrahedronEstimator.cpp.

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "Testing PlaneProbingTetrahedronEstimator" )

Definition at line 87 of file testPlaneProbingTetrahedronEstimator.cpp.

88{
89 SECTION("H-algorithm should return the correct normal, but a non-reduced basis")
90 {
91 int nbOk = 0;
92
93 for (const auto& n: NORMALS) {
94 TestPlaneProbingTetrahedronEstimator<int, ProbingMode::H>::compute
95 (n,
97 auto estimated = estimator.compute();
98 bool isReducedH = estimator.isReduced();
99
100 if (estimated == n && !isReducedH)
101 {
102 nbOk++;
103 }
104 });
105 }
106
107 REQUIRE(nbOk == 100);
108 }
109
110 SECTION("R and R1 algorithm should return the correct, same normal and the final basis should be reduced")
111 {
113
114 int nbOk = 0;
115 Point estimatedR, estimatedR1;
116 bool isReducedR = false, isReducedR1 = false;
117
118 for (const auto& n: NORMALS) {
119 TestPlaneProbingTetrahedronEstimator<int, ProbingMode::R>::compute
120 (n,
122 estimatedR = estimator.compute();
123 isReducedR = estimator.isReduced();
124 });
125
126 TestPlaneProbingTetrahedronEstimator<int, ProbingMode::R1>::compute
127 (n,
129 estimatedR1 = estimator.compute();
130 isReducedR1 = estimator.isReduced();
131 });
132
133 if (estimatedR == n && estimatedR1 == estimatedR &&
134 isReducedR && isReducedR1)
135 {
136 nbOk++;
137 }
138 }
139
140 REQUIRE(nbOk == 100);
141 }
142
143#ifdef WITH_GMP
144 SECTION("H and R algorithm should return the correct normal, R-algorithm a reduced basis with BigInteger")
145 {
147
148 int nbOk = 0;
149 Point estimatedH, estimatedR;
150 bool isReducedH = false, isReducedR = false;
151
152 for (const auto& n: NORMALS_BIG) {
153 TestPlaneProbingTetrahedronEstimator<BigInteger, ProbingMode::H>::compute
154 (n,
156 estimatedH = estimator.compute();
157 isReducedH = estimator.isReduced();
158 });
159
160 TestPlaneProbingTetrahedronEstimator<BigInteger, ProbingMode::R>::compute
161 (n,
163 estimatedR = estimator.compute();
164 isReducedR = estimator.isReduced();
165 });
166
167 if (estimatedH == n && estimatedR == estimatedH && !isReducedH && isReducedR)
168 {
169 nbOk++;
170 }
171 }
172
173 REQUIRE(nbOk == 2);
174 }
175#endif
176}
Aim: A class that locally estimates a normal on a digital set using only a predicate "does a point x ...
Quantity compute(std::vector< PointOnProbingRay > const &aNeighbors)
Aim: Implements basic operations that will be used in Point and Vector classes.
MyPointD Point
static const Z3i::Vector NORMALS_BIG[2]
static const Z3i::Vector NORMALS[100]
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))

References DGtal::PlaneProbingTetrahedronEstimator< TPredicate, mode >::compute(), DGtal::PlaneProbingTetrahedronEstimator< TPredicate, mode >::isReduced(), NORMALS, NORMALS_BIG, REQUIRE(), and SECTION().

Variable Documentation

◆ NORMALS

const Z3i::Vector NORMALS[100]
static
Initial value:
= {
{1, 117, 148}, {1, 118, 149}, {1, 120, 25}, {1, 120, 152}, {1, 121, 153}, {1, 122, 154}, {1, 123, 155}, {1, 123, 156}, {1, 124, 26}, {1, 124, 157},
{1, 125, 26}, {1, 125, 158}, {1, 126, 77}, {1, 126, 159}, {1, 127, 160}, {1, 127, 161}, {1, 128, 27}, {1, 128, 162}, {1, 129, 27}, {1, 129, 163},
{1, 130, 164}, {1, 130, 165}, {1, 131, 165}, {1, 131, 166}, {1, 132, 28}, {1, 132, 166}, {1, 132, 167}, {1, 133, 28}, {1, 133, 168}, {1, 134, 169},
{1, 134, 170}, {1, 135, 170}, {1, 135, 171}, {1, 136, 171}, {1, 136, 172}, {1, 137, 29}, {1, 137, 173}, {1, 137, 174}, {1, 138, 174}, {1, 138, 175},
{1, 139, 175}, {1, 139, 176}, {1, 140, 176}, {1, 140, 177}, {1, 140, 178}, {1, 141, 30}, {1, 141, 178}, {1, 141, 179}, {1, 142, 179}, {1, 142, 180},
{1, 143, 180}, {1, 143, 181}, {1, 144, 182}, {1, 144, 183}, {1, 145, 183}, {1, 145, 184}, {1, 146, 184}, {1, 146, 185}, {1, 147, 186}, {1, 147, 187},
{1, 148, 187}, {1, 148, 188}, {1, 149, 188}, {1, 149, 189}, {1, 150, 190}, {1, 151, 191}, {1, 151, 192}, {1, 152, 192}, {1, 152, 193}, {1, 153, 194},
{1, 154, 195}, {1, 154, 196}, {1, 155, 196}, {1, 155, 197}, {1, 156, 198}, {1, 157, 199}, {1, 173, 30}, {1, 174, 30}, {1, 175, 30}, {1, 178, 31},
{1, 179, 31}, {1, 180, 31}, {1, 181, 31}, {1, 184, 32}, {1, 185, 32}, {1, 186, 32}, {1, 187, 32}, {1, 188, 32}, {1, 189, 33}, {1, 190, 33},
{1, 191, 33}, {1, 192, 33}, {1, 193, 33}, {1, 194, 33}, {1, 194, 34}, {1, 195, 34}, {1, 196, 34}, {1, 197, 34}, {1, 198, 34}, {1, 199, 34},
}

Definition at line 49 of file testPlaneProbingTetrahedronEstimator.cpp.

49 {
50 {1, 117, 148}, {1, 118, 149}, {1, 120, 25}, {1, 120, 152}, {1, 121, 153}, {1, 122, 154}, {1, 123, 155}, {1, 123, 156}, {1, 124, 26}, {1, 124, 157},
51 {1, 125, 26}, {1, 125, 158}, {1, 126, 77}, {1, 126, 159}, {1, 127, 160}, {1, 127, 161}, {1, 128, 27}, {1, 128, 162}, {1, 129, 27}, {1, 129, 163},
52 {1, 130, 164}, {1, 130, 165}, {1, 131, 165}, {1, 131, 166}, {1, 132, 28}, {1, 132, 166}, {1, 132, 167}, {1, 133, 28}, {1, 133, 168}, {1, 134, 169},
53 {1, 134, 170}, {1, 135, 170}, {1, 135, 171}, {1, 136, 171}, {1, 136, 172}, {1, 137, 29}, {1, 137, 173}, {1, 137, 174}, {1, 138, 174}, {1, 138, 175},
54 {1, 139, 175}, {1, 139, 176}, {1, 140, 176}, {1, 140, 177}, {1, 140, 178}, {1, 141, 30}, {1, 141, 178}, {1, 141, 179}, {1, 142, 179}, {1, 142, 180},
55 {1, 143, 180}, {1, 143, 181}, {1, 144, 182}, {1, 144, 183}, {1, 145, 183}, {1, 145, 184}, {1, 146, 184}, {1, 146, 185}, {1, 147, 186}, {1, 147, 187},
56 {1, 148, 187}, {1, 148, 188}, {1, 149, 188}, {1, 149, 189}, {1, 150, 190}, {1, 151, 191}, {1, 151, 192}, {1, 152, 192}, {1, 152, 193}, {1, 153, 194},
57 {1, 154, 195}, {1, 154, 196}, {1, 155, 196}, {1, 155, 197}, {1, 156, 198}, {1, 157, 199}, {1, 173, 30}, {1, 174, 30}, {1, 175, 30}, {1, 178, 31},
58 {1, 179, 31}, {1, 180, 31}, {1, 181, 31}, {1, 184, 32}, {1, 185, 32}, {1, 186, 32}, {1, 187, 32}, {1, 188, 32}, {1, 189, 33}, {1, 190, 33},
59 {1, 191, 33}, {1, 192, 33}, {1, 193, 33}, {1, 194, 33}, {1, 194, 34}, {1, 195, 34}, {1, 196, 34}, {1, 197, 34}, {1, 198, 34}, {1, 199, 34},
60};

Referenced by TEST_CASE().

◆ NORMALS_BIG

const Z3i::Vector NORMALS_BIG[2]
static
Initial value:
= {
{1, 59438, 82499}, {2071, 8513, 6444},
}

Definition at line 62 of file testPlaneProbingTetrahedronEstimator.cpp.

62 {
63 {1, 59438, 82499}, {2071, 8513, 6444},
64};

Referenced by TEST_CASE().