DGtal 1.4.0
Loading...
Searching...
No Matches
testWindingNumbersShape.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "ConfigTest.h"
#include "DGtalCatch.h"
#include "DGtal/helpers/StdDefs.h"
#include <DGtal/shapes/WindingNumbersShape.h>
#include <DGtal/shapes/GaussDigitizer.h>
Include dependency graph for testWindingNumbersShape.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("Testing WindingNumbersShape")
 

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
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systemes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2023/06/14

Functions for testing class WindingNumbersShape.

This file is part of the DGtal library.

Definition in file testWindingNumbersShape.cpp.

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "Testing WindingNumbersShape" )

Definition at line 50 of file testWindingNumbersShape.cpp.

51{
52 using WNShape = WindingNumbersShape<Z3i::Space>;
53
54 SECTION("Checking concept")
55 {
57 }
58
59 SECTION("Simple testof the API")
60 {
61 Eigen::MatrixXd points(4,3);
62 points << 0,0,0,
63 0,1,0,
64 1,0,0,
65 1,1,1;
66 Eigen::MatrixXd normals(4,3);
67 normals << 0,0,-1,
68 0,0,-1,
69 0,0,-1,
70 0,0,1;
71
72 WNShape wnshape(points,normals);
73
74 RealPoint p(-2.0,-2.0,-2.0);
75 DGtal::Orientation ori = wnshape.orientation(p);
76 REQUIRE( ori == DGtal::OUTSIDE);
77
78 p = RealPoint(2.0,2.0,2.0);
79 ori = wnshape.orientation(p);
80 REQUIRE( ori == DGtal::OUTSIDE);
81
82 RealPoint q= RealPoint(.2,.2,.2);
83 auto ori2 = wnshape.orientation(q);
84 REQUIRE( ori2 == DGtal::INSIDE);
85 }
86
87 SECTION("Tesing with the GaussDigitizer")
88 {
89 Eigen::MatrixXd points(4,3);
90 points << 0,0,0,
91 0,1,0,
92 1,0,0,
93 1,1,1;
94 Eigen::MatrixXd normals(4,3);
95 normals << 0,0,-1,
96 0,0,-1,
97 0,0,-1,
98 0,0,1;
99
100 WNShape wnshape(points,normals);
102 gauss.attach(wnshape);
103 gauss.init(Z3i::RealPoint(0,0,0),Z3i::RealPoint(1.5,1.5,1.5), 0.5);
104 auto cpt=0;
105 for(auto p: gauss.getDomain())
106 if (gauss.orientation(p) == DGtal::INSIDE)
107 ++cpt;
108 REQUIRE( cpt == 8);
109 }
110};
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
void attach(ConstAlias< EuclideanShape > shape)
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: Implements basic operations that will be used in Point and Vector classes.
Space::RealPoint RealPoint
Definition StdDefs.h:170
DGtal is the top-level namespace which contains all DGtal functions and types.
Orientation
Definition Common.h:141
@ INSIDE
Definition Common.h:141
@ OUTSIDE
Definition Common.h:141
Aim: model of a CEuclideanOrientedShape from an implicit function from an oriented point cloud....
Aim: characterizes models of digital oriented shapes. For example, models should provide an orientati...
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))

References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::attach(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::getDomain(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::init(), DGtal::INSIDE, DGtal::GaussDigitizer< TSpace, TEuclideanShape >::orientation(), DGtal::OUTSIDE, REQUIRE(), and SECTION().