35 #include "DGtalCatch.h"
36 #include "DGtal/helpers/StdDefs.h"
37 #include "DGtal/shapes/parametric/Astroid2D.h"
41 using namespace DGtal;
48 std::uniform_real_distribution<double>& unif,
49 std::default_random_engine& re )
55 while ( res == Approx(0.) );
60 std::uniform_real_distribution<double>& unif,
61 std::default_random_engine& re )
68 std::uniform_real_distribution<double> unif(-10000,10000);
69 std::default_random_engine re;
73 const RealPoint center(unif(re),unif(re));
74 Shape shape( center, unif(re), unif(re) );
78 SECTION(
"Lower and upper bounds")
80 Shape shape( unif(re), unif(re), unif(re), unif(re) );
84 SECTION(
"parameter() with null x-radius -> division by 0.")
90 SECTION(
"parameter() with null y-radius -> division by 0.")
96 SECTION(
"parameter() with null x-radius and y-radius -> undefined behaviour.")
98 Shape shape( unif(re), unif(re), 0., 0. );
102 SECTION(
"parameter() where (x,y) parameter with x == center -> pi/2 or 3*pi/2")
104 const double centerX = unif(re);
105 Shape shape( centerX, unif(re), unif(re), unif(re) );
106 const RealPoint point( centerX, unif(re) );
107 REQUIRE_NOTHROW( shape.
parameter(point) );
109 REQUIRE_THAT( res, Catch::WithinAbs(M_PI_2,DBL_EPSILON) || Catch::WithinAbs(3*M_PI_2,DBL_EPSILON) );
112 SECTION(
"parameter() with point parameter with null y -> 0. or pi")
114 const double centerY = unif(re);
115 Shape shape( unif(re), centerY, unif(re), unif(re) );
116 const RealPoint point( unif(re), centerY );
117 REQUIRE_NOTHROW( shape.
parameter(point) );
119 REQUIRE_THAT( res, Catch::WithinAbs(0.,DBL_EPSILON) || Catch::WithinAbs(M_PI,DBL_EPSILON) );
RealPoint getLowerBound() const
RealPoint getUpperBound() const
double parameter(const RealPoint &p) const
Aim: Implements basic operations that will be used in Point and Vector classes.
Space::RealPoint RealPoint
DGtal is the top-level namespace which contains all DGtal functions and types.
RealPoint notNullRealPoint(std::uniform_real_distribution< double > &unif, std::default_random_engine &re)
double notNullValue(std::uniform_real_distribution< double > &unif, std::default_random_engine &re)
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))