DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testGeodesicsInHeat.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/dec/PolygonalCalculus.h"
38
#include "DGtal/dec/GeodesicsInHeat.h"
39
#include "DGtal/shapes/SurfaceMesh.h"
40
#include "DGtal/shapes/MeshHelpers.h"
42
43
using namespace
std
;
44
using namespace
DGtal
;
45
using namespace
Z3i
;
46
47
TEST_CASE
(
"Testing GeodesicsInHeat"
)
48
{
49
typedef
SurfaceMesh< RealPoint,RealPoint >
Mesh
;
50
std::vector<RealPoint> positions = {
RealPoint
( 0, 0, 0 ) ,
51
RealPoint
( 1, 0, 0 ) ,
52
RealPoint
( 0, 1, 0 ) ,
53
RealPoint
( 1, 1, 0 ) ,
54
RealPoint
( 0, 0, 1 ) ,
55
RealPoint
( 1, 0, 1 ) ,
56
RealPoint
( 0, 1, 1 ) ,
57
RealPoint
( 1, 1, 1 ) ,
58
RealPoint
( 1, 0, 2 ) ,
59
RealPoint
( 0, 0, 2 ) };
60
std::vector<Mesh::Vertices> faces = { { 1, 0, 2, 3 },
61
{ 0, 1, 5, 4 } ,
62
{ 1, 3, 7, 5 } ,
63
{ 3, 2, 6, 7 } ,
64
{ 2, 0, 4, 6 } ,
65
{ 4, 5, 8, 9 } };
66
67
Mesh
box(positions.cbegin(), positions.cend(),
68
faces.cbegin(), faces.cend());
69
70
PolygonalCalculus<RealPoint,RealVector>
boxCalculus(box);
71
72
73
SECTION
(
"Construction and basic operators"
)
74
{
75
GeodesicsInHeat<PolygonalCalculus<RealPoint,RealVector>
>
heat
(boxCalculus);
76
REQUIRE
(
heat
.isValid() ==
false
);
77
78
trace
.
beginBlock
(
"init solvers"
);
79
heat
.init(0.1);
80
trace
.
endBlock
();
81
REQUIRE
(
heat
.isValid() );
82
83
heat
.addSource(0);
84
GeodesicsInHeat<PolygonalCalculus<RealPoint,RealVector>
>
::Vector
d =
heat
.compute();
85
REQUIRE
( (
size_t
)d.size() == (
size_t
)positions.size() );
86
REQUIRE
( d[5] == Approx(1.444608) );
87
heat
.clearSource();
88
auto
sources =
heat
.source();
89
REQUIRE
(sources.sum() == 0);
90
}
91
}
92
DGtal::GeodesicsInHeat
This class implements crane2013 on polygonal surfaces (using Discrete differential calculus on polygo...
Definition
GeodesicsInHeat.h:63
DGtal::Mesh
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition
Mesh.h:92
DGtal::PolygonalCalculus
Implements differential operators on polygonal surfaces from degoes2020discrete.
Definition
PolygonalCalculus.h:129
DGtal::Vector
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::endBlock
double endBlock()
heat
GeodesicsInHeat< PolyCalculus > * heat
Definition
dgtalCalculus-geodesic.cpp:69
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::trace
Trace trace
std
STL namespace.
DGtal::SurfaceMesh
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
Definition
SurfaceMesh.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
dec
testGeodesicsInHeat.cpp
Generated on
for DGtal by
1.18.0