57unsigned char findMainAxis (
const T & curve,
const long double & t )
60 value[0] = std::abs ( curve.xp ( t )[0] );
61 value[1] = std::abs ( curve.xp ( t )[1] );
62 value[2] = std::abs ( curve.xp ( t )[2] );
64 if ( value[0] >= value[1] && value[0] >= value[2] )
66 else if ( value[1] >= value[0] && value[1] >= value[2] )
73int main(
int argc,
char** argv )
75 QApplication application(argc,argv);
77 typedef EllipticHelix < Space > MyHelix;
78 typedef ForwardRigidTransformation3D < Space, RealPoint, RealPoint, Identity > ForwardTrans;
79 typedef DecoratorParametricCurveTransformation < MyHelix, ForwardTrans > MyRotatedCurve;
80 typedef NaiveParametricCurveDigitizer3D < MyRotatedCurve > Digitizer;
84 trace.
info() <<
"exampleParamCurve3dDigitizationTransformationDecorator" << endl;
91 MyDigitalCurve digitalCurve;
92 MyHelix helix( 30, 20, 1 );
96 double angle = M_PI/3.;
99 MyRotatedCurve rotCurve ( helix, trans );
105 digitize.init ( 0, MyHelix::getPeriod() * 10., 0.0001 );
106 digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
109 trace.
info() <<
"Number of points: " << digitalCurve.size () <<
" number of metadata: " << metaData.size () << endl;
112 for (
unsigned int i = 0; i < digitalCurve.size ( ); i++ )
114 if (
findMainAxis ( rotCurve, metaData.at ( i ).first ) == 0 )
116 if (
findMainAxis ( rotCurve, metaData.at ( i ).first ) == 1 )
118 if (
findMainAxis ( rotCurve, metaData.at ( i ).first ) == 2 )
120 viewer <<
SetMode3D ( digitalCurve.at ( i ).className ( ),
"PavingWired" ) << digitalCurve.at ( i );
122 viewer << Viewer3D<>::updateDisplay;
124 return application.exec();
void digitize(Shape &shape, std::vector< SCell > &sCells0, std::vector< SCell > &sCells1, KSpace &kspace, const double h)