DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testLemniscate2D.cpp
Go to the documentation of this file.
1
16
31
33
#include <iostream>
34
#include <random>
35
#include "DGtalCatch.h"
36
#include "DGtal/helpers/StdDefs.h"
37
#include "DGtal/shapes/parametric/Lemniscate2D.h"
38
40
41
using namespace
DGtal
;
42
using namespace
Z2i
;
43
44
typedef
Lemniscate2D<Space>
Shape
;
45
46
double
notNullValue
(
47
std::uniform_real_distribution<double>& unif,
48
std::default_random_engine& re )
49
{
50
double
res;
51
do
{
52
res = unif(re);
53
}
54
while
( res == Approx(0.) );
55
return
res;
56
}
57
58
RealPoint
notNullRealPoint
(
59
std::uniform_real_distribution<double>& unif,
60
std::default_random_engine& re )
61
{
62
return
RealPoint
(
notNullValue
(unif,re),
notNullValue
(unif,re));
63
}
64
65
TEST_CASE
(
"Lemniscate2D"
)
66
{
67
std::uniform_real_distribution<double> unif(-10000,10000);
68
std::default_random_engine re;
69
70
SECTION
(
"center()"
)
71
{
72
const
RealPoint
center(unif(re),unif(re));
73
Shape
shape( center, unif(re) );
74
REQUIRE
( shape.
center
() == center );
75
}
76
77
SECTION
(
"Lower and upper bounds"
)
78
{
79
Shape
shape( unif(re), unif(re), unif(re) );
80
REQUIRE
( shape.
getLowerBound
() <= shape.
getUpperBound
() );
81
}
82
83
SECTION
(
"x() with Pi parameter."
)
84
{
85
Shape
shape( unif(re), unif(re), unif(re) );
86
REQUIRE_NOTHROW( shape.
x
(M_PI) );
87
}
88
89
SECTION
(
"x() with Pi parameter -> division by 0."
)
90
{
91
Shape
shape( unif(re), unif(re), unif(re) );
92
REQUIRE_NOTHROW( shape.
x
(M_PI) );
93
}
94
95
SECTION
(
"xp() with Pi parameter -> division by 0."
)
96
{
97
Shape
shape( unif(re), unif(re), unif(re) );
98
REQUIRE_NOTHROW( shape.
xp
(M_PI) );
99
}
100
101
SECTION
(
"xpp() with Pi parameter -> division by 0."
)
102
{
103
Shape
shape( unif(re), unif(re), unif(re) );
104
REQUIRE_NOTHROW( shape.
xp
(M_PI) );
105
}
106
}
DGtal::Astroid2D::getLowerBound
RealPoint getLowerBound() const
Definition
Astroid2D.h:122
DGtal::Astroid2D::x
RealPoint x(const double t) const
DGtal::Astroid2D::xp
RealVector xp(const double t) const
DGtal::Astroid2D::center
RealPoint center() const
Definition
Astroid2D.h:139
DGtal::Astroid2D::getUpperBound
RealPoint getUpperBound() const
Definition
Astroid2D.h:131
DGtal::Lemniscate2D
Aim: Model of the concept StarShaped represents a lemniscate.
Definition
Lemniscate2D.h:62
DGtal::Z2i
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal::Z2i::RealPoint
Space::RealPoint RealPoint
Definition
StdDefs.h:97
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
notNullRealPoint
RealPoint notNullRealPoint(std::uniform_real_distribution< double > &unif, std::default_random_engine &re)
Definition
testAstroid2D.cpp:59
Shape
Astroid2D< Space > Shape
Definition
testAstroid2D.cpp:45
notNullValue
double notNullValue(std::uniform_real_distribution< double > &unif, std::default_random_engine &re)
Definition
testAstroid2D.cpp:47
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
testLemniscate2D.cpp
Generated on
for DGtal by
1.18.0