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/Ellipse2D.h" 39 #include "DGtal/shapes/parametric/Flower2D.h" 40 #include "DGtal/shapes/Shapes.h" 41 #include "DGtal/topology/helpers/Surfaces.h" 42 #include "DGtal/geometry/curves/GridCurve.h" 43 #include "DGtal/shapes/CDigitalOrientedShape.h" 44 #include "DGtal/shapes/CDigitalBoundedShape.h" 49 using namespace DGtal;
71 template <
typename Space,
typename Shape>
74 const string & fileName )
83 RealPoint xLow( -5.3, -4.3 );
84 RealPoint xUp( 7.4, 4.7 );
87 dig.
init( xLow, xUp, h );
113 std::vector<Point> points;
135 board.
saveEPS( ( fileName +
".eps" ).c_str() );
136 board.
saveSVG( ( fileName +
".svg" ).c_str() );
147 unsigned int nbok = 0;
150 trace.
beginBlock (
"Testing GaussDigitizer as a Digital Shape functor." );
153 MyEllipse ellipse( 1.2, 0.1, 4.0, 3.0, 0.3 );
154 nbok += testDigitization<Z2i::Space,MyEllipse>
155 ( ellipse, 1.0,
"gauss-ellipse-1" ) ? 1 : 0;
157 nbok += testDigitization<Z2i::Space,MyEllipse>
158 ( ellipse, 0.5,
"gauss-ellipse-0_5" ) ? 1 : 0;
160 nbok += testDigitization<Z2i::Space,MyEllipse>
161 ( ellipse, 0.25,
"gauss-ellipse-0_25" ) ? 1 : 0;
165 MyFlower flower( 0.5, -2.3, 5.0, 0.7, 6, 0.3 );
166 nbok += testDigitization<Z2i::Space,MyFlower>
167 ( flower, 1.0,
"gauss-flower-1" ) ? 1 : 0;
169 nbok += testDigitization<Z2i::Space,MyFlower>
170 ( flower, 0.5,
"gauss-flower-0_5" ) ? 1 : 0;
172 nbok += testDigitization<Z2i::Space,MyFlower>
173 ( flower, 0.25,
"gauss-flower-0_25" ) ? 1 : 0;
176 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 177 <<
"true == true" << std::endl;
186 int main(
int argc,
char** argv )
190 for (
int i = 0; i < argc; ++i )
195 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
HyperRectDomain< Space > Domain
const Domain domain(Point(1, 2), Point(6, 5))
const Point & getLowerBound() const
bool testGaussDigitizer()
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
const Point & getUpperBound() const
Aim: Model of the concept StarShaped represents any ellipse in the plane.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Aim: designs the concept of bounded shapes in DGtal (shape for which upper and lower bounding bounds ...
void attach(const EuclideanShape &shape)
Aim: Model of the concept StarShaped represents any flower with k-petals in the plane.
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Aim: characterizes models of digital oriented shapes. For example, models should provide an orientati...
bool initFromVector(const std::vector< Point > &aVectorOfPoints)
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
int main(int argc, char **argv)
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
std::string className() const
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
std::string className() const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Automatically defines an adequate digital set type according to the hints given by the user...
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value...
bool testDigitization(const Shape &aShape, double h, const string &fileName)
Modifier class in a Board2D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithBoard2D.
Structure representing an RGB triple with alpha component.
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...