DGtal 1.3.0
Loading...
Searching...
No Matches
io/boards/exampleBezierCurve.cpp

Example of bezier curve display in Board2D

visualization of resulting export.
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/io/boards/Board2D.h"
using namespace std;
using namespace DGtal;
int main( int argc, char** argv )
{
trace.beginBlock ( "Example exampleBezierCurve" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
//control points
Point P(0,0), Q(4,4), R(8,0);
//display
Board2D board;
//with fill
board << SetMode(P.className(), "Grid") << P << Q << R;
board.drawQuadraticBezierCurve(P[0], P[1], Q[0], Q[1], R[0], R[1]);
board.saveSVG("BezierCurve.svg", Board2D::BoundingBox, 5000 );
board.saveEPS("BezierCurve.eps", Board2D::BoundingBox, 5000 );
board.saveTikZ("BezierCurve.tikz", Board2D::BoundingBox, 5000 );
board.saveFIG("BezierCurve.fig", Board2D::BoundingBox, 5000 );
#ifdef WITH_CAIRO
board.saveCairo("BezierCurve.pdf", Board2D::CairoPDF);
#endif
board.clear();
//without fill
board << SetMode(P.className(), "Grid") << P << Q << R;
board.setFillColor(Color::None);
board.drawQuadraticBezierCurve(P[0], P[1], Q[0], Q[1], R[0], R[1]);
board.saveSVG("BezierCurve2.svg", Board2D::BoundingBox, 5000 );
board.saveEPS("BezierCurve2.eps", Board2D::BoundingBox, 5000 );
board.saveTikZ("BezierCurve2.tikz", Board2D::BoundingBox, 5000 );
board.saveFIG("BezierCurve2.fig", Board2D::BoundingBox, 5000 );
#ifdef WITH_CAIRO
board.saveCairo("BezierCurve2.pdf", Board2D::CairoPDF);
#endif
trace.endBlock();
return 0;
}
// //
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:71
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1219
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
Definition: Board.cpp:907
void drawQuadraticBezierCurve(double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1)
Definition: Board.cpp:384
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition: Board.cpp:152
Board & setFillColor(const DGtal::Color &color)
Definition: Board.cpp:322
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:805
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1139
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Definition: Board2D.h:247
int main()
Definition: testBits.cpp:56
MyPointD Point
Definition: testClone2.cpp:383