36#include "DGtalCatch.h"
37#include "DGtal/base/Common.h"
38#include "DGtal/helpers/StdDefs.h"
40#include "DGtal/geometry/curves/parametric/EllipticHelix.h"
41#include "DGtal/geometry/curves/parametric/DecoratorParametricCurveTransformation.h"
42#include "DGtal/geometry/curves/parametric/Knot_3_1.h"
43#include "DGtal/geometry/curves/parametric/Knot_3_2.h"
44#include "DGtal/geometry/curves/parametric/Knot_4_1.h"
45#include "DGtal/geometry/curves/parametric/Knot_4_3.h"
46#include "DGtal/geometry/curves/parametric/Knot_5_1.h"
47#include "DGtal/geometry/curves/parametric/Knot_5_2.h"
48#include "DGtal/geometry/curves/parametric/Knot_6_2.h"
49#include "DGtal/geometry/curves/parametric/Knot_7_4.h"
50#include "DGtal/geometry/curves/parametric/NaiveParametricCurveDigitizer3D.h"
51#include "DGtal/images/RigidTransformation3D.h"
58using namespace functors;
62 typedef EllipticHelix < Space > MyHelix;
63 typedef NaiveParametricCurveDigitizer3D < MyHelix > DigitizerHelix;
67 MyDigitalCurve digitalCurve;
69 MyHelix helix( 15, 10, 1 );
71 digitize.init ( M_PI / 2., MyHelix::getPeriod() + M_PI / 2., 0.001 );
73 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
77 REQUIRE( digitalCurve.size ( ) > 0 );
80 digitalCurve.clear ( );
82 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
86 REQUIRE( digitalCurve.size ( ) > 0 );
87 REQUIRE( metaData.size ( ) > 0 );
88 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
93 helix.f ( digitalCurve[0] );
94 helix.g ( digitalCurve[0] );
95 helix.h ( digitalCurve[0] );
103 typedef EllipticHelix < Space > MyHelix;
104 typedef ForwardRigidTransformation3D < Space, RealPoint, RealPoint, Identity > ForwardTrans;
105 typedef DecoratorParametricCurveTransformation < MyHelix, ForwardTrans > MyRotatedCurve;
106 typedef NaiveParametricCurveDigitizer3D < MyRotatedCurve > Digitizer;
110 MyDigitalCurve digitalCurve;
112 MyHelix helix( 30, 20, 1 );
114 double angle = M_PI/3.;
117 MyRotatedCurve rotCurve ( helix, trans );
121 digitize.init ( 0, MyHelix::getPeriod(), 0.001 );
122 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
126 REQUIRE( digitalCurve.size ( ) > 0 );
129 digitalCurve.clear ( );
131 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
135 REQUIRE( digitalCurve.size ( ) > 0 );
136 REQUIRE( metaData.size ( ) > 0 );
137 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
144 typedef Knot_3_1 < Space > MyKnot;
145 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
149 MyDigitalCurve digitalCurve;
151 MyKnot knot( 10, 10, 10 );
155 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
159 REQUIRE( digitalCurve.size ( ) > 0 );
162 digitalCurve.clear ( );
164 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
168 REQUIRE( digitalCurve.size ( ) > 0 );
169 REQUIRE( metaData.size ( ) > 0 );
170 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
177 typedef Knot_3_2 < Space > MyKnot;
178 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
182 MyDigitalCurve digitalCurve;
184 MyKnot knot( 10, 10, 10 );
188 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
192 REQUIRE( digitalCurve.size ( ) > 0 );
195 digitalCurve.clear ( );
197 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
201 REQUIRE( digitalCurve.size ( ) > 0 );
202 REQUIRE( metaData.size ( ) > 0 );
203 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
210 typedef Knot_4_1 < Space > MyKnot;
211 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
215 MyDigitalCurve digitalCurve;
217 MyKnot knot( 10, 10, 10 );
221 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
225 REQUIRE( digitalCurve.size ( ) > 0 );
228 digitalCurve.clear ( );
230 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
234 REQUIRE( digitalCurve.size ( ) > 0 );
235 REQUIRE( metaData.size ( ) > 0 );
236 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
243 typedef Knot_4_3 < Space > MyKnot;
244 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
248 MyDigitalCurve digitalCurve;
250 MyKnot knot( 10, 10, 10 );
254 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
258 REQUIRE( digitalCurve.size ( ) > 0 );
261 digitalCurve.clear ( );
263 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
267 REQUIRE( digitalCurve.size ( ) > 0 );
268 REQUIRE( metaData.size ( ) > 0 );
269 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
276 typedef Knot_5_1 < Space > MyKnot;
277 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
281 MyDigitalCurve digitalCurve;
283 MyKnot knot( 10, 10, 10 );
287 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
291 REQUIRE( digitalCurve.size ( ) > 0 );
294 digitalCurve.clear ( );
296 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
300 REQUIRE( digitalCurve.size ( ) > 0 );
301 REQUIRE( metaData.size ( ) > 0 );
302 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
309 typedef Knot_5_2 < Space > MyKnot;
310 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
314 MyDigitalCurve digitalCurve;
316 MyKnot knot( 10, 10, 10 );
320 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
324 REQUIRE( digitalCurve.size ( ) > 0 );
327 digitalCurve.clear ( );
329 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
333 REQUIRE( digitalCurve.size ( ) > 0 );
334 REQUIRE( metaData.size ( ) > 0 );
335 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
342 typedef Knot_6_2 < Space > MyKnot;
343 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
347 MyDigitalCurve digitalCurve;
349 MyKnot knot( 10, 10, 10 );
353 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
357 REQUIRE( digitalCurve.size ( ) > 0 );
360 digitalCurve.clear ( );
362 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
366 REQUIRE( digitalCurve.size ( ) > 0 );
367 REQUIRE( metaData.size ( ) > 0 );
368 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
375 typedef Knot_7_4 < Space > MyKnot;
376 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
380 MyDigitalCurve digitalCurve;
382 MyKnot knot( 10, 10, 10 );
386 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ) );
390 REQUIRE( digitalCurve.size ( ) > 0 );
393 digitalCurve.clear ( );
395 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
399 REQUIRE( digitalCurve.size ( ) > 0 );
400 REQUIRE( metaData.size ( ) > 0 );
401 REQUIRE( metaData.size ( ) == digitalCurve.size ( ) );
std::vector< std::pair< long double, unsigned int > > MetaData
std::vector< Point > DigitalCurve
Digital curve type.
Aim: Implements basic operations that will be used in Point and Vector classes.
DGtal is the top-level namespace which contains all DGtal functions and types.
TEST_CASE("Elliptic Helix test")
void digitize(Shape &shape, std::vector< SCell > &sCells0, std::vector< SCell > &sCells1, KSpace &kspace, const double h)
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))