34 #include "DGtal/base/Common.h"
35 #include "DGtal/kernel/CPointPredicate.h"
36 #include "DGtal/arithmetic/IntegerComputer.h"
37 #include "DGtal/arithmetic/LightSternBrocot.h"
38 #include "DGtal/arithmetic/Pattern.h"
39 #include "DGtal/arithmetic/StandardDSLQ0.h"
43 using namespace DGtal;
49 template <
typename DSL>
54 DSL S = D.reversedSmartDSS( A, B );
55 std::cout << D.a() <<
" " << D.b() <<
" " << D.mu() <<
" "
56 << S.a() <<
" " << S.b() <<
" " << S.mu() <<
" "
57 << A[0] <<
" " << A[1] <<
" " << B[0] <<
" " << B[1]
62 template <
typename Fraction>
73 std::cout <<
"# a b mu a1 b1 mu1 Ax Ay Bx By" << std::endl;
74 for (
unsigned int i = 0; i < nbtries; ++i )
78 if ( ic.
gcd( a, b ) == 1 )
80 for (
Integer mu = 0; mu < 5; ++mu )
82 DSL D( a, b, rand() % (moda+modb) );
83 for (
Integer x = 0; x < 10; ++x )
86 Integer x2 = x1 + 1 + ( rand() % modx );
87 Point A = D.lowestY( x1 );
88 Point B = D.lowestY( x2 );
89 checkSubStandardDSLQ0<DSL>( D, A, B );
101 int main(
int argc,
char** argv)
104 typedef SB::Fraction Fraction;
106 unsigned int nbtries = ( argc > 1 ) ? atoi( argv[ 1 ] ) : 10000;
107 Integer moda = ( argc > 2 ) ? atoll( argv[ 2 ] ) : 12000;
108 Integer modb = ( argc > 3 ) ? atoll( argv[ 3 ] ) : 12000;
109 Integer modx = ( argc > 4 ) ? atoll( argv[ 4 ] ) : 1000;
110 testSubStandardDSLQ0<Fraction>( nbtries, moda, modb, modx );
Integer gcd(IntegerParamType a, IntegerParamType b) const
Aim: The Stern-Brocot tree is the tree of irreducible fractions. This class allows to construct it pr...
Aim: Represents a digital straight line with slope in the first quadrant (Q0: x >= 0,...
Point::Coordinate Integer
DGtal is the top-level namespace which contains all DGtal functions and types.
bool checkSubStandardDSLQ0(const DSL &D, const typename DSL::Point &A, const typename DSL::Point &B)
int main(int argc, char **argv)
bool testSubStandardDSLQ0(unsigned int nbtries, typename Fraction::Integer moda, typename Fraction::Integer modb, typename Fraction::Integer modx)