35 #include "DGtalCatch.h"
36 #include "DGtal/helpers/StdDefs.h"
37 #include "DGtal/shapes/parametric/Astroid2D.h"
41 using namespace DGtal;
51 std::uniform_real_distribution<double>& unif,
52 std::default_random_engine& re )
58 while ( res == Approx(0.) );
63 std::uniform_real_distribution<double>& unif,
64 std::default_random_engine& re )
71 std::uniform_real_distribution<double> unif(-10000,10000);
72 std::default_random_engine re;
76 const RealPoint center(unif(re),unif(re));
77 Shape shape( center, unif(re), unif(re) );
81 SECTION(
"Lower and upper bounds")
83 Shape shape( unif(re), unif(re), unif(re), unif(re) );
87 SECTION(
"parameter() with null x-radius -> division by 0.")
93 SECTION(
"parameter() with null y-radius -> division by 0.")
99 SECTION(
"parameter() with null x-radius and y-radius -> undefined behaviour.")
101 Shape shape( unif(re), unif(re), 0., 0. );
105 SECTION(
"parameter() where (x,y) parameter with x == center -> pi/2 or 3*pi/2")
107 const double centerX = unif(re);
108 Shape shape( centerX, unif(re), unif(re), unif(re) );
109 const RealPoint point( centerX, unif(re) );
110 REQUIRE_NOTHROW( shape.
parameter(point) );
112 REQUIRE_THAT( res, Catch::WithinAbs(M_PI_2,DBL_EPSILON) || Catch::WithinAbs(3*M_PI_2,DBL_EPSILON) );
115 SECTION(
"parameter() with point parameter with null y -> 0. or pi")
117 const double centerY = unif(re);
118 Shape shape( unif(re), centerY, unif(re), unif(re) );
119 const RealPoint point( unif(re), centerY );
120 REQUIRE_NOTHROW( shape.
parameter(point) );
122 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
Space::RealPoint RealPoint
SpaceND< 2, Integer > Space
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))