#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include "DGtal/arithmetic/LighterSternBrocot.h"
#include "DGtal/arithmetic/Pattern.h"
Go to the source code of this file.
|
void | usage (int, char **argv) |
|
int | main (int argc, char **argv) |
|
- Author
- Jacques-Olivier Lachaud (
jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr
) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
- Date
- 2012/02/06
An example file named pattern.
This file is part of the DGtal library.
Definition in file pattern.cpp.
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Main.
[pattern-types]
[pattern-types]
[pattern-instantiation]
[pattern-instantiation]
[pattern-process]
[pattern-process]
Definition at line 59 of file pattern.cpp.
60{
61 if ( argc < 3 )
62 {
63 usage( argc, argv );
64 return 1;
65 }
66
71 typedef SB::Fraction Fraction;
74
78 MyPattern pattern( p, q );
80
82 bool sub = ( argc > 3 ) && ( std::string( argv[ 3 ] ) == "SUB" );
83 std::cout << ( ! sub ? pattern.rE() : pattern.rEs( "(|)" ) ) << std::endl;
85 return 0;
86}
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
boost::int32_t int32_t
signed 32-bit integer.
◆ usage()
void usage |
( |
int |
, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 49 of file pattern.cpp.
50{
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;
54}