Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QBezier Class Reference

#include <qbezier_p.h>

+ Collaboration diagram for QBezier:

Public Member Functions

QPointF pointAt (qreal t) const
 
QPointF normalVector (qreal t) const
 
QPointF derivedAt (qreal t) const
 
QPointF secondDerivedAt (qreal t) const
 
QPolygonF toPolygon (qreal bezier_flattening_threshold=0.5) const
 
void addToPolygon (QPolygonF *p, qreal bezier_flattening_threshold=0.5) const
 
void addToPolygon (QDataBuffer< QPointF > &polygon, qreal bezier_flattening_threshold) const
 
QPolygonF toQuadratics (qreal errorLimit=0.2) const
 
void addToQuadratics (QPolygonF *p, qreal tspan=1.0, qreal errorLimit=0.2) const
 
int inflectionPoints (qreal *tpoints) const
 
QRectF bounds () const
 
qreal length (qreal error=0.01) const
 
void addIfClose (qreal *length, qreal error) const
 
qreal tAtLength (qreal len) const
 
int stationaryYPoints (qreal &t0, qreal &t1) const
 
qreal tForY (qreal t0, qreal t1, qreal y) const
 
QPointF pt1 () const
 
QPointF pt2 () const
 
QPointF pt3 () const
 
QPointF pt4 () const
 
QBezier mapBy (const QTransform &transform) const
 
QPointF midPoint () const
 
QLineF midTangent () const
 
QLineF startTangent () const
 
QLineF endTangent () const
 
void parameterSplitLeft (qreal t, QBezier *left)
 
std::pair< QBezier, QBeziersplit () const
 
int shifted (QBezier *curveSegments, int maxSegmets, qreal offset, float threshold) const
 
QBezier bezierOnInterval (qreal t0, qreal t1) const
 
QBezier getSubRange (qreal t0, qreal t1) const
 

Static Public Member Functions

static QBezier fromPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
 
static void coefficients (qreal t, qreal &a, qreal &b, qreal &c, qreal &d)
 

Public Attributes

qreal x1
 
qreal y1
 
qreal x2
 
qreal y2
 
qreal x3
 
qreal y3
 
qreal x4
 
qreal y4
 

Detailed Description

Definition at line 31 of file qbezier_p.h.

Member Function Documentation

◆ addIfClose()

void QBezier::addIfClose ( qreal length,
qreal  error 
) const

Definition at line 533 of file qbezier.cpp.

References error, QLineF::length(), split(), x3, x4, y3, and y4.

Referenced by length().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToPolygon() [1/2]

void QBezier::addToPolygon ( QDataBuffer< QPointF > &  polygon,
qreal  bezier_flattening_threshold 
) const

Definition at line 101 of file qbezier.cpp.

References d, qAbs(), and y4.

+ Here is the call graph for this function:

◆ addToPolygon() [2/2]

void QBezier::addToPolygon ( QPolygonF p,
qreal  bezier_flattening_threshold = 0.5 
) const

Definition at line 65 of file qbezier.cpp.

References d, qAbs(), and y4.

Referenced by QOutlineMapper::curveTo(), toPolygon(), and QPainterPath::toSubpathPolygons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToQuadratics()

void QBezier::addToQuadratics ( QPolygonF p,
qreal  tspan = 1.0,
qreal  errorLimit = 0.2 
) const

Definition at line 179 of file qbezier.cpp.

References pt4(), Q_ASSERT, quadraticForCubic(), scoreQuadratic(), and split().

+ Here is the call graph for this function:

◆ bezierOnInterval()

QBezier QBezier::bezierOnInterval ( qreal  t0,
qreal  t1 
) const

Definition at line 680 of file qbezier.cpp.

References parameterSplitLeft(), and t0.

Referenced by qt_toQuadratics(), and toQuadratics().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bounds()

QRectF QBezier::bounds ( ) const

Definition at line 239 of file qbezier.cpp.

References x1, x2, x3, x4, y1, y2, y3, and y4.

Referenced by QPathSegments::addPath(), QOutlineMapper::curveTo(), qt_isect_curve_horizontal(), qt_isect_curve_vertical(), qt_painterpath_isect_curve(), and shift().

+ Here is the caller graph for this function:

◆ coefficients()

void QBezier::coefficients ( qreal  t,
qreal a,
qreal b,
qreal c,
qreal d 
)
inlinestatic

Definition at line 121 of file qbezier_p.h.

References d.

Referenced by qt_find_ellipse_coords(), and tForY().

+ Here is the caller graph for this function:

◆ derivedAt()

QPointF QBezier::derivedAt ( qreal  t) const
inline

Definition at line 167 of file qbezier_p.h.

References d, x3, x4, y3, and y4.

◆ endTangent()

QLineF QBezier::endTangent ( ) const
inline

Definition at line 111 of file qbezier_p.h.

References QLineF::isNull(), pt1(), pt2(), pt3(), and pt4().

+ Here is the call graph for this function:

◆ fromPoints()

static QBezier QBezier::fromPoints ( const QPointF p1,
const QPointF p2,
const QPointF p3,
const QPointF p4 
)
inlinestatic

Definition at line 34 of file qbezier_p.h.

References p1, p2, QPointF::x(), and QPointF::y().

Referenced by QPathSegments::addPath(), QOpenGL2PEXVertexArray::addPath(), bezierAtT(), QPainterPath::contains(), cubicTo_clipped(), QOutlineMapper::curveTo(), QuadPath::fromPainterPath(), QTriangulator< T >::initialize(), QPainterPath::length(), mapBy(), QSubpathFlatIterator::next(), nextBezier(), QPainterPath::percentAtLength(), QDashedStrokeProcessor::process(), qt_curves_for_arc(), qt_painterpath_check_crossing(), qt_stroke_side(), shift(), split(), and QPainterPath::toSubpathPolygons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubRange()

QBezier QBezier::getSubRange ( qreal  t0,
qreal  t1 
) const

Definition at line 45 of file qbezier.cpp.

References parameterSplitLeft(), and qFuzzyIsNull().

+ Here is the call graph for this function:

◆ inflectionPoints()

int QBezier::inflectionPoints ( qreal tpoints) const

Definition at line 195 of file qbezier.cpp.

References QLineF::angle(), mapBy(), pt1(), pt4(), Q_ASSERT, qFuzzyCompare(), qFuzzyIsNull(), qIsFinite(), qSqrt(), qSwap(), QTransform::rotate(), and QTransform::translate().

Referenced by toQuadratics().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ length()

qreal QBezier::length ( qreal  error = 0.01) const

Definition at line 524 of file qbezier.cpp.

References addIfClose(), and error.

+ Here is the call graph for this function:

◆ mapBy()

QBezier QBezier::mapBy ( const QTransform transform) const

Definition at line 40 of file qbezier.cpp.

References fromPoints(), pt1(), pt2(), pt3(), and pt4().

Referenced by inflectionPoints(), and qt_getInflectionPoints().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ midPoint()

QPointF QBezier::midPoint ( ) const
inline

Definition at line 88 of file qbezier_p.h.

References x3, x4, y3, and y4.

Referenced by midTangent().

+ Here is the caller graph for this function:

◆ midTangent()

QLineF QBezier::midTangent ( ) const
inline

Definition at line 93 of file qbezier_p.h.

References dir, midPoint(), pointAt(), QPointF::x(), x3, x4, QPointF::y(), y3, and y4.

+ Here is the call graph for this function:

◆ normalVector()

QPointF QBezier::normalVector ( qreal  t) const
inline

Definition at line 157 of file qbezier_p.h.

References x3, x4, y3, and y4.

Referenced by good_offset().

+ Here is the caller graph for this function:

◆ parameterSplitLeft()

void QBezier::parameterSplitLeft ( qreal  t,
QBezier left 
)
inline

Definition at line 210 of file qbezier_p.h.

References x1, x2, x3, x4, y1, y2, y3, and y4.

Referenced by bezierOnInterval(), getSubRange(), and qt_addToQuadratics().

+ Here is the caller graph for this function:

◆ pointAt()

QPointF QBezier::pointAt ( qreal  t) const
inline

Definition at line 132 of file qbezier_p.h.

References x3, x4, y3, and y4.

Referenced by QPathSegments::addPath(), good_offset(), midTangent(), and tForY().

+ Here is the caller graph for this function:

