DGtal 1.3.0
Loading...
Searching...
No Matches
Typedefs | Functions
examplePlaneProbingTetrahedronEstimator.cpp File Reference
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/geometry/surfaces/DigitalPlanePredicate.h"
#include "DGtal/geometry/surfaces/estimation/PlaneProbingTetrahedronEstimator.h"

Go to the source code of this file.

Typedefs

using Integer = int
 
using Space = SpaceND< 3, Integer >
 
using Point = Space::Vector
 
using Vector = Space::Point
 

Functions

int main (void)
 

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/04

An example file that shows how to construct and use a DGtal::PlaneProbingTetrahedronEstimator on an analytical digital plane.

This file is part of the DGtal library.

Definition in file examplePlaneProbingTetrahedronEstimator.cpp.

Typedef Documentation

◆ Integer

using Integer = int

Definition at line 42 of file examplePlaneProbingTetrahedronEstimator.cpp.

◆ Point

Definition at line 44 of file examplePlaneProbingTetrahedronEstimator.cpp.

◆ Space

using Space = SpaceND<3, Integer>

Definition at line 43 of file examplePlaneProbingTetrahedronEstimator.cpp.

◆ Vector

Definition at line 45 of file examplePlaneProbingTetrahedronEstimator.cpp.

Function Documentation

◆ main()

int main ( void  )

[PlaneProbingTetrahedronEstimatorConstruction]

[PlaneProbingTetrahedronEstimatorConstruction]

[PlaneProbingTetrahedronEstimatorUsage]

[PlaneProbingTetrahedronEstimatorUsage]

Definition at line 49 of file examplePlaneProbingTetrahedronEstimator.cpp.

50{
52 // The general form is ProbingEstimator<Predicate, mode> where
53 // - Predicate is a model of concepts::PointPredicate, see DigitalPlanePredicate or DigitalSurfacePredicate for instance,
54 // - mode specifies the candidate set, it is one of { ProbingMode::H, ProbingMode::R, ProbingMode::R1 }.
57
58 // We start by constructing the predicate, here a standard digital plane of normal (2, 6, 15)
59 Vector n(2, 6, 15);
60 DigitalPlane plane(n, 0, n.norm1());
61
62 // Instantiation: estimator(startingPoint, initialFrame, predicate) where
63 // (startingPoint, initialFrame) describes the initial tetrahedron.
64 Point o(0, 0, 0);
65 std::array<Point, 3> m = { Point(1, 0, 0), Point(0, 1, 0), Point(0, 0, 1) };
66 Estimator estimator(o, m, plane);
68
70 int it = 0;
71 while (estimator.advance().first) {
72 it++;
73
74 // You can examine the current configuration of the H-neighborhood, using PlaneProbingTetrahedronEstimator::hexagonState
75 auto state = estimator.hexagonState();
76 if (state == Estimator::Neighborhood::HexagonState::Planar) {
77 std::cout << "Planar" << std::endl;
78 } else if (state == Estimator::Neighborhood::HexagonState::Empty) {
79 std::cout << "Empty" << std::endl;
80 } else if (state == Estimator::Neighborhood::HexagonState::NonPlanar) {
81 std::cout << "NonPlanar" << std::endl;
82 } else if (state == Estimator::Neighborhood::HexagonState::NonConvex) {
83 std::cout << "NonConvex" << std::endl;
84 }
85
86 // Here, we display the current frame (the vectors m_k) and the current estimation
87 std::clog << "it = " << it << " "
88 << estimator.m(0) << " " << estimator.m(1) << " " << estimator.m(2) << " "
89 << estimator.getNormal() << std::endl;
90 }
91
92 // This loop can also be reduced to:
93 // Point n = estimator.compute()
95
96 ASSERT(estimator.getNormal() == n);
97
98 return 0;
99}
Aim: Representing digital planes, which are digitizations of Euclidean planes, as point predicates.
Aim: A class that locally estimates a normal on a digital set using only a predicate "does a point x ...
MyPointD Point
Definition: testClone2.cpp:383
FreemanChain< int >::Vector Vector

References DGtal::PlaneProbingParallelepipedEstimator< TPredicate, mode >::advance(), DGtal::PlaneProbingParallelepipedEstimator< TPredicate, mode >::getNormal(), DGtal::PlaneProbingParallelepipedEstimator< TPredicate, mode >::hexagonState(), and DGtal::PlaneProbingParallelepipedEstimator< TPredicate, mode >::m().