|
Krita Source Code Documentation
|
A KoPathSegment consist of two neighboring KoPathPoints. More...
#include <KoPathSegment.h>
Inheritance diagram for KoPathSegment:Public Member Functions | |
| QRectF | boundingRect () const |
| Returns the axis aligned tight bounding rect. | |
| qreal | chordLength () const |
| Returns the chord length, i.e. the distance between first and last control point. | |
| QRectF | controlPointRect () const |
| Returns the control point bounding rect. | |
| QList< QPointF > | controlPoints () const |
| Returns ordered list of control points. | |
| QList< QPointF > | convexHull () const |
| Returns the convex hull polygon of the segment. | |
| void | deCasteljau (qreal t, QPointF *p1, QPointF *p2, QPointF *p3, QPointF *p4, QPointF *p5) const |
| int | degree () const |
| Returns the degree of the segment: 1 = line, 2 = quadratic, 3 = cubic, -1 = invalid. | |
| qreal | distanceFromChord (const QPointF &point) const |
| calculates signed distance of given point from segment chord | |
| QList< qreal > | extrema () const |
| Returns parameters for curve extrema. | |
| KoPathPoint * | first () const |
| Returns the first point of the segment. | |
| QList< QPointF > | intersections (const KoPathSegment &segment) const |
| Returns list of intersections with the given path segment. | |
| bool | isFlat (qreal tolerance=0.01) const |
| bool | isValid () const |
| Returns if segment is valid, e.g. has two valid points. | |
| KoPathSegment (const KoPathSegment &segment) | |
| Constructs segment by copying another segment. | |
| KoPathSegment (const QPointF &p0, const QPointF &p1) | |
| Creates a new line segment. | |
| KoPathSegment (const QPointF &p0, const QPointF &p1, const QPointF &p2) | |
| Creates a new quadratic segment. | |
| KoPathSegment (const QPointF &p0, const QPointF &p1, const QPointF &p2, const QPointF &p3) | |
| Creates a new cubic segment. | |
| KoPathSegment (KoPathPoint *first=0, KoPathPoint *second=0) | |
| qreal | length (qreal error=0.005) const |
| qreal | lengthAt (qreal t, qreal error=0.005) const |
| QList< QPointF > | linesIntersection (const KoPathSegment &segment) const |
| Returns intersection of lines if one exists. | |
| KoPathSegment | mapped (const QTransform &matrix) const |
| Returns transformed segment. | |
| qreal | nearestPoint (const QPointF &point) const |
| KoPathSegment & | operator= (const KoPathSegment &other) |
| Assigns segment. | |
| bool | operator== (const KoPathSegment &other) const |
| Compare operator. | |
| qreal | paramAtLength (qreal length, qreal tolerance=0.001) const |
| QPointF | pointAt (qreal t) const |
| Returns point at given t. | |
| Private (KoPathSegment *qq, KoPathPoint *p1, KoPathPoint *p2) | |
| QList< qreal > | roots () const |
| Returns parameters for curve roots. | |
| KoPathPoint * | second () const |
| Returns the second point of the segment. | |
| void | setFirst (KoPathPoint *first) |
| Sets the first segment point. | |
| void | setSecond (KoPathPoint *second) |
| Sets the second segment point. | |
| QPair< KoPathSegment, KoPathSegment > | splitAt (qreal t) const |
| Splits segment at given position returning the two resulting segments. | |
| KoPathSegment | toCubic () const |
| Returns cubic bezier curve segment of this segment. | |
| ~KoPathSegment () | |
| Destroys the path segment. | |
Static Public Member Functions | |
| static KoPathSegment | interpolate (const QPointF &p0, const QPointF &p1, const QPointF &p2, qreal t) |
Public Attributes | |
| KoPathPoint * | first |
| KoPathSegment * | q |
| KoPathPoint * | second |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Additional Inherited Members | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
A KoPathSegment consist of two neighboring KoPathPoints.
Definition at line 18 of file KoPathSegment.cpp.
|
explicit |
Creates a new segment from the given path points It takes ownership of the path points which do not have a parent path shape set.
Definition at line 313 of file KoPathSegment.cpp.
| KoPathSegment::KoPathSegment | ( | const KoPathSegment & | segment | ) |
Constructs segment by copying another segment.
Definition at line 318 of file KoPathSegment.cpp.
References first, KoPathPoint::parent(), second, setFirst(), and setSecond().
| KoPathSegment::KoPathSegment | ( | const QPointF & | p0, |
| const QPointF & | p1 ) |
| KoPathSegment::KoPathSegment | ( | const QPointF & | p0, |
| const QPointF & | p1, | ||
| const QPointF & | p2 ) |
| KoPathSegment::KoPathSegment | ( | const QPointF & | p0, |
| const QPointF & | p1, | ||
| const QPointF & | p2, | ||
| const QPointF & | p3 ) |
| KoPathSegment::~KoPathSegment | ( | ) |
| QRectF KoPathSegment::boundingRect | ( | ) | const |
Returns the axis aligned tight bounding rect.
Definition at line 479 of file KoPathSegment.cpp.
| qreal KoPathSegment::chordLength | ( | ) | const |
Returns the chord length, i.e. the distance between first and last control point.
| QRectF KoPathSegment::controlPointRect | ( | ) | const |
Returns the control point bounding rect.
Definition at line 454 of file KoPathSegment.cpp.
References controlPoints(), degree(), isValid(), and p.
| QList< QPointF > KoPathSegment::controlPoints | ( | ) | const |
Returns ordered list of control points.
Definition at line 1021 of file KoPathSegment.cpp.
References controlPoints(), and d.
| QList< QPointF > KoPathSegment::convexHull | ( | ) | const |
Returns the convex hull polygon of the segment.
Definition at line 913 of file KoPathSegment.cpp.
| void KoPathSegment::deCasteljau | ( | qreal | t, |
| QPointF * | p1, | ||
| QPointF * | p2, | ||
| QPointF * | p3, | ||
| QPointF * | p4, | ||
| QPointF * | p5 ) const |
The DeCasteljau algorithm for parameter t.
| t | the parameter to evaluate at |
| p1 | the new control point of the segment start (for cubic curves only) |
| p2 | the first control point at t |
| p3 | the new point at t |
| p4 | the second control point at t |
| p3 | the new control point of the segment end (for cubic curves only) |
| int KoPathSegment::degree | ( | ) | const |
Returns the degree of the segment: 1 = line, 2 = quadratic, 3 = cubic, -1 = invalid.
Definition at line 424 of file KoPathSegment.cpp.
References d.
| qreal KoPathSegment::distanceFromChord | ( | const QPointF & | point | ) | const |
calculates signed distance of given point from segment chord
| QList< qreal > KoPathSegment::extrema | ( | ) | const |
Returns parameters for curve extrema.
| KoPathPoint * KoPathSegment::first | ( | ) | const |
Returns the first point of the segment.
|
static |
Interpolates quadric bezier curve.
Definition at line 1042 of file KoPathSegment.cpp.
References KoPathSegment(), p0, p1, and p2.
| QList< QPointF > KoPathSegment::intersections | ( | const KoPathSegment & | segment | ) | const |
Returns list of intersections with the given path segment.
Definition at line 512 of file KoPathSegment.cpp.
References KoPathPoint::activeControlPoint2, boundingRect(), KoPathPoint::controlPoint1, KoPathPoint::controlPoint2, convexHull(), d, degree(), first, intersections(), isValid(), KoPathSegment(), p0, p1, p2, p3, KoPathPoint::point, pointAt(), second, and splitAt().
| bool KoPathSegment::isFlat | ( | qreal | tolerance = 0.01 | ) | const |
Checks if the segment is flat, i.e. the height smaller then the given tolerance
| tolerance | the flatness tolerance |
Definition at line 875 of file KoPathSegment.cpp.
| bool KoPathSegment::isValid | ( | ) | const |
Returns if segment is valid, e.g. has two valid points.
Definition at line 407 of file KoPathSegment.cpp.
References d.
| qreal KoPathSegment::length | ( | qreal | error = 0.005 | ) | const |
Returns the length of the path segment
| error | the error tolerance |
Definition at line 760 of file KoPathSegment.cpp.
References controlPoints(), d, degree(), and splitAt().
| qreal KoPathSegment::lengthAt | ( | qreal | t, |
| qreal | error = 0.005 ) const |
Returns segment length at given parameter
Splits the segment at the given parameter t and calculates the length of the first segment of the split.
| t | curve parameter to get length at |
| error | the error tolerance |
Definition at line 822 of file KoPathSegment.cpp.
| QList< QPointF > KoPathSegment::linesIntersection | ( | const KoPathSegment & | segment | ) | const |
Returns intersection of lines if one exists.
| KoPathSegment KoPathSegment::mapped | ( | const QTransform & | matrix | ) | const |
Returns transformed segment.
Definition at line 718 of file KoPathSegment.cpp.
References d, isValid(), KoPathSegment(), p1, and p2.
| qreal KoPathSegment::nearestPoint | ( | const QPointF & | point | ) | const |
Returns the parameter for the curve point nearest to the given point
| point | the point to find nearest point to |
Definition at line 1034 of file KoPathSegment.cpp.
References controlPoints(), isValid(), and KisBezierUtils::nearestPoint().
| KoPathSegment & KoPathSegment::operator= | ( | const KoPathSegment & | other | ) |
Assigns segment.
Definition at line 356 of file KoPathSegment.cpp.
References first, KoPathPoint::parent(), second, setFirst(), and setSecond().
| bool KoPathSegment::operator== | ( | const KoPathSegment & | other | ) | const |
Compare operator.
Definition at line 412 of file KoPathSegment.cpp.
| qreal KoPathSegment::paramAtLength | ( | qreal | length, |
| qreal | tolerance = 0.001 ) const |
Returns the curve parameter at the given length of the segment
If the specified length is negative it returns 0.0. If the specified length is bigger that the actual length of the segment it return 1.0.
| length | the length to get the curve parameter for |
| tolerance | the length error tolerance |
Definition at line 833 of file KoPathSegment.cpp.
References d, degree(), length(), and lengthAt().
| QPointF KoPathSegment::pointAt | ( | qreal | t | ) | const |
Returns point at given t.
Definition at line 438 of file KoPathSegment.cpp.
|
inline |
Definition at line 21 of file KoPathSegment.cpp.
| QList< qreal > KoPathSegment::roots | ( | ) | const |
Returns parameters for curve roots.
| KoPathPoint * KoPathSegment::second | ( | ) | const |
Returns the second point of the segment.
| void KoPathSegment::setFirst | ( | KoPathPoint * | first | ) |
| void KoPathSegment::setSecond | ( | KoPathPoint * | second | ) |
| QPair< KoPathSegment, KoPathSegment > KoPathSegment::splitAt | ( | qreal | t | ) | const |
Splits segment at given position returning the two resulting segments.
Definition at line 983 of file KoPathSegment.cpp.
References d, degree(), isValid(), KoPathSegment(), p, second, and KoPathPoint::setControlPoint1().
| KoPathSegment KoPathSegment::toCubic | ( | ) | const |
Returns cubic bezier curve segment of this segment.
Definition at line 731 of file KoPathSegment.cpp.
References d, degree(), isValid(), KoPathSegment(), p1, and p2.
|
private |
Definition at line 144 of file KoPathSegment.h.
| KoPathPoint * KoPathSegment::first |
Definition at line 54 of file KoPathSegment.cpp.
| KoPathSegment* KoPathSegment::q |
Definition at line 56 of file KoPathSegment.cpp.
| KoPathPoint * KoPathSegment::second |
Definition at line 55 of file KoPathSegment.cpp.