39#include "DGtal/arithmetic/LighterSternBrocot.h"
40#include "DGtal/arithmetic/Pattern.h"
49void usage(
int,
char** argv )
51 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <p> <q> [SUB]" << std::endl;
52 std::cerr <<
"\t - computes the pattern of slope p / q and displays it." << std::endl;
53 std::cerr <<
"\t - the optional [SUB] parameter displays the pattern with its recursive Berstel decomposition." << std::endl;
59int main(
int argc,
char** argv )
71 typedef SB::Fraction Fraction;
78 MyPattern pattern( p, q );
82 bool sub = ( argc > 3 ) && ( std::string( argv[ 3 ] ) ==
"SUB" );
83 std::cout << ( ! sub ? pattern.rE() : pattern.rEs(
"(|)" ) ) << std::endl;
Aim: The Stern-Brocot tree is the tree of irreducible fractions. This class allows to construct it pr...
Aim: This class represents a pattern, i.e. the path between two consecutive upper leaning points on a...
Point::Coordinate Integer
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int32_t int32_t
signed 32-bit integer.