33#include "DGtal/base/Common.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "ConfigExamples.h"
37#include "DGtal/geometry/curves/parametric/Knot_3_1.h"
38#include "DGtal/geometry/curves/parametric/NaiveParametricCurveDigitizer3D.h"
40#ifdef DGTAL_WITH_POLYSCOPE
41#include "DGtal/io/viewers/PolyscopeViewer.h"
53unsigned char findMainAxis (
const T & curve,
const long double & t )
56 value[0] = std::abs ( curve.xp ( t )[0] );
57 value[1] = std::abs ( curve.xp ( t )[1] );
58 value[2] = std::abs ( curve.xp ( t )[2] );
60 if ( value[0] >= value[1] && value[0] >= value[2] )
62 else if ( value[1] >= value[0] && value[1] >= value[2] )
53unsigned char findMainAxis (
const T & curve,
const long double & t ) {
…}
69int main(
int argc,
char** argv )
72 typedef NaiveParametricCurveDigitizer3D < MyKnot > Digitizer;
76 trace.info() <<
"exampleParamCurve3dDigitization" << endl;
80 MyDigitalCurve digitalCurve;
82 MyKnot knot ( 10, 10, 10 );
86 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
88 trace.info() <<
"Number of points: " << digitalCurve.size () <<
" number of metadata: " << metaData.size () << endl;
90 for (
unsigned int i = 0; i < digitalCurve.size ( ); i++ )
92 if (
findMainAxis ( knot, metaData.at ( i ).first ) == 0 )
94 if (
findMainAxis ( knot, metaData.at ( i ).first ) == 1 )
96 if (
findMainAxis ( knot, metaData.at ( i ).first ) == 2 )
98 viewer << digitalCurve.at ( i );
69int main(
int argc,
char** argv ) {
…}
Structure representing an RGB triple with alpha component.
void drawColor(const DGtal::Color &color)
Aim: Implement a parametrized knot 3, 1.
std::vector< std::pair< long double, unsigned int > > MetaData
std::vector< Point > DigitalCurve
Digital curve type.
void show() override
Starts the event loop and display of elements.
unsigned char findMainAxis(const T &curve, const long double &t)
unsigned char findMainAxis(const T &curve, const long double &t)
Z3i this namespace gathers the standard of types for 3D imagery.
Space::RealPoint RealPoint
functors namespace gathers all DGtal functors.
DGtal is the top-level namespace which contains all DGtal functions and types.
void digitize(Shape &shape, std::vector< SCell > &sCells0, std::vector< SCell > &sCells1, KSpace &kspace, const double h)