|
Krita Source Code Documentation
|
Namespaces | |
| namespace | Private |
Classes | |
| struct | DecomposedMatrix |
| class | HaltonSequenceGenerator |
| a simple class to generate Halton sequence More... | |
| class | OuterCircle |
| struct | PointTypeTraits |
| struct | PointTypeTraits< QPoint > |
| struct | PointTypeTraits< QPointF > |
| class | RightHalfPlane |
| class | VectorPath |
Enumerations | |
| enum | KisTransformComponent { Translate = 0x1 , Scale = 0x2 , Rotate = 0x4 , Shear = 0x8 , Project = 0x10 } |
Functions | |
| template<class Point > | |
| Point | abs (const Point &pt) |
| QPointF | absoluteToRelative (const QPointF &pt, const QRectF &rc) |
| qreal | absoluteToRelative (const qreal value, const QRectF &rc) |
| QRectF | absoluteToRelative (const QRectF &rel, const QRectF &rc) |
| template<template< class T > class Container, class Point > | |
| PointTypeTraits< Point >::rect_type | accumulateBounds (const Container< Point > &points) |
| template<template< class T > class Container, class Point , class Rect > | |
| void | accumulateBounds (const Container< Point > &points, Rect *bounds) |
| template<class Point , class Rect > | |
| void | accumulateBounds (const Point &pt, Rect *bounds) |
| template<class Point , class Rect > | |
| void | accumulateBoundsNonEmpty (const Point &pt, Rect *bounds) |
| void | adjustIfOnPolygonBoundary (const QPolygonF &poly, int polygonDirection, QPointF *pt) |
| QPointF | alignForZoom (const QPointF &pt, qreal zoom) |
| qreal | angleBetweenVectors (const QPointF &v1, const QPointF &v2) |
| QRect | approximateRectFromPoints (const QVector< QPoint > &points) |
| QRectF | approximateRectFromPoints (const QVector< QPointF > &points) |
| template<class Rect , class Point , bool alignPixels> | |
| Rect | approximateRectFromPointsImpl (const QVector< Point > &points) |
| QRect | approximateRectWithPointTransform (const QRect &rect, std::function< QPointF(QPointF)> func) |
| template<class Rect > | |
| Rect | blowRect (const Rect &rect, qreal coeff) |
| QPolygonF | calculateConvexHull (const QPolygonF &polygon) |
| calculateConvexHull Calculate the convex hull of the polygon using the QuickHull | |
| QPolygonF | calculateConvexHullFromPointsOverTheLine (const QPolygonF &points, const QLineF &line) |
| template<class Point , class Rect > | |
| Point | clampPoint (Point pt, const Rect &bounds) |
| QPolygonF | combineConvexHullParts (const QPolygonF &leftPolygon, QPolygonF &rightPolygon, bool triangular) |
| KisTransformComponents | compareTransformComponents (const QTransform &lhs, const QTransform &rhs) |
| KisTransformComponents | componentsForTransform (const QTransform &t) |
| template<typename T > | |
| T | copysign (T x, T y) |
| template<class Point > | |
| PointTypeTraits< Point >::rect_type | createRectFromCorners (Point corner1, Point corner2) |
| QRectF | createRectFromCorners (QLineF line) |
| void | cropLineToConvexPolygon (QLineF &line, const QPolygonF polygon, bool extendFirst, bool extendSecond) |
| void | cropLineToRect (QLineF &line, const QRect rect, bool extendFirst, bool extendSecond) |
| Crop line to rect; if it doesn't intersect, just return an empty line (QLineF()). | |
| template<class T > | |
| PointTypeTraits< T >::value_type | crossProduct (const T &a, const T &b) |
| QRectF | cutOffRect (const QRectF &rc, const KisAlgebra2D::RightHalfPlane &p) |
| qreal | directionBetweenPoints (const QPointF &p1, const QPointF &p2, qreal defaultAngle) |
| template<class T > | |
| std::enable_if< std::is_integral< T >::value, T >::type | divideFloor (T a, T b) |
| template<class T > | |
| PointTypeTraits< T >::value_type | dotProduct (const T &a, const T &b) |
| QPoint | ensureInRect (QPoint pt, const QRect &bounds) |
| QPointF | ensureInRect (QPointF pt, const QRectF &bounds) |
| template<class Point , class Rect > | |
| Point | ensureInRectImpl (Point pt, const Rect &bounds) |
| template<class Rect > | |
| Rect | ensureRectNotSmaller (Rect rc, const decltype(Rect().size()) &size) |
| template<class Size > | |
| Size | ensureSizeNotSmaller (const Size &size, const Size &bounds) |
| qreal | findMinimumGoldenSection (std::function< qreal(qreal)> f, qreal xA, qreal xB, qreal eps, int maxIter=100) |
| qreal | findMinimumTernarySection (std::function< qreal(qreal)> f, qreal xA, qreal xB, qreal eps, int maxIter=100) |
| QPointF | findNearestPointOnLine (const QPointF &point, const QLineF &line, bool unbounded) |
| QVector< QPointF > | findTrianglePoint (const QPointF &p1, const QPointF &p2, qreal a, qreal b) |
| boost::optional< QPointF > | findTrianglePointNearest (const QPointF &p1, const QPointF &p2, qreal a, qreal b, const QPointF &nearest) |
| Eigen::Matrix3d | fromQTransformStraight (const QTransform &t) |
| template<class Rect , typename Difference = decltype(Rect::width())> | |
| bool | fuzzyCompareRects (const Rect &r1, const Rect &r2, Difference tolerance) |
| bool | fuzzyMatrixCompare (const QTransform &t1, const QTransform &t2, qreal delta) |
| template<template< typename > class Cont, class Point > | |
| bool | fuzzyPointCompare (const Cont< Point > &c1, const Cont< Point > &c2, qreal delta) |
| bool | fuzzyPointCompare (const QPointF &p1, const QPointF &p2) |
| bool | fuzzyPointCompare (const QPointF &p1, const QPointF &p2, qreal delta) |
| QLineF | getLineFromElements (const QPainterPath &shape, int index) |
| QList< int > | getLineSegmentCrossingLineIndexes (const QLineF &line, const QPainterPath &shape) |
| QPainterPath | getOnePathFromRectangleCutThrough (const QList< QPointF > &points, const QLineF &line, bool left) |
| QList< QLineF > | getParallelLines (const QLineF &line, const qreal distance) |
| QList< QPainterPath > | getPathsFromRectangleCutThrough (const QRectF &rect, const QLineF &leftLine, const QLineF &rightLine) |
| getPathsFromRectangleCutThrough get paths defining both sides of a rectangle cut through using two (supposedly parallel) lines It is used in the Knife Tool If you just want to cut a rectangle, you can use the same line in both | |
| QList< QLineF > | intersectLineConcavePolygon (const QPolygonF polygon, const QLineF &line, bool extendFirst, bool extendSecond) |
| bool | intersectLineConvexPolygon (QLineF &line, const QPolygonF polygon, bool extendFirst, bool extendSecond) |
| bool | intersectLineRect (QLineF &line, const QRect rect, bool extend) |
| bool | intersectLineRect (QLineF &line, const QRect rect, bool extendFirst, bool extendSecond) |
| boost::optional< QPointF > | intersectLines (const QLineF &boundedLine, const QLineF &unboundedLine) |
| boost::optional< QPointF > | intersectLines (const QPointF &p1, const QPointF &p2, const QPointF &q1, const QPointF &q2) |
| QVector< QPointF > | intersectTwoCircles (const QPointF ¢er1, qreal r1, const QPointF ¢er2, qreal r2) |
| template<class T > | |
| T | inwardUnitNormal (const T &a, int polygonDirection) |
| template<typename T > | |
| bool | isInRange (T x, T a, T b) |
| bool | isInsideShape (const QPainterPath &path, const QPointF &point) |
| bool | isInsideShape (const VectorPath &path, const QPointF &point) |
| bool | isOnLine (const QLineF &line, const QPointF &point, const qreal eps, bool boundedStart, bool boundedEnd, bool includeEnds) |
| template<class Polygon , typename Difference = decltype(Polygon::first())> | |
| bool | isPolygonRect (const Polygon &poly, Difference tolerance) |
| template<class T > | |
| bool | isPolygonTrulyConvex (const QVector< T > &polygon) |
| template<typename R > | |
| R | lazyRound (qreal value) |
| template<> | |
| int | lazyRound< int > (qreal value) |
| template<> | |
| qreal | lazyRound< qreal > (qreal value) |
| template<class T > | |
| T | leftUnitNormal (const T &a) |
| template<typename Point > | |
| Point | lerp (const Point &pt1, const Point &pt2, qreal t) |
| template<typename T > | |
| T | linearReshapeFunc (T x, T x0, T x1, T y0, T y1) |
| int | lineSideForPoint (const QLineF &line, const QPointF &point) |
| KisTransformComponents | makeFullTransformComponents () |
| QTransform | mapToRect (const QRectF &rect) |
| QTransform | mapToRectInverse (const QRectF &rect) |
| template<class Size > | |
| auto | maxDimension (Size size) -> decltype(size.width()) |
| VectorPath | mergeShapesWithGutter (const VectorPath &shape1, const VectorPath &shape2, const VectorPath &oneEnd, const VectorPath &otherEnd, int index1, int index2, bool reverseSecondPoly, bool isSameShape) |
| mergeShapesWithGutter merges two shapes with a gutter shape (defined as two paths) | |
| template<class Size > | |
| auto | minDimension (Size size) -> decltype(size.width()) |
| QPointF | moveElasticPoint (const QPointF &pt, const QPointF &base, const QPointF &newBase, const QPointF &wingA, const QPointF &wingB) |
moveElasticPoint moves point pt based on the model of elasticity | |
| QPointF | moveElasticPoint (const QPointF &pt, const QPointF &base, const QPointF &newBase, const QVector< QPointF > &anchorPoints) |
moveElasticPoint moves point pt based on the model of elasticity | |
| QPointF | movePointAlongTheLine (const QPointF &point, const QLineF &direction, qreal distance, bool ensureOnLine) |
| movePointAlongTheLine moves the point a particular distance in the specified direction | |
| QPointF | movePointInTheDirection (const QPointF &point, const QPointF &direction, qreal distance) |
| movePointAlongTheLine moves the point a particular distance in the specified direction | |
| template<class T > | |
| qreal | norm (const T &a) |
| template<class Point > | |
| Point | normalize (const Point &a) |
| template<class T > | |
| qreal | normSquared (const T &a) |
| QDebug | operator<< (QDebug debug, const VectorPath &path) |
| QDebug | operator<< (QDebug debug, const VectorPath::VectorPathPoint &point) |
| qreal | pointToLineDistSquared (const QPointF &pt, const QLineF &line) |
| template<class T > | |
| int | polygonDirection (const QVector< T > &polygon) |
| Q_DECLARE_FLAGS (KisTransformComponents, KisTransformComponent) | |
| int | quadraticEquation (qreal a, qreal b, qreal c, qreal *x1, qreal *x2) |
| QPointF | relativeToAbsolute (const QPointF &pt, const QRectF &rc) |
| QRectF | relativeToAbsolute (const QRectF &rel, const QRectF &rc) |
| qreal | relativeToAbsolute (qreal value, const QRectF &rc) |
| QPainterPath | removeGutterOneEndSmart (const QPainterPath &shape1, int index1, const QPainterPath &shape2, int index2, QLineF middleLine, bool reverseFirstPoly, bool reverseSecondPoly) |
| QPainterPath | removeGutterSmart (const QPainterPath &shape1, int index1, const QPainterPath &shape2, int index2, bool isSameShape) |
| removeGutterSmart | |
| QLineF | reverseDirection (const QLineF &line) |
| template<class T > | |
| T | rightUnitNormal (const T &a) |
| QVector< QPoint > | sampleRectWithPoints (const QRect &rect) |
| QVector< QPointF > | sampleRectWithPoints (const QRectF &rect) |
| template<class Rect , class Point > | |
| QVector< Point > | sampleRectWithPoints (const Rect &rect) |
| template<typename T > | |
| T | signPZ (T x) |
| template<typename T > | |
| T | signZZ (T x) |
| QPainterPath | simplifyShape (const QPainterPath &path) |
| QPainterPath | smallArrow () |
| QTransform | toQTransformStraight (const Eigen::Matrix3d &m) |
| QPointF | transformAsBase (const QPointF &pt, const QPointF &base1, const QPointF &base2) |
| std::pair< QPointF, QTransform > | transformEllipse (const QPointF &axes, const QTransform &fullLocalToGlobal) |
| bool | tryMergePoints (QPainterPath &path, const QPointF &startPoint, const QPointF &endPoint, qreal &distance, qreal distanceThreshold, bool lastSegment) |
| QPainterPath | trySimplifyPath (const QPainterPath &path, qreal lengthThreshold) |
| trySimplifyPath Tries to simplify a QPainterPath | |
| template<typename T > | |
| T | wrapValue (T value, T min, T max) |
| template<typename T , typename std::enable_if< std::is_integral< T >::value, T >::type * = nullptr> | |
| T | wrapValue (T value, T wrapBounds) |
|
inline |
Definition at line 477 of file kis_algebra_2d.h.
|
inline |
Get the relative position of pt inside rectangle rc. The point can be outside the rectangle.
Definition at line 760 of file kis_algebra_2d.h.
|
inline |
Scales absolute isotropic value from absolute to relative coordinate system using SVG 1.1 rules (see chapter 7.10)
Definition at line 780 of file kis_algebra_2d.h.
|
inline |
Scales absolute isotropic value from absolute to relative coordinate system using SVG 1.1 rules (see chapter 7.10)
Definition at line 797 of file kis_algebra_2d.h.
References absoluteToRelative().
|
inline |
Definition at line 288 of file kis_algebra_2d.h.
References accumulateBounds().
|
inline |
Definition at line 279 of file kis_algebra_2d.h.
References accumulateBounds(), and bounds.
|
inline |
Rect::left() is cheaper than Rect::right(), so check it first
Rect::top() is cheaper than Rect::bottom(), so check it first
Definition at line 235 of file kis_algebra_2d.h.
References bounds, and KisAlgebra2D::Private::resetEmptyRectangle().
|
inline |
| void KRITAGLOBAL_EXPORT KisAlgebra2D::adjustIfOnPolygonBoundary | ( | const QPolygonF & | poly, |
| int | polygonDirection, | ||
| QPointF * | pt ) |
Definition at line 37 of file kis_algebra_2d.cpp.
References crossProduct(), dbgKrita, inwardUnitNormal(), isInRange(), KIS_ASSERT_RECOVER_NOOP, kisDistanceToLine(), p0, p1, polygonDirection(), ppVar, and salt.
| QPointF KRITAGLOBAL_EXPORT KisAlgebra2D::alignForZoom | ( | const QPointF & | pt, |
| qreal | zoom ) |
Definition at line 970 of file kis_algebra_2d.cpp.
| qreal KRITAGLOBAL_EXPORT KisAlgebra2D::angleBetweenVectors | ( | const QPointF & | v1, |
| const QPointF & | v2 ) |
Definition at line 111 of file kis_algebra_2d.cpp.
| QRect KRITAGLOBAL_EXPORT KisAlgebra2D::approximateRectFromPoints | ( | const QVector< QPoint > & | points | ) |
Definition at line 545 of file kis_algebra_2d.cpp.
| QRectF KRITAGLOBAL_EXPORT KisAlgebra2D::approximateRectFromPoints | ( | const QVector< QPointF > & | points | ) |
Definition at line 550 of file kis_algebra_2d.cpp.
| Rect KisAlgebra2D::approximateRectFromPointsImpl | ( | const QVector< Point > & | points | ) |
Definition at line 521 of file kis_algebra_2d.cpp.
| QRect KRITAGLOBAL_EXPORT KisAlgebra2D::approximateRectWithPointTransform | ( | const QRect & | rect, |
| std::function< QPointF(QPointF)> | func ) |
Definition at line 555 of file kis_algebra_2d.cpp.
References sampleRectWithPoints().
| Rect KisAlgebra2D::blowRect | ( | const Rect & | rect, |
| qreal | coeff ) |
Multiply width and height of rect by coeff keeping the center of the rectangle pinned
Definition at line 354 of file kis_algebra_2d.h.
| QPolygonF KRITAGLOBAL_EXPORT KisAlgebra2D::calculateConvexHull | ( | const QPolygonF & | polygon | ) |
calculateConvexHull Calculate the convex hull of the polygon using the QuickHull
| polygon | to find the convex hull of |
Definition at line 1412 of file kis_algebra_2d.cpp.
References calculateConvexHullFromPointsOverTheLine(), combineConvexHullParts(), and lineSideForPoint().
| QPolygonF KisAlgebra2D::calculateConvexHullFromPointsOverTheLine | ( | const QPolygonF & | points, |
| const QLineF & | line ) |
Definition at line 1356 of file kis_algebra_2d.cpp.
References calculateConvexHullFromPointsOverTheLine(), combineConvexHullParts(), distance(), kisSquareDistanceToLine(), and lineSideForPoint().
|
inline |
| QPolygonF KisAlgebra2D::combineConvexHullParts | ( | const QPolygonF & | leftPolygon, |
| QPolygonF & | rightPolygon, | ||
| bool | triangular ) |
Definition at line 1327 of file kis_algebra_2d.cpp.
| KisTransformComponents KRITAGLOBAL_EXPORT KisAlgebra2D::compareTransformComponents | ( | const QTransform & | lhs, |
| const QTransform & | rhs ) |
Definition at line 43 of file KisTransformComponents.cpp.
References KisAlgebra2D::DecomposedMatrix::angle, KisAlgebra2D::DecomposedMatrix::dx, KisAlgebra2D::DecomposedMatrix::dy, KisAlgebra2D::DecomposedMatrix::proj, Project, qFuzzyCompare(), Rotate, Scale, KisAlgebra2D::DecomposedMatrix::scaleX, KisAlgebra2D::DecomposedMatrix::scaleY, Shear, KisAlgebra2D::DecomposedMatrix::shearXY, and Translate.
| KisTransformComponents KRITAGLOBAL_EXPORT KisAlgebra2D::componentsForTransform | ( | const QTransform & | t | ) |
Definition at line 19 of file KisTransformComponents.cpp.
References KisAlgebra2D::DecomposedMatrix::angle, KisAlgebra2D::DecomposedMatrix::dx, KisAlgebra2D::DecomposedMatrix::dy, KisAlgebra2D::DecomposedMatrix::proj, Project, qFuzzyCompare(), qFuzzyIsNull(), Rotate, Scale, KisAlgebra2D::DecomposedMatrix::scaleX, KisAlgebra2D::DecomposedMatrix::scaleY, Shear, KisAlgebra2D::DecomposedMatrix::shearXY, and Translate.
|
inline |
Copies the sign of y into x and returns the result
Definition at line 107 of file kis_algebra_2d.h.
|
inline |
Definition at line 323 of file kis_algebra_2d.h.
|
inline |
Definition at line 328 of file kis_algebra_2d.h.
References createRectFromCorners().
| void KRITAGLOBAL_EXPORT KisAlgebra2D::cropLineToConvexPolygon | ( | QLineF & | line, |
| const QPolygonF | polygon, | ||
| bool | extendFirst, | ||
| bool | extendSecond ) |
Definition at line 1300 of file kis_algebra_2d.cpp.
References intersectLineConvexPolygon().
| void KRITAGLOBAL_EXPORT KisAlgebra2D::cropLineToRect | ( | QLineF & | line, |
| const QRect | rect, | ||
| bool | extendFirst, | ||
| bool | extendSecond ) |
Crop line to rect; if it doesn't intersect, just return an empty line (QLineF()).
This is using intersectLineRect, but with the difference that it doesn't require the user to check the return value. It's useful for drawing code, since it let the developer not use if before drawing.
If the line intersects the rectangle, it will be modified to represent the intersecting line segment. If the line does not intersect the area, it will return an empty one-point line.
extendFirst and extendSecond parameters allow one to use this function in case of unbounded lines (if both are true), line segments (if both are false) or half-lines/rays (if one is true and another is false). Note that which point is the "first" and which is the "second" is determined by which is the p1() and which is p2() in QLineF.
| line | line segment |
| rect | area |
| extendFirst | extend the line to the edge of the rect area even if the first point of the line segment lies inside the rectangle |
| extendSecond | extend the line to the edge of the rect area even if the second point of the line segment lies inside the rectangle |
Definition at line 1292 of file kis_algebra_2d.cpp.
References intersectLineRect().
| PointTypeTraits< T >::value_type KisAlgebra2D::crossProduct | ( | const T & | a, |
| const T & | b ) |
Definition at line 57 of file kis_algebra_2d.h.
| KRITAGLOBAL_EXPORT QRectF KisAlgebra2D::cutOffRect | ( | const QRectF & | rc, |
| const KisAlgebra2D::RightHalfPlane & | p ) |
Cuts off a portion of a rect rc defined by a half-plane p
Definition at line 578 of file kis_algebra_2d.cpp.
References approximateRectFromPoints(), p, p1, and p2.
| qreal KRITAGLOBAL_EXPORT KisAlgebra2D::directionBetweenPoints | ( | const QPointF & | p1, |
| const QPointF & | p2, | ||
| qreal | defaultAngle ) |
Computes an angle indicating the direction from p1 to p2. If p1 and p2 are too close together to compute an angle, defaultAngle is returned.
Definition at line 119 of file kis_algebra_2d.cpp.
References fuzzyPointCompare(), p1, and p2.
| std::enable_if< std::is_integral< T >::value, T >::type KisAlgebra2D::divideFloor | ( | T | a, |
| T | b ) |
Definition at line 114 of file kis_algebra_2d.h.
| PointTypeTraits< T >::value_type KisAlgebra2D::dotProduct | ( | const T & | a, |
| const T & | b ) |
Definition at line 51 of file kis_algebra_2d.h.
| QPoint KRITAGLOBAL_EXPORT KisAlgebra2D::ensureInRect | ( | QPoint | pt, |
| const QRect & | bounds ) |
Definition at line 163 of file kis_algebra_2d.cpp.
References bounds, and ensureInRectImpl().
| QPointF KRITAGLOBAL_EXPORT KisAlgebra2D::ensureInRect | ( | QPointF | pt, |
| const QRectF & | bounds ) |
Definition at line 168 of file kis_algebra_2d.cpp.
References bounds, and ensureInRectImpl().
|
inline |
| Rect KisAlgebra2D::ensureRectNotSmaller | ( | Rect | rc, |
| const decltype(Rect().size()) & | size ) |
Definition at line 368 of file kis_algebra_2d.h.
| Size KisAlgebra2D::ensureSizeNotSmaller | ( | const Size & | size, |
| const Size & | bounds ) |
Definition at line 386 of file kis_algebra_2d.h.
References bounds, and copysign().
| qreal KRITAGLOBAL_EXPORT KisAlgebra2D::findMinimumGoldenSection | ( | std::function< qreal(qreal)> | f, |
| qreal | xA, | ||
| qreal | xB, | ||
| qreal | eps, | ||
| int | maxIter = 100 ) |
Definition at line 1484 of file kis_algebra_2d.cpp.
References eps.
| qreal KRITAGLOBAL_EXPORT KisAlgebra2D::findMinimumTernarySection | ( | std::function< qreal(qreal)> | f, |
| qreal | xA, | ||
| qreal | xB, | ||
| qreal | eps, | ||
| int | maxIter = 100 ) |
Definition at line 1517 of file kis_algebra_2d.cpp.
References eps.
| QPointF KRITAGLOBAL_EXPORT KisAlgebra2D::findNearestPointOnLine | ( | const QPointF & | point, |
| const QLineF & | line, | ||
| bool | unbounded ) |
Definition at line 1755 of file kis_algebra_2d.cpp.
References kisDistance().
| QVector< QPointF > KRITAGLOBAL_EXPORT KisAlgebra2D::findTrianglePoint | ( | const QPointF & | p1, |
| const QPointF & | p2, | ||
| qreal | a, | ||
| qreal | b ) |
Find possible positions for point p3, such that points \p1, \p2 and p3 form a triangle, such that the distance between p1 ad p3 is a and the distance between p2 and p3 is b. There might be 0, 1 or 2 such positions.
Definition at line 1017 of file kis_algebra_2d.cpp.
References A, B2(), C, dotProduct(), norm(), p, p1, p2, pow2(), and qFuzzyIsNull().
| boost::optional< QPointF > KRITAGLOBAL_EXPORT KisAlgebra2D::findTrianglePointNearest | ( | const QPointF & | p1, |
| const QPointF & | p2, | ||
| qreal | a, | ||
| qreal | b, | ||
| const QPointF & | nearest ) |
Find a point p3 that forms a triangle with \p1 and \p2 and is the nearest possible point to nearest
Definition at line 1081 of file kis_algebra_2d.cpp.
References findTrianglePoint(), kisDistance(), p1, and p2.
|
inline |
Definition at line 776 of file kis_algebra_2d.cpp.
| bool KisAlgebra2D::fuzzyCompareRects | ( | const Rect & | r1, |
| const Rect & | r2, | ||
| Difference | tolerance ) |
Compare two rectangles with tolerance tolerance. The tolerance means that the coordinates of top left and bottom right corners should not differ more than tolerance pixels.
Definition at line 842 of file kis_algebra_2d.h.
| bool KRITAGLOBAL_EXPORT KisAlgebra2D::fuzzyMatrixCompare | ( | const QTransform & | t1, |
| const QTransform & | t2, | ||
| qreal | delta ) |
Compare the matrices with tolerance delta
Definition at line 744 of file kis_algebra_2d.cpp.
| bool KisAlgebra2D::fuzzyPointCompare | ( | const Cont< Point > & | c1, |
| const Cont< Point > & | c2, | ||
| qreal | delta ) |
Returns true if points in two containers are equal with specified tolerance
Definition at line 821 of file kis_algebra_2d.h.
References eps.
| bool KRITAGLOBAL_EXPORT KisAlgebra2D::fuzzyPointCompare | ( | const QPointF & | p1, |
| const QPointF & | p2 ) |
Returns true if the two points are equal within some tolerance, where the tolerance is determined by Qt's built-in fuzzy comparison functions.
Definition at line 757 of file kis_algebra_2d.cpp.
References p1, p2, and qFuzzyCompare().
| bool KRITAGLOBAL_EXPORT KisAlgebra2D::fuzzyPointCompare | ( | const QPointF & | p1, |
| const QPointF & | p2, | ||
| qreal | delta ) |
| QLineF KisAlgebra2D::getLineFromElements | ( | const QPainterPath & | shape, |
| int | index ) |
Definition at line 1801 of file kis_algebra_2d.cpp.
References wrapValue().
| QList< int > KRITAGLOBAL_EXPORT KisAlgebra2D::getLineSegmentCrossingLineIndexes | ( | const QLineF & | line, |
| const QPainterPath & | shape ) |
Definition at line 2013 of file kis_algebra_2d.cpp.
References KisBezierUtils::bezierCurve(), KisAlgebra2D::VectorPath::VectorPathPoint::BezierTo, eps, KisBezierUtils::intersectWithLine(), isOnLine(), and p.
| QPainterPath KRITAGLOBAL_EXPORT KisAlgebra2D::getOnePathFromRectangleCutThrough | ( | const QList< QPointF > & | points, |
| const QLineF & | line, | ||
| bool | left ) |
Definition at line 1661 of file kis_algebra_2d.cpp.
References crossProduct(), and wrapValue().
| QList< QLineF > KRITAGLOBAL_EXPORT KisAlgebra2D::getParallelLines | ( | const QLineF & | line, |
| const qreal | distance ) |
Definition at line 1649 of file kis_algebra_2d.cpp.
References distance(), and movePointInTheDirection().
| QList< QPainterPath > KRITAGLOBAL_EXPORT KisAlgebra2D::getPathsFromRectangleCutThrough | ( | const QRectF & | rect, |
| const QLineF & | leftLine, | ||
| const QLineF & | rightLine ) |
getPathsFromRectangleCutThrough get paths defining both sides of a rectangle cut through using two (supposedly parallel) lines It is used in the Knife Tool If you just want to cut a rectangle, you can use the same line in both
| rect | rectangle to cut |
| leftLine | left line of the rectangle (used for the left-(top) side of the rectangle |
| rightLine | right line of the rectangle (used for the right-(bottom) side of the rectangle |
Definition at line 1730 of file kis_algebra_2d.cpp.
References getOnePathFromRectangleCutThrough().
| QList< QLineF > KisAlgebra2D::intersectLineConcavePolygon | ( | const QPolygonF | polygon, |
| const QLineF & | line, | ||
| bool | extendFirst, | ||
| bool | extendSecond ) |
Definition at line 1459 of file kis_algebra_2d.cpp.
References calculateConvexHull(), intersectLineConvexPolygon(), and KIS_ASSERT.
| bool KRITAGLOBAL_EXPORT KisAlgebra2D::intersectLineConvexPolygon | ( | QLineF & | line, |
| const QPolygonF | polygon, | ||
| bool | extendFirst, | ||
| bool | extendSecond ) |
Definition at line 251 of file kis_algebra_2d.cpp.
References A, B, intersectLines(), p1, p2, and qFuzzyCompare().
| bool KRITAGLOBAL_EXPORT KisAlgebra2D::intersectLineRect | ( | QLineF & | line, |
| const QRect | rect, | ||
| bool | extend ) |
Attempt to intersect a line to the area of the a rectangle.
If the line intersects the rectangle, it will be modified to represent the intersecting line segment and true is returned. If the line does not intersect the area, it remains unmodified and false will be returned. If the line is fully inside the rectangle, it's considered "intersecting" so true will be returned.
| line | line segment |
| rect | area |
| extend | extend the line to the edges of the rect area even if the line segment fits inside the rectangle (so, consider the line to be a line defined by those two points, not a line segment) |
Definition at line 173 of file kis_algebra_2d.cpp.
References intersectLineRect().
| bool KRITAGLOBAL_EXPORT KisAlgebra2D::intersectLineRect | ( | QLineF & | line, |
| const QRect | rect, | ||
| bool | extendFirst, | ||
| bool | extendSecond ) |
Attempt to intersect a line to the area of the a rectangle.
If the line intersects the rectangle, it will be modified to represent the intersecting line segment and true is returned. If the line does not intersect the area, it remains unmodified and false will be returned. If the line is fully inside the rectangle, it's considered "intersecting" so true will be returned.
extendFirst and extendSecond parameters allow one to use this function in case of unbounded lines (if both are true), line segments (if both are false) or half-lines/rays (if one is true and another is false). Note that which point is the "first" and which is the "second" is determined by which is the p1() and which is p2() in QLineF.
| line | line segment |
| rect | area |
| extendFirst | extend the line to the edge of the rect area even if the first point of the line segment lies inside the rectangle |
| extendSecond | extend the line to the edge of the rect area even if the second point of the line segment lies inside the rectangle |
Definition at line 178 of file kis_algebra_2d.cpp.
| KRITAGLOBAL_EXPORT boost::optional< QPointF > KisAlgebra2D::intersectLines | ( | const QLineF & | boundedLine, |
| const QLineF & | unboundedLine ) |
Find intersection of a bounded line boundedLine with unbounded line unboundedLine (if an intersection exists)
Definition at line 975 of file kis_algebra_2d.cpp.
References A, B, B1(), B2(), and qFuzzyIsNull().
| KRITAGLOBAL_EXPORT boost::optional< QPointF > KisAlgebra2D::intersectLines | ( | const QPointF & | p1, |
| const QPointF & | p2, | ||
| const QPointF & | q1, | ||
| const QPointF & | q2 ) |
Find intersection of a bounded line p1, p2 with unbounded line q1, q2 (if an intersection exists)
Definition at line 1011 of file kis_algebra_2d.cpp.
References intersectLines(), p1, p2, q1, and q2.
| KRITAGLOBAL_EXPORT QVector< QPointF > KisAlgebra2D::intersectTwoCircles | ( | const QPointF & | c1, |
| qreal | r1, | ||
| const QPointF & | c2, | ||
| qreal | r2 ) |
Finds the points of intersections between two circles
Definition at line 638 of file kis_algebra_2d.cpp.
References A, C, dbgKrita, eps, KIS_SAFE_ASSERT_RECOVER, norm(), p, p1, p2, pow2(), ppVar, quadraticEquation(), r1, and r2.
| T KisAlgebra2D::inwardUnitNormal | ( | const T & | a, |
| int | polygonDirection ) |
Definition at line 148 of file kis_algebra_2d.h.
References leftUnitNormal(), and polygonDirection().
| bool KisAlgebra2D::isInRange | ( | T | x, |
| T | a, | ||
| T | b ) |
Definition at line 199 of file kis_algebra_2d.h.
References length().
| bool KRITAGLOBAL_EXPORT KisAlgebra2D::isInsideShape | ( | const QPainterPath & | path, |
| const QPointF & | point ) |
Definition at line 2496 of file kis_algebra_2d.cpp.
References isInsideShape().
| bool KRITAGLOBAL_EXPORT KisAlgebra2D::isInsideShape | ( | const VectorPath & | path, |
| const QPointF & | point ) |
Definition at line 2415 of file kis_algebra_2d.cpp.
References accumulateBounds(), KisAlgebra2D::VectorPath::VectorPathPoint::BezierTo, KisAlgebra2D::VectorPath::Segment::endPoint, eps, fuzzyPointCompare(), KisAlgebra2D::VectorPath::intersectSegmentWithLineBounded(), KIS_SAFE_ASSERT_RECOVER, kisGrowRect(), and KisAlgebra2D::VectorPath::Segment::startPoint.
| bool KisAlgebra2D::isOnLine | ( | const QLineF & | line, |
| const QPointF & | point, | ||
| const qreal | eps, | ||
| bool | boundedStart, | ||
| bool | boundedEnd, | ||
| bool | includeEnds ) |
Definition at line 2508 of file kis_algebra_2d.cpp.
References eps, fuzzyPointCompare(), and kisDistanceToLine().
| bool KisAlgebra2D::isPolygonRect | ( | const Polygon & | poly, |
| Difference | tolerance ) |
Definition at line 855 of file kis_algebra_2d.h.
References fuzzyPointCompare(), p1, and p2.
| bool KisAlgebra2D::isPolygonTrulyConvex | ( | const QVector< T > & | polygon | ) |
Definition at line 884 of file kis_algebra_2d.h.
References fuzzyPointCompare(), M_PI, sign(), and signZZ().
Helper function to convert a qreal to int lazily. If the passed type is an integer, then the value is rounded. Otherwise it is just passed forward.
|
inline |
Definition at line 162 of file kis_algebra_2d.h.
References value().
|
inline |
| T KisAlgebra2D::leftUnitNormal | ( | const T & | a | ) |
Definition at line 132 of file kis_algebra_2d.h.
References crossProduct(), length(), and norm().
| Point KisAlgebra2D::lerp | ( | const Point & | pt1, |
| const Point & | pt2, | ||
| qreal | t ) |
Definition at line 82 of file kis_algebra_2d.h.
|
inline |
Linearly reshape function x so that in range [x0, x1] it would cross points (x0, y0) and (x1, y1).
Definition at line 995 of file kis_algebra_2d.h.
| int KisAlgebra2D::lineSideForPoint | ( | const QLineF & | line, |
| const QPointF & | point ) |
Definition at line 1308 of file kis_algebra_2d.cpp.
References crossProduct(), fuzzyPointCompare(), qFuzzyCompare(), and qFuzzyIsNull().
| KisTransformComponents KRITAGLOBAL_EXPORT KisAlgebra2D::makeFullTransformComponents | ( | ) |
| KRITAGLOBAL_EXPORT QTransform KisAlgebra2D::mapToRect | ( | const QRectF & | rect | ) |
| KRITAGLOBAL_EXPORT QTransform KisAlgebra2D::mapToRectInverse | ( | const QRectF & | rect | ) |
| auto KisAlgebra2D::maxDimension | ( | Size | size | ) | -> decltype(size.width()) |
Definition at line 338 of file kis_algebra_2d.h.
| VectorPath KisAlgebra2D::mergeShapesWithGutter | ( | const VectorPath & | shape1, |
| const VectorPath & | shape2, | ||
| const VectorPath & | oneEnd, | ||
| const VectorPath & | otherEnd, | ||
| int | index1, | ||
| int | index2, | ||
| bool | reverseSecondPoly, | ||
| bool | isSameShape ) |
mergeShapesWithGutter merges two shapes with a gutter shape (defined as two paths)
| shape1 | |
| shape2 | |
| oneEnd | |
| otherEnd | |
| index1 | index of the segment in the first shape |
| index2 | index of the segment in the second shape |
Definition at line 1898 of file kis_algebra_2d.cpp.
References isInsideShape(), KIS_SAFE_ASSERT_RECOVER_RETURN, KisAlgebra2D::VectorPath::pointAt(), KisAlgebra2D::VectorPath::reversed(), KisAlgebra2D::VectorPath::segmentAt(), and KisAlgebra2D::VectorPath::segmentsCount().
| auto KisAlgebra2D::minDimension | ( | Size | size | ) | -> decltype(size.width()) |
Definition at line 343 of file kis_algebra_2d.h.
| QPointF KRITAGLOBAL_EXPORT KisAlgebra2D::moveElasticPoint | ( | const QPointF & | pt, |
| const QPointF & | base, | ||
| const QPointF & | newBase, | ||
| const QPointF & | wingA, | ||
| const QPointF & | wingB ) |
moveElasticPoint moves point pt based on the model of elasticity
| pt | point in question, tied to points base, wingA and wingB using springs |
| base | initial position of the dragged point |
| newBase | final position of the dragged point |
| wingA | first anchor point |
| wingB | second anchor point |
pt The function requires (newBase - base) be much smaller than any of the distances between other points. If larger distances are necessary, then use integration.
Definition at line 1096 of file kis_algebra_2d.cpp.
References crossProduct(), dotProduct(), findTrianglePointNearest(), and norm().
| QPointF KRITAGLOBAL_EXPORT KisAlgebra2D::moveElasticPoint | ( | const QPointF & | pt, |
| const QPointF & | base, | ||
| const QPointF & | newBase, | ||
| const QVector< QPointF > & | anchorPoints ) |
moveElasticPoint moves point pt based on the model of elasticity
| pt | point in question, tied to points base, anchorPoints using springs |
| base | initial position of the dragged point |
| newBase | final position of the dragged point |
| anchorPoints | anchor points |
pt The function expects (newBase - base) be much smaller than any of the distances between other points. If larger distances are necessary, then use integration.
Definition at line 1202 of file kis_algebra_2d.cpp.
References ENTER_FUNCTION, and ppVar.
| QPointF KRITAGLOBAL_EXPORT KisAlgebra2D::movePointAlongTheLine | ( | const QPointF & | point, |
| const QLineF & | direction, | ||
| qreal | distance, | ||
| bool | ensureOnLine ) |
movePointAlongTheLine moves the point a particular distance in the specified direction
| point | the point to move |
| direction | the direction to move the point along |
| distance | distance to move the point |
| ensureOnLine | if true, the algorithm will first change the point to the nearest point on the line, and then move it along the line (if not true, it's an equivalent of movePointInTheDirection, with QPointF being a vector of direction) |
Definition at line 1790 of file kis_algebra_2d.cpp.
References distance(), findNearestPointOnLine(), and movePointInTheDirection().
| QPointF KRITAGLOBAL_EXPORT KisAlgebra2D::movePointInTheDirection | ( | const QPointF & | point, |
| const QPointF & | direction, | ||
| qreal | distance ) |
movePointAlongTheLine moves the point a particular distance in the specified direction
| point | the point to move |
| direction | the direction to move the point along |
| distance | distance to move the point |
Definition at line 1783 of file kis_algebra_2d.cpp.
References distance().
| qreal KisAlgebra2D::norm | ( | const T & | a | ) |
Definition at line 63 of file kis_algebra_2d.h.
References pow2().
| Point KisAlgebra2D::normalize | ( | const Point & | a | ) |
| qreal KisAlgebra2D::normSquared | ( | const T & | a | ) |
Definition at line 69 of file kis_algebra_2d.h.
References pow2().
| QDebug KRITAGLOBAL_EXPORT KisAlgebra2D::operator<< | ( | QDebug | debug, |
| const VectorPath & | path ) |
Definition at line 2391 of file kis_algebra_2d.cpp.
| QDebug KRITAGLOBAL_EXPORT KisAlgebra2D::operator<< | ( | QDebug | debug, |
| const VectorPath::VectorPathPoint & | point ) |
Definition at line 2397 of file kis_algebra_2d.cpp.
References KisAlgebra2D::VectorPath::VectorPathPoint::BezierTo, KisAlgebra2D::VectorPath::VectorPathPoint::controlPoint1, KisAlgebra2D::VectorPath::VectorPathPoint::controlPoint2, KisAlgebra2D::VectorPath::VectorPathPoint::endPoint, KisAlgebra2D::VectorPath::VectorPathPoint::MoveTo, and KisAlgebra2D::VectorPath::VectorPathPoint::type.
| qreal KRITAGLOBAL_EXPORT KisAlgebra2D::pointToLineDistSquared | ( | const QPointF & | pt, |
| const QLineF & | line ) |
Definition at line 1555 of file kis_algebra_2d.cpp.
| int KisAlgebra2D::polygonDirection | ( | const QVector< T > & | polygon | ) |
Note: the sign is flipped because our 0y axis is reversed
Definition at line 181 of file kis_algebra_2d.h.
| KisAlgebra2D::Q_DECLARE_FLAGS | ( | KisTransformComponents | , |
| KisTransformComponent | ) |
| KRITAGLOBAL_EXPORT int KisAlgebra2D::quadraticEquation | ( | qreal | a, |
| qreal | b, | ||
| qreal | c, | ||
| qreal * | x1, | ||
| qreal * | x2 ) |
Solves a quadratic equation in a form:
a * x^2 + b * x + c = 0
WARNING: Please note that a must be nonzero! Otherwise the equation is not quadratic! And this function doesn't check that!
x1, x2 — the found solution. The variables are filled with data iff the corresponding solution is found. That is: 0 solutions — variables are not touched, 1 solution — x1 is filled with the result, 2 solutions — x1 and x2 are filled.
Definition at line 615 of file kis_algebra_2d.cpp.
|
inline |
Scale the relative point \pt into the bounds of rc. The point might be outside the rectangle.
Definition at line 752 of file kis_algebra_2d.h.
|
inline |
Scales relative isotropic value from relative to absolute coordinate system using SVG 1.1 rules (see chapter 7.10)
Definition at line 789 of file kis_algebra_2d.h.
References relativeToAbsolute().
|
inline |
Scales relative isotropic value from relative to absolute coordinate system using SVG 1.1 rules (see chapter 7.10)
Definition at line 771 of file kis_algebra_2d.h.
| QPainterPath KisAlgebra2D::removeGutterOneEndSmart | ( | const QPainterPath & | shape1, |
| int | index1, | ||
| const QPainterPath & | shape2, | ||
| int | index2, | ||
| QLineF | middleLine, | ||
| bool | reverseFirstPoly, | ||
| bool | reverseSecondPoly ) |
Definition at line 1817 of file kis_algebra_2d.cpp.
References getLineFromElements(), intersectLines(), kisDistanceToLine(), and reverseDirection().
| QPainterPath KRITAGLOBAL_EXPORT KisAlgebra2D::removeGutterSmart | ( | const QPainterPath & | shape1, |
| int | index1, | ||
| const QPainterPath & | shape2, | ||
| int | index2, | ||
| bool | isSameShape ) |
removeGutterSmart
| shape1 | |
| index1 | |
| shape2 | |
| index2 |
Definition at line 1977 of file kis_algebra_2d.cpp.
References KisAlgebra2D::VectorPath::asPainterPath(), getLineFromElements(), mergeShapesWithGutter(), KisAlgebra2D::VectorPath::pathIndexToSegmentIndex(), polygonDirection(), removeGutterOneEndSmart(), and KisAlgebra2D::VectorPath::trulySimplified().
| QLineF KisAlgebra2D::reverseDirection | ( | const QLineF & | line | ) |
Definition at line 1811 of file kis_algebra_2d.cpp.
| T KisAlgebra2D::rightUnitNormal | ( | const T & | a | ) |
Definition at line 142 of file kis_algebra_2d.h.
References leftUnitNormal().
| QVector< QPoint > KRITAGLOBAL_EXPORT KisAlgebra2D::sampleRectWithPoints | ( | const QRect & | rect | ) |
Definition at line 509 of file kis_algebra_2d.cpp.
| QVector< QPointF > KRITAGLOBAL_EXPORT KisAlgebra2D::sampleRectWithPoints | ( | const QRectF & | rect | ) |
Definition at line 514 of file kis_algebra_2d.cpp.
| QVector< Point > KisAlgebra2D::sampleRectWithPoints | ( | const Rect & | rect | ) |
Definition at line 487 of file kis_algebra_2d.cpp.
| T KisAlgebra2D::signPZ | ( | T | x | ) |
Usual sign() function with positive zero
Definition at line 91 of file kis_algebra_2d.h.
| T KisAlgebra2D::signZZ | ( | T | x | ) |
Usual sign() function with zero returning zero
Definition at line 99 of file kis_algebra_2d.h.
| QPainterPath KisAlgebra2D::simplifyShape | ( | const QPainterPath & | path | ) |
Definition at line 1892 of file kis_algebra_2d.cpp.
References KisAlgebra2D::VectorPath::asPainterPath(), and KisAlgebra2D::VectorPath::trulySimplified().
| QPainterPath KRITAGLOBAL_EXPORT KisAlgebra2D::smallArrow | ( | ) |
|
inline |
Definition at line 769 of file kis_algebra_2d.cpp.
| QPointF KRITAGLOBAL_EXPORT KisAlgebra2D::transformAsBase | ( | const QPointF & | pt, |
| const QPointF & | base1, | ||
| const QPointF & | base2 ) |
Let pt, base1 are two vectors. base1 is uniformly scaled and then rotated into base2 using transformation matrix S * R. The function applies the same transformation to \pt and returns the result.
Definition at line 89 of file kis_algebra_2d.cpp.
References norm().
| std::pair< QPointF, QTransform > KRITAGLOBAL_EXPORT KisAlgebra2D::transformEllipse | ( | const QPointF & | axes, |
| const QTransform & | fullLocalToGlobal ) |
Definition at line 913 of file kis_algebra_2d.cpp.
References fromQTransformStraight(), KIS_SAFE_ASSERT_RECOVER_NOOP, pow2(), KisAlgebra2D::DecomposedMatrix::rotateTransform(), KisAlgebra2D::DecomposedMatrix::scaleTransform(), KisAlgebra2D::DecomposedMatrix::shearTransform(), toQTransformStraight(), and KisAlgebra2D::DecomposedMatrix::translateTransform().
| bool KisAlgebra2D::tryMergePoints | ( | QPainterPath & | path, |
| const QPointF & | startPoint, | ||
| const QPointF & | endPoint, | ||
| qreal & | distance, | ||
| qreal | distanceThreshold, | ||
| bool | lastSegment ) |
Definition at line 1565 of file kis_algebra_2d.cpp.
References distance(), and length().
| QPainterPath KRITAGLOBAL_EXPORT KisAlgebra2D::trySimplifyPath | ( | const QPainterPath & | path, |
| qreal | lengthThreshold ) |
trySimplifyPath Tries to simplify a QPainterPath
| path | – path to simplify. |
| lengthThreshold | – length at which points get merged. |
Definition at line 1600 of file kis_algebra_2d.cpp.
References distance(), and tryMergePoints().
|
inline |
Definition at line 507 of file kis_algebra_2d.h.
References value(), and wrapValue().
|
inline |