DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testWindingNumbersShape.cpp
Go to the documentation of this file.
1
16
29
31
#include <iostream>
32
#include "DGtal/base/Common.h"
33
#include "ConfigTest.h"
34
#include "DGtalCatch.h"
35
#include "DGtal/helpers/StdDefs.h"
36
37
#include <DGtal/shapes/WindingNumbersShape.h>
38
#include <DGtal/shapes/GaussDigitizer.h>
39
41
42
using namespace
std
;
43
using namespace
DGtal
;
44
using namespace
Z3i
;
45
47
// Functions for testing class WindingNumbersShape.
49
50
TEST_CASE
(
"Testing WindingNumbersShape"
)
51
{
52
using
WNShape =
WindingNumbersShape<Z3i::Space>
;
53
54
SECTION
(
"Checking concept"
)
55
{
56
BOOST_CONCEPT_ASSERT( (
DGtal::concepts::CEuclideanOrientedShape<WNShape>
) );
57
}
58
59
SECTION
(
"Simple test of 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);
101
GaussDigitizer<Z3i::Space, WNShape>
gauss;
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
};
111
DGtal::GaussDigitizer
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Definition
GaussDigitizer.h:80
DGtal::GaussDigitizer::orientation
Orientation orientation(const Point &p) const
Definition
GaussDigitizer.h:194
DGtal::GaussDigitizer::attach
void attach(ConstAlias< EuclideanShape > shape)
DGtal::GaussDigitizer::init
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
DGtal::GaussDigitizer::getDomain
Domain getDomain() const
DGtal::Z3i
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal::Z3i::RealPoint
Space::RealPoint RealPoint
Definition
StdDefs.h:170
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::Orientation
Orientation
Definition
Common.h:124
DGtal::INSIDE
@ INSIDE
Definition
Common.h:124
DGtal::OUTSIDE
@ OUTSIDE
Definition
Common.h:124
std
STL namespace.
DGtal::WindingNumbersShape
Aim: model of a CEuclideanOrientedShape from an implicit function from an oriented point cloud....
Definition
WindingNumbersShape.h:78
DGtal::concepts::CEuclideanOrientedShape
Aim: characterizes models of digital oriented shapes. For example, models should provide an orientati...
Definition
CEuclideanOrientedShape.h:92
TEST_CASE
TEST_CASE("int container traits", "[int][traits]")
Definition
testContainerTraits.cpp:53
SECTION
SECTION("Testing constant forward iterators")
Definition
testSimpleRandomAccessRangeFromPoint.cpp:66
REQUIRE
REQUIRE(domain.isInside(aPoint))
tests
shapes
testWindingNumbersShape.cpp
Generated on
for DGtal by
1.18.0