35#include "DGtalCatch.h"
36#include "DGtal/helpers/StdDefs.h"
37#include "DGtal/shapes/parametric/Astroid2D.h"
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;
81 SECTION(
"Lower and upper bounds")
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.")
105 SECTION(
"parameter() where (x,y) parameter with x == center -> pi/2 or 3*pi/2")
107 const double 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);
120 REQUIRE_NOTHROW( shape.
parameter(point) );
122 REQUIRE_THAT( res, Catch::WithinAbs(0.,DBL_EPSILON) || Catch::WithinAbs(M_PI,DBL_EPSILON) );
Aim: Model of the concept StarShaped represents an astroid.
RealPoint getLowerBound() const
RealPoint getUpperBound() const
double parameter(const RealPoint &p) const
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)
std::default_random_engine re
std::uniform_real_distribution< double > unif(-1000000., 1000000.)
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))