Definition at line 104 of file qpathclipper.cpp.
◆ hasIntersections()
Definition at line 181 of file qpathclipper.cpp.
Referenced by QPathClipper::contains(), and QPathClipper::intersect().
193 for (
int i = 1; i < b.
segments(); ++i) {
201 QRectF rb(minX, minY, maxX - minX, maxY - minY);
203 for (
int i = 0; i < a.
segments(); ++i) {
206 if (r1.
left() > rb.right() || rb.left() > r1.
right())
208 if (r1.
top() > rb.bottom() || rb.top() > r1.
bottom())
211 for (
int j = 0; j < b.
segments(); ++j) {
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
const QLineF lineAt(int index) const
bool linesIntersect(const QLineF &a, const QLineF &b) const
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
The QRectF class defines a rectangle in the plane using floating point precision. ...
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
const QRectF & elementBounds(int index) const
◆ linesIntersect()
bool QIntersectionFinder::linesIntersect |
( |
const QLineF & |
a, |
|
|
const QLineF & |
b |
|
) |
| const |
|
private |
Definition at line 114 of file qpathclipper.cpp.
128 if (p1_equals_q1 && p2_equals_q2)
134 if (p1_equals_q2 && p2_equals_q1)
137 const QPointF pDelta = p2 - p1;
138 const QPointF qDelta = q2 - q1;
140 const qreal par = pDelta.
x() * qDelta.
y() - pDelta.
y() * qDelta.
x();
143 const QPointF normal(-pDelta.
y(), pDelta.
x());
147 const qreal dp =
dot(pDelta, pDelta);
149 const qreal tq1 =
dot(pDelta, q1 - p1);
150 const qreal tq2 =
dot(pDelta, q2 - p1);
152 if ((tq1 > 0 && tq1 < dp) || (tq2 > 0 && tq2 < dp))
155 const qreal dq =
dot(qDelta, qDelta);
157 const qreal tp1 =
dot(qDelta, p1 - q1);
158 const qreal tp2 =
dot(qDelta, p2 - q1);
160 if ((tp1 > 0 && tp1 < dq) || (tp2 > 0 && tp2 < dq))
167 const qreal invPar = 1 / par;
169 const qreal tp = (qDelta.
y() * (q1.x() - p1.x()) -
170 qDelta.
x() * (q1.y() - p1.y())) * invPar;
172 if (tp < 0 || tp > 1)
175 const qreal tq = (pDelta.
y() * (q1.x() - p1.x()) -
176 pDelta.
x() * (q1.y() - p1.y())) * invPar;
178 return tq >= 0 && tq <= 1;
QPointF p1() const
Returns the line's start point.
The QPointF class defines a point in the plane using floating point precision.
qreal x() const
Returns the x-coordinate of this point.
QPointF p2() const
Returns the line's end point.
qreal y() const
Returns the y-coordinate of this point.
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
static bool comparePoints(const QPointF &a, const QPointF &b)
static qreal dot(const QPointF &a, const QPointF &b)
◆ produceIntersections()
void QIntersectionFinder::produceIntersections |
( |
QPathSegments & |
segments | ) |
|
The documentation for this class was generated from the following file: