#include <cstdlib>
using namespace LibBoard;
int main(int, char *[])
{
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;
board.
append(b.rotated(45 * Board::Degree));
lb << b3;
auto ex = b3.pathThroughLocalExtremums();
std::cout <<
Path(ex, Path::OpenPath) << std::endl;
for (
const Point & p : ex) {
}
l << b;
l << b.
rotated(45 * Board::Degree);
l << LibBoard::rectangle(b.rotated(45 * Board::Degree).boundingBox(UseLineWidth), Color::Black, Color::Null, 1.0);
Polyline dp(b.discretizedPath().rotated(45 * Board::Degree), Color::Blue);
l << dp;
std::vector<Point> c = {
Point(125, 75),
Point(-25, 75)};
Bezier b2(p.
points(), c, Color::Green);
l << b2;
ex = b2.
pathThroughLocalExtremums();
std::cout <<
Path(ex, Path::OpenPath);
for (
const Point & p : ex) {
}
l <<
Polyline(ex, Path::OpenPath, Color::Magenta);
{
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", Board::BoundingBox);
board.
saveEPS(
"bezier.eps", Board::BoundingBox);
system("svgviewer bezier.svg");
}
void saveEPS(std::ostream &out, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter, const std::string &title=std::string()) const
Definition: Board.cpp:532
Board & setFillColor(const Color &color)
Definition: Board.cpp:268
A polygonal line described by a series of 2D points.
Definition: Polyline.h:38
static void disableLineWidthScaling()
Definition: Board.cpp:139
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
Definition: Board.cpp:758
Struct representing a 2D point.
Definition: Point.h:42
A cubice polygonal line described by a series of 2D points.
Definition: Bezier.h:40
Group cross(Point p, const Style &style=Style::defaultStyle())
Definition: Board.cpp:968
ShapeList translated(double dx, double dy)
Definition: ShapeList.cpp:339
A path, according to Postscript and SVG definition.
Definition: Path.h:45
ShapeList & clear()
Definition: ShapeList.cpp:86
Bezier scaled(double sx, double sy) const
Definition: Bezier.cpp:184
A group of shapes.
Definition: ShapeList.h:46
Polyline bezierControls(const Bezier &bezier, const Style &style=Style::defaultStyle())
Produce a polyline of the Biezer vertices and control points.
Definition: Board.cpp:976
Declaration of the Board class.
ShapeList rotated(double angle, const Point ¢er)
Definition: ShapeList.cpp:312
Class for EPS, FIG or SVG drawings.
Definition: Board.h:62
ShapeList scaled(double sx, double sy) const
Definition: ShapeList.cpp:366
Board & setPenColor(const Color &color)
Definition: Board.cpp:244
Board & setLineWidth(double width)
Definition: Board.cpp:274
ShapeList & append(const Shape &shape, Direction direction=ShapeList::Right, Alignment alignment=ShapeList::AlignCenter, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
Definition: ShapeList.cpp:246
Rect boundingBox(LineWidthFlag) const override
Definition: ShapeList.cpp:419