33 #include "DGtal/base/Common.h"
34 #include "DGtal/helpers/StdDefs.h"
35 #include "DGtal/shapes/GaussDigitizer.h"
38 #include "DGtal/shapes/DigitalShapesDecorator.h"
41 #include "DGtal/shapes/parametric/Ball2D.h"
46 using namespace DGtal;
57 unsigned int nbok = 0;
70 ShapeA shapeA(-2.501, 0.0, 2.5013);
71 ShapeA shapeB(2, 0.0, 2.5013);
72 ShapeA shapeC(0.0, 0.0, 2.5);
74 MyGaussDigitizerA digShapeA;
75 digShapeA.attach( shapeA );
76 digShapeA.init( shapeA.getLowerBound(), shapeA.getUpperBound(), h );
78 MyGaussDigitizerA digShapeB;
79 digShapeB.attach( shapeB );
80 digShapeB.init( shapeB.getLowerBound(), shapeB.getUpperBound(), h );
82 MyGaussDigitizerA digShapeC;
83 digShapeC.attach( shapeC );
84 digShapeC.init( shapeC.getLowerBound(), shapeC.getUpperBound(), h );
88 CSG s_union ( digShapeA );
89 s_union.plus( digShapeB );
91 CSG s_intersec ( digShapeA );
92 s_intersec.plus( digShapeB );
93 s_intersec.intersection( digShapeC );
95 CSG s_minus ( digShapeA );
96 s_minus.minus( digShapeC );
99 nbok += (( s_union.orientation(
Point( -12, 0 )) ==
INSIDE )
100 || ( s_union.orientation(
Point( -12, 0 )) ==
ON ))? 0 : 1;
101 nbok += (( s_union.orientation(
Point( 0, 0 )) ==
INSIDE )
102 || ( s_union.orientation(
Point( 0, 0 )) ==
ON ))? 1 : 0;
103 nbok += (( s_union.orientation(
Point( 10, 0 )) ==
INSIDE )
104 || ( s_union.orientation(
Point( 10, 0 )) ==
ON ))? 0 : 1;
105 nbok += (( s_union.orientation(
Point( 9, 0 )) ==
INSIDE )
106 || ( s_union.orientation(
Point( 9, 0 )) ==
ON ))? 1 : 0;
107 nbok += (( s_union.orientation(
Point( -10, 0 )) ==
INSIDE )
108 || ( s_union.orientation(
Point( -10, 0 )) ==
ON ))? 1 : 0;
111 nbok += (( s_intersec.orientation(
Point( -6, 0 )) ==
INSIDE )
112 || ( s_intersec.orientation(
Point( -6, 0 )) ==
ON ))? 0 : 1;
113 nbok += (( s_intersec.orientation(
Point( 4, 0 )) ==
INSIDE )
114 || ( s_intersec.orientation(
Point( 4, 0 )) ==
ON ))? 1 : 0;
115 nbok += (( s_intersec.orientation(
Point( 6, 0 )) ==
INSIDE )
116 || ( s_intersec.orientation(
Point( 6, 0 )) ==
ON ))? 0 : 1;
117 nbok += (( s_intersec.orientation(
Point( 0, 5 )) ==
INSIDE )
118 || ( s_intersec.orientation(
Point( 0, 5 )) ==
ON ))? 0 : 1;
121 nbok += (( s_minus.orientation(
Point( -9, 0 )) ==
INSIDE )
122 || ( s_minus.orientation(
Point( -9, 0 )) ==
ON ))? 1 : 0;
123 nbok += (( s_minus.orientation(
Point( -2, 0 )) ==
INSIDE )
124 || ( s_minus.orientation(
Point( -2, 0 )) ==
ON ))? 0 : 1;
125 nbok += (( s_minus.orientation(
Point( 0, 2 )) ==
INSIDE )
126 || ( s_minus.orientation(
Point( 0, 2 )) ==
ON ))? 0 : 1;
127 nbok += (( s_minus.orientation(
Point( -8, 0 )) ==
INSIDE )
128 || ( s_minus.orientation(
Point( -8, 0 )) ==
ON ))? 1 : 0;
133 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
134 <<
"true == true" << std::endl;
142 int main(
int argc,
char** argv )
146 for (
int i = 0; i < argc; ++i )
151 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << std::endl;
Aim: Model of the concept StarShaped represents any circle in the plane.
Aim: Constructive Solid Geometry (CSG) between models of CDigitalBoundedShape and CDigitalOrientedSha...
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
bool testDigitalShapesDecorator()