33 #include "DGtal/base/Common.h" 34 #include "DGtal/kernel/CPointPredicate.h" 35 #include "DGtal/arithmetic/IntegerComputer.h" 36 #include "DGtal/arithmetic/SternBrocot.h" 37 #include "DGtal/arithmetic/Pattern.h" 38 #include "DGtal/arithmetic/StandardDSLQ0.h" 39 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.h" 43 using namespace DGtal;
49 template <
typename DSL>
54 typedef typename DSL::Integer Integer;
58 ConstIterator it = D.
begin( A );
59 ConstIterator it_end = D.end( B );
62 while ( ( dss.end() != it_end )
63 && ( dss.extendFront() ) ) {}
64 std::cout << D.a() <<
" " << D.b() <<
" " << D.mu() <<
" " 65 << dss.a() <<
" " << dss.b() <<
" " << dss.mu() <<
" " 66 << A[0] <<
" " << A[1] <<
" " << B[0] <<
" " << B[1]
108 template <
typename Fraction>
110 typename Fraction::Integer moda,
111 typename Fraction::Integer modb,
112 typename Fraction::Integer modx )
115 typedef typename Fraction::Integer Integer;
119 std::cout <<
"# a b mu a1 b1 mu1 Ax Ay Bx By" << std::endl;
120 for (
unsigned int i = 0; i < nbtries; ++i )
122 Integer a( rand() % moda + 1 );
123 Integer b( rand() % modb + 1 );
124 if ( ic.
gcd( a, b ) == 1 )
126 for ( Integer mu = 0; mu < 5; ++mu )
128 DSL D( a, b, rand() % (moda+modb) );
129 for ( Integer x = 0; x < 10; ++x )
131 Integer x1 = rand() % modx;
132 Integer x2 = x1 + 1 + ( rand() % modx );
133 Point A = D.lowestY( x1 );
134 Point B = D.lowestY( x2 );
135 checkSubArithmeticDSS<DSL>( D, A, B );
147 int main(
int argc,
char** argv)
150 typedef SB::Fraction Fraction;
151 typedef Fraction::Integer Integer;
152 unsigned int nbtries = ( argc > 1 ) ? atoi( argv[ 1 ] ) : 10000;
153 Integer moda = ( argc > 2 ) ? atoll( argv[ 2 ] ) : 12000;
154 Integer modb = ( argc > 3 ) ? atoll( argv[ 3 ] ) : 12000;
155 Integer modx = ( argc > 4 ) ? atoll( argv[ 4 ] ) : 1000;
156 testSubStandardDSLQ0<Fraction>( nbtries, moda, modb, modx );
Aim: Represents a digital straight line with slope in the first quadrant (Q0: x >= 0...
MyDigitalSurface::ConstIterator ConstIterator
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
ConstIterator begin() const
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.
bool checkSubArithmeticDSS(const DSL &D, const typename DSL::Point &A, const typename DSL::Point &B)
bool testSubStandardDSLQ0(unsigned int nbtries, typename Fraction::Integer moda, typename Fraction::Integer modb, typename Fraction::Integer 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...