DGtal  1.3.beta
exampleBezierCurve.cpp
Go to the documentation of this file.
1 
38 #include <iostream>
40 #include "ConfigExamples.h"
41 #include "DGtal/helpers/StdDefs.h"
42 #include "DGtal/base/Common.h"
43 
44 #include "DGtal/io/boards/Board2D.h"
46 
47 using namespace std;
48 using namespace DGtal;
49 
51 
52 int main( int argc, char** argv )
53 {
54  trace.beginBlock ( "Example exampleBezierCurve" );
55  trace.info() << "Args:";
56  for ( int i = 0; i < argc; ++i )
57  trace.info() << " " << argv[ i ];
58  trace.info() << endl;
59 
60  //control points
61  typedef PointVector<2,int> Point;
62  Point P(0,0), Q(4,4), R(8,0);
63 
64  //display
65  Board2D board;
66 
67  //with fill
68  board << SetMode(P.className(), "Grid") << P << Q << R;
69  board.drawQuadraticBezierCurve(P[0], P[1], Q[0], Q[1], R[0], R[1]);
70 
71  board.saveSVG("BezierCurve.svg", Board2D::BoundingBox, 5000 );
72  board.saveEPS("BezierCurve.eps", Board2D::BoundingBox, 5000 );
73  board.saveTikZ("BezierCurve.tikz", Board2D::BoundingBox, 5000 );
74  board.saveFIG("BezierCurve.fig", Board2D::BoundingBox, 5000 );
75 #ifdef WITH_CAIRO
76  board.saveCairo("BezierCurve.pdf", Board2D::CairoPDF);
77 #endif
78 
79  board.clear();
80  //without fill
81  board << SetMode(P.className(), "Grid") << P << Q << R;
82  board.setFillColor(Color::None);
83  board.drawQuadraticBezierCurve(P[0], P[1], Q[0], Q[1], R[0], R[1]);
84 
85  board.saveSVG("BezierCurve2.svg", Board2D::BoundingBox, 5000 );
86  board.saveEPS("BezierCurve2.eps", Board2D::BoundingBox, 5000 );
87  board.saveTikZ("BezierCurve2.tikz", Board2D::BoundingBox, 5000 );
88  board.saveFIG("BezierCurve2.fig", Board2D::BoundingBox, 5000 );
89 #ifdef WITH_CAIRO
90  board.saveCairo("BezierCurve2.pdf", Board2D::CairoPDF);
91 #endif
92 
93  trace.endBlock();
94  return 0;
95 }
96 // //
DGtal::Trace::endBlock
double endBlock()
LibBoard::Board::saveCairo
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1139
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
LibBoard::Board::clear
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition: Board.cpp:152
DGtal::ProbingMode::R
@ R
DGtal::Trace::info
std::ostream & info()
LibBoard::Board::drawQuadraticBezierCurve
void drawQuadraticBezierCurve(double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1)
Definition: Board.cpp:384
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
main
int main(int argc, char **argv)
Definition: exampleBezierCurve.cpp:52
LibBoard::Board::saveSVG
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
LibBoard::Board::saveFIG
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
Definition: Board.cpp:907
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
LibBoard::Board::saveEPS
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:805
LibBoard::Board::saveTikZ
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1219
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::SetMode
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Definition: Board2D.h:247
LibBoard::Board::setFillColor
Board & setFillColor(const DGtal::Color &color)
Definition: Board.cpp:322
Point
MyPointD Point
Definition: testClone2.cpp:383