#include <cstdlib>
{
Board::disableLineWidthScaling();
board <<
Bezier(
Point(10, 10),
Point(10, 10) +
Point(5, 5),
Point(30, 10),
Point(30, 10) +
Point(-5, 5), Color::Red).
rotated(45);
Bezier b(
Point(0, 0),
Point(0, 0) +
Point(0, 20),
Point(-30, 0),
Point(-30, 0) +
Point(0, -15), Color::Green, Color::Null, 1.0);
l << b;
lb << b3;
std::cout <<
Path(ex, Path::Open) << std::endl;
for (
const Point & p : ex) {
lb << cross(p);
}
lb << bezierControls(b3);
l << b;
l << b.
rotated(45 * Board::Degree);
l << dp;
std::vector<Point> c = {
Point(125, 75),
Point(-25, 75)};
l << b2;
std::cout <<
Path(ex, Path::Open);
for (
const Point & p : ex) {
l << cross(p);
}
l << bezierControls(b2);
l <<
Polyline(ex, Path::Open, Color::Magenta);
{
l << cross(y0);
l << cross(y1);
l << cross(y2);
l << cross(y3);
Bezier b = Bezier::interpolation(y0, y1, y2, y3);
l << b;
Path p = {y0, y1, y2, y3};
board.
append(Bezier::smoothedPolyline(p, 0.5));
}
board.
saveSVG(
"bezier.svg", PageSize::BoundingBox);
}
Declaration of the Board class.
int main(int argc, char *argv[])
Definition arithmetic.cpp:16
Polyline rectangle(double left, double top, double width, double height, Color penColor=Style::defaultPenColor(), Color fillColor=Style::defaultFillColor(), double lineWidth=Style::defaultLineWidth(), const LineStyle lineStyle=Style::defaultLineStyle(), const LineCap cap=Style::defaultLineCap(), const LineJoin join=Style::defaultLineJoin())
Definition Polyline.cpp:569
A Bezier curve described by two series of 2D points (curve points and control points).
Definition Bezier.h:42
std::vector< Point > pathThroughLocalExtremums() const
A path through local extremums.
Definition Bezier.cpp:269
Rect boundingBox(LineWidthFlag) const override
Return the bounding box of the curve.
Definition Bezier.cpp:617
Bezier scaled(double sx, double sy) const
Definition Bezier.cpp:184
Bezier rotated(double angle, const Point ¢er) const
Rotated copy of the curve.
Definition Bezier.cpp:119
Path discretizedPath() const
A sequence of properly spaced points approximating the curve.
Definition Bezier.cpp:327
Class for EPS, FIG or SVG drawings.
Definition Board.h:61
Board & setPenColor(const Color &color)
Definition Board.cpp:244
Board & setFillColor(const Color &color)
Definition Board.cpp:268
Board & setLineWidth(double width)
Definition Board.cpp:274
void saveSVG(const char *filename, PageSize size=PageSize::BoundingBox, double margin=0.0, Unit unit=Unit::Millimeter) const
Definition Board.cpp:765
A path, according to Postscript and SVG definition.
Definition Path.h:45
const std::vector< Point > & points() const
Definition Path.cpp:371
Path rotated(double angle, const Point ¢er) const
Return a rotated copy of the path, thanks to an angle and a rotation center.
Definition Path.cpp:93
Struct representing a 2D point.
Definition Point.h:42
A polygonal line described by a series of 2D points.
Definition Polyline.h:38
A group of shapes.
Definition ShapeList.h:47
Rect boundingBox(LineWidthFlag) const override
Definition ShapeList.cpp:405
ShapeList scaled(double sx, double sy) const
Definition ShapeList.cpp:352
ShapeList & append(const Shape &shape, Direction direction=Direction::Right, Alignment alignment=Alignment::Center, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
Definition ShapeList.cpp:232
ShapeList translated(double dx, double dy)
Definition ShapeList.cpp:325
ShapeList rotated(double angle, const Point ¢er)
Definition ShapeList.cpp:298
ShapeList & clear()
Definition ShapeList.cpp:90