/*
9 * Copyright (C) 2018 Authors
10 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
36 std::cout <<
"path: " <<
descr_cmd.size() <<
" commands." << std::endl;
39 std::cout << std::endl;
42 std::cout << std::endl;
97 if ( at < 0 || at >
int(
descr_cmd.size()) ) {
139 if ( at < 0 || at >
int(
descr_cmd.size()) ) {
163 if ( at < 0 || at >
int(
descr_cmd.size()) ) {
188 if ( at < 0 || at >
int(
descr_cmd.size()) ) {
201 bool iLargeArc,
bool iClockwise)
213 bool iLargeArc,
bool iClockwise,
int at)
215 if ( at < 0 || at >
int(
descr_cmd.size()) ) {
220 ArcTo(iPt, iRx, iRy, angle, iLargeArc, iClockwise);
225 angle, iLargeArc, iClockwise));
257 return AddPoint (iPt, -1, 0.0, mvto);
260 if ( !mvto && !
pts.empty() &&
pts.back().p == iPt ) {
264 int const n =
pts.size();
275 if ( !mvto && !
pts.empty() &&
pts.back().p == iPt ) {
279 int const n =
pts.size();
290 int const n =
pts.size();
308 std::vector<path_lineto>::const_iterator i =
pts.begin();
313 for (; i !=
pts.end(); ++i) {
314 r = std::max(r, i->p[
Geom::X]);
315 l = std::min(l, i->p[
Geom::X]);
316 b = std::max(b, i->p[
Geom::Y]);
317 t = std::min(t, i->p[
Geom::Y]);
330 if (piece < 0 || piece >=
int(
descr_cmd.size())) {
338 int const typ = theD->
getType();
345 return PointAt (piece + 1, 0.0, pos);
349 return PointAt (piece - 1, 1.0, pos);
354 TangentOnSegAt(at,
PrevPoint (piece - 1), *nData, pos, tgt,
len);
359 TangentOnArcAt(at,
PrevPoint (piece - 1), *nData, pos, tgt,
len, rad);
364 TangentOnCubAt(at,
PrevPoint (piece - 1), *nData,
false, pos, tgt,
len, rad);
370 if (piece < 0 || piece >=
int(
descr_cmd.size())) {
393 TangentOnSegAt(at,
PrevPoint (piece - 1), dst, pos, tgt,
len);
403 TangentOnSegAt(at,
PrevPoint (piece - 1), *nData, pos, tgt,
len);
408 TangentOnArcAt (at,
PrevPoint (piece - 1), *nData, pos, tgt,
len, rad);
413 TangentOnCubAt (at,
PrevPoint (piece - 1), *nData,
false, pos, tgt,
len, rad);
434 int const typ = i->getType();
555 np = lastP + nData->
start;
581 for (
int i = 0; i <
descr_cmd.size(); i++) {
592 if (piece < 0 || piece >=
int(
descr_cmd.size())) {
597 int const typ = theD->
getType();
TODO: insert short description here.
3x3 matrix representing an affine transformation.
Two-dimensional point that doubles as a vector.
Path and its polyline approximation.
int LineTo(Geom::Point const &ip)
Appends a LineTo path command.
void SetBackData(bool nVal)
Sets the back variable to the value passed in and clears the polyline approximation.
void InsertLineTo(Geom::Point const &iPt, int at)
int Close()
Appends a close path command.
void ResetPoints()
Clears the polyline approximation.
int ArcTo(Geom::Point const &ip, double iRx, double iRy, double angle, bool iLargeArc, bool iClockwise)
Appends an ArcTo path command.
void PointAt(int piece, double at, Geom::Point &pos)
int AddForcedPoint()
Adds a forced point to the polyline approximation's list of points.
std::string svg_dump_path() const
std::vector< path_lineto > pts
void Transform(const Geom::Affine &trans)
Apply a transformation on all path commands.
void LoadPathVector(Geom::PathVector const &pv, Geom::Affine const &tr, bool doTransformation)
Load a lib2geom Geom::PathVector in this path object.
void PointAndTangentAt(int piece, double at, Geom::Point &pos, Geom::Point &tgt)
Geom::PathVector MakePathVector() const
Create a lib2geom Geom::PathVector from this Path object.
int MoveTo(Geom::Point const &ip)
Appends a MoveTo path command.
void InsertArcTo(Geom::Point const &ip, double iRx, double iRy, double angle, bool iLargeArc, bool iClockwise, int at)
std::vector< ForcedSubdivision > forced_subdivisions
void Copy(Path *who)
Clear all stored path commands, resets flags and imports path commands from the passed Path object.
const Geom::Point PrevPoint(const int i) const
bool IsLineSegment(int piece)
void InsertCubicTo(Geom::Point const &ip, Geom::Point const &iStD, Geom::Point const &iEnD, int at)
void FastBBox(double &l, double &t, double &r, double &b)
int CubicTo(Geom::Point const &ip, Geom::Point const &iStD, Geom::Point const &iEnD)
Appends a CubicBezier path command.
std::vector< PathDescr * > descr_cmd
int AddPoint(Geom::Point const &iPt, bool mvto=false)
Adds a point to the polyline approximation's list of points.
void InsertMoveTo(Geom::Point const &iPt, int at)
void PolylineBoundingBox(double &l, double &t, double &r, double &b)
void InsertForcePoint(int at)
int ForcePoint()
Appends a forced point path command.
void Reset()
Clears all stored path commands and resets flags that are used by command functions while adding path...
TODO: insert short description here.
PathVector - a sequence of subpaths.
Elliptical Arc path command.
Cubic Bezier path command.
A forced point path command.
A base class for Livarot's path commands.