34#include "DGtal/base/Common.h"
35#include "DGtal/kernel/CPointPredicate.h"
36#include "DGtal/arithmetic/IntegerComputer.h"
37#include "DGtal/arithmetic/LighterSternBrocot.h"
38#include "DGtal/arithmetic/Pattern.h"
39#include "DGtal/arithmetic/StandardDSLQ0.h"
49template <
typename DSL>
51 const typename DSL::Point & A,
52 const typename DSL::Point & B )
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]
62template <
typename Fraction>
64 typename Fraction::Integer moda,
65 typename Fraction::Integer modb,
66 typename Fraction::Integer modx )
69 typedef typename Fraction::Integer
Integer;
70 typedef typename DSL::Point
Point;
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 );
104int main(
int argc,
char** argv)
107 typedef SB::Fraction Fraction;
108 typedef Fraction::Integer
Integer;
109 unsigned int nbtries = ( argc > 1 ) ? atoi( argv[ 1 ] ) : 10000;
110 Integer moda = ( argc > 2 ) ? atoll( argv[ 2 ] ) : 12000;
111 Integer modb = ( argc > 3 ) ? atoll( argv[ 3 ] ) : 12000;
112 Integer modx = ( argc > 4 ) ? atoll( argv[ 4 ] ) : 1000;
Aim: This class gathers several types and methods to make computation with integers.
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 testSubStandardDSLQ0()
bool checkSubStandardDSLQ0(const DSL &D, const typename DSL::Point &A, const typename DSL::Point &B)