◆ pt1()

QPointF QBezier::pt1 ( ) const
inline

Definition at line 63 of file qbezier_p.h.

Referenced by endTangent(), inflectionPoints(), isLine(), mapBy(), qt_getInflectionPoints(), qt_painterpath_isect_curve(), qt_stroke_side(), split(), startTangent(), and toQuadratics().

+ Here is the caller graph for this function:

◆ pt2()

QPointF QBezier::pt2 ( ) const
inline

Definition at line 64 of file qbezier_p.h.

Referenced by endTangent(), isLine(), mapBy(), qt_stroke_side(), split(), and startTangent().

+ Here is the caller graph for this function:

◆ pt3()

QPointF QBezier::pt3 ( ) const
inline

Definition at line 65 of file qbezier_p.h.

Referenced by endTangent(), isLine(), mapBy(), qt_stroke_side(), split(), and startTangent().

+ Here is the caller graph for this function:

◆ pt4()

QPointF QBezier::pt4 ( ) const
inline

Definition at line 66 of file qbezier_p.h.

Referenced by addToQuadratics(), endTangent(), inflectionPoints(), isLine(), mapBy(), qt_getInflectionPoints(), qt_painterpath_isect_curve(), qt_stroke_side(), split(), and startTangent().

+ Here is the caller graph for this function:

◆ secondDerivedAt()

QPointF QBezier::secondDerivedAt ( qreal  t) const
inline

Definition at line 182 of file qbezier_p.h.

References d, x3, x4, y3, and y4.

◆ shifted()

int QBezier::shifted ( QBezier curveSegments,
int  maxSegmets,
qreal  offset,
float  threshold 
) const

Definition at line 457 of file qbezier.cpp.

References addCircle(), Circle, Discard, o, Ok, Q_ASSERT, qFuzzyCompare(), shift(), Split, x3, x4, y3, and y4.

Referenced by qt_stroke_side().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ split()

std::pair< QBezier, QBezier > QBezier::split ( ) const
inline

Definition at line 193 of file qbezier_p.h.

References fromPoints(), pt1(), pt2(), pt3(), and pt4().

Referenced by addIfClose(), addToQuadratics(), qt_isect_curve_horizontal(), qt_isect_curve_vertical(), and qt_painterpath_isect_curve().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startTangent()

QLineF QBezier::startTangent ( ) const
inline

Definition at line 101 of file qbezier_p.h.

References QLineF::isNull(), pt1(), pt2(), pt3(), and pt4().

Referenced by qt_stroke_side().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stationaryYPoints()

int QBezier::stationaryYPoints ( qreal t0,
qreal t1 
) const

Definition at line 598 of file qbezier.cpp.

References qFuzzyIsNull(), qSqrt(), qSwap(), t0, t1, y2, y3, and y4.

+ Here is the call graph for this function:

◆ tAtLength()

qreal QBezier::tAtLength ( qreal  len) const

Definition at line 647 of file qbezier.cpp.

References error, qAbs(), and qFuzzyCompare().

+ Here is the call graph for this function:

◆ tForY()

qreal QBezier::tForY ( qreal  t0,
qreal  t1,
qreal  y 
) const

Definition at line 556 of file qbezier.cpp.

References coefficients(), d, e, pointAt(), Q_ASSERT, qAbs(), qSwap(), t0, t1, QPointF::y(), y3, and y4.

+ Here is the call graph for this function:

◆ toPolygon()

QT_BEGIN_NAMESPACE QPolygonF QBezier::toPolygon ( qreal  bezier_flattening_threshold = 0.5) const

Definition at line 21 of file qbezier.cpp.

References addToPolygon().

Referenced by cubicTo_clipped(), QTriangulator< T >::initialize(), and QSubpathFlatIterator::next().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toQuadratics()

QPolygonF QBezier::toQuadratics ( qreal  errorLimit = 0.2) const

Definition at line 137 of file qbezier.cpp.

References bezierOnInterval(), i, inflectionPoints(), pt1(), and t1.

+ Here is the call graph for this function:

Member Data Documentation

◆ x1

◆ x2

◆ x3

◆ x4

◆ y1

◆ y2

◆ y3

◆ y4


The documentation for this class was generated from the following files: