32#include "DGtal/base/Common.h"
33#include "DGtal/io/boards/Board2D.h"
34#include "DGtal/io/colormaps/GradientColorMap.h"
35#include "DGtal/kernel/sets/DigitalSetSelector.h"
36#include "DGtal/shapes/GaussDigitizer.h"
37#include "DGtal/helpers/StdDefs.h"
38#include "DGtal/shapes/parametric/Ball2D.h"
39#include "DGtal/shapes/parametric/Astroid2D.h"
40#include "DGtal/shapes/parametric/Ellipse2D.h"
41#include "DGtal/shapes/parametric/Flower2D.h"
42#include "DGtal/shapes/parametric/Lemniscate2D.h"
43#include "DGtal/shapes/Shapes.h"
44#include "DGtal/topology/helpers/Surfaces.h"
45#include "DGtal/geometry/curves/GridCurve.h"
46#include "DGtal/shapes/CDigitalOrientedShape.h"
47#include "DGtal/shapes/CDigitalBoundedShape.h"
74template <
typename Space,
typename Shape>
77 const string & fileName )
116 std::vector<Point> points;
133 board.
saveEPS( ( fileName +
".eps" ).c_str() );
134 board.
saveSVG( ( fileName +
".svg" ).c_str() );
145 unsigned int nbok = 0;
148 trace.
beginBlock (
"Testing GaussDigitizer as a Digital Shape functor." );
151 MyAstroid astroid( 6.2, -2.1, 7.3, 4.9 );
153 ( astroid, 1.0,
"gauss-astroid-1" ) ? 1 : 0;
156 ( astroid, 0.5,
"gauss-astroid-0_5" ) ? 1 : 0;
159 ( astroid, 0.25,
"gauss-astroid-0_25" ) ? 1 : 0;
163 MyBall ball( 6.2, -2.1, 7.3 );
165 ( ball, 1.0,
"gauss-ball-1" ) ? 1 : 0;
168 ( ball, 0.5,
"gauss-ball-0_5" ) ? 1 : 0;
171 ( ball, 0.25,
"gauss-ball-0_25" ) ? 1 : 0;
175 MyEllipse ellipse( 1.2, 0.1, 4.0, 3.0, 0.3 );
177 ( ellipse, 1.0,
"gauss-ellipse-1" ) ? 1 : 0;
180 ( ellipse, 0.5,
"gauss-ellipse-0_5" ) ? 1 : 0;
183 ( ellipse, 0.25,
"gauss-ellipse-0_25" ) ? 1 : 0;
187 MyFlower flower( 0.5, -2.3, 5.0, 0.7, 6, 0.3 );
189 ( flower, 1.0,
"gauss-flower-1" ) ? 1 : 0;
192 ( flower, 0.5,
"gauss-flower-0_5" ) ? 1 : 0;
195 ( flower, 0.25,
"gauss-flower-0_25" ) ? 1 : 0;
199 MyLemniscate lemniscate( 0.5, -2.3, 5.0 );
201 ( lemniscate, 1.0,
"gauss-lemniscate-1" ) ? 1 : 0;
204 ( lemniscate, 0.5,
"gauss-lemniscate-0_5" ) ? 1 : 0;
207 ( lemniscate, 0.25,
"gauss-lemniscate-0_25" ) ? 1 : 0;
210 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
211 <<
"true == true" << std::endl;
220int main(
int argc,
char** argv )
224 for (
int i = 0; i < argc; ++i )
229 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
RealPoint getLowerBound() const
RealPoint getUpperBound() const
Aim: Model of the concept StarShaped represents any circle in the plane.
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
Aim: Model of the concept StarShaped represents any ellipse in the plane.
Aim: Model of the concept StarShaped represents any flower with k-petals in the plane.
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
const Point & getUpperBound() const
void attach(ConstAlias< EuclideanShape > shape)
const Point & getLowerBound() const
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
std::string className() const
bool initFromVector(const std::vector< Point > &aVectorOfPoints)
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
std::string className() const
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: Model of the concept StarShaped represents a lemniscate.
static void digitalShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor)
static void track2DBoundaryPoints(std::vector< Point > &aVectorOfPoints, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Aim: Automatically defines an adequate digital set type according to the hints given by the user.
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
std::string className() const
Return the style name used for drawing this object.
Aim: designs the concept of bounded shapes in DGtal (shape for which upper and lower bounding bounds ...
Aim: characterizes models of digital oriented shapes. For example, models should provide an orientati...
bool testDigitization(const Shape &aShape, double h, const string &fileName)
bool testGaussDigitizer()
HyperRectDomain< Space > Domain
PointVector< 3, double > RealPoint