Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qpathclipper.cpp File Reference

(512d35198b726413c151533c8291c6b4b52f0a1d)

#include "qpathclipper_p.h"
#include <private/qbezier_p.h>
#include <private/qdatabuffer_p.h>
#include <private/qnumeric_p.h>
#include <qmath.h>
#include <algorithm>
#include <qdebug.h>
Include dependency graph for qpathclipper.cpp:

Go to the source code of this file.

Classes

struct  QIntersection
class  QIntersectionFinder
class  QKdPointTree
struct  QKdPointTree::Node
class  QKdPointFinder
struct  QCrossingEdge

Functions

static QT_BEGIN_NAMESPACE bool fuzzyIsNull (qreal d)
static bool comparePoints (const QPointF &a, const QPointF &b)
static qreal dot (const QPointF &a, const QPointF &b)
static void normalize (double &x, double &y)
 Q_DECLARE_TYPEINFO (QIntersection, Q_PRIMITIVE_TYPE)
template<typename T>
void qTraverseKdPointTree (QKdPointTree::Node &node, T &t, int depth=0)
static qreal component (const QPointF &point, unsigned int i)
static bool isLine (const QBezier &bezier)
static int commonEdge (const QWingedEdge &list, int a, int b)
static double computeAngle (const QPointF &v)
static void addLineTo (QPainterPath &path, const QPointF &point)
static void add (QPainterPath &path, const QWingedEdge &list, int edge, QPathEdge::Traversal traversal)
static void clear (QWingedEdge &list, int edge, QPathEdge::Traversal traversal)
template<typename InputIterator>
InputIterator qFuzzyFind (InputIterator first, InputIterator last, qreal val)
static bool fuzzyCompare (qreal a, qreal b)
static void traverse (QWingedEdge &list, int edge, QPathEdge::Traversal traversal)
 Q_DECLARE_TYPEINFO (QCrossingEdge, Q_PRIMITIVE_TYPE)
static bool bool_op (bool a, bool b, QPathClipper::Operation op)
static QList< QCrossingEdgefindCrossings (const QWingedEdge &list, qreal y)

Function Documentation

◆ add()

void add ( QPainterPath & path,
const QWingedEdge & list,
int edge,
QPathEdge::Traversal traversal )
static

Definition at line 1275 of file qpathclipper.cpp.

References QPathEdge::flag, QPathEdge::Forward, QPathEdge::LeftTraversal, and QPathEdge::vertex().

Here is the call graph for this function:

◆ addLineTo()

void addLineTo ( QPainterPath & path,
const QPointF & point )
static

Definition at line 1253 of file qpathclipper.cpp.

◆ bool_op()

bool bool_op ( bool a,
bool b,
QPathClipper::Operation op )
static

Definition at line 1706 of file qpathclipper.cpp.

◆ clear()

void clear ( QWingedEdge & list,
int edge,
QPathEdge::Traversal traversal )
static

Definition at line 1428 of file qpathclipper.cpp.

References QPathEdge::Forward, and QPathEdge::LeftTraversal.

◆ commonEdge()

int commonEdge ( const QWingedEdge & list,
int a,
int b )
static

◆ comparePoints()

bool comparePoints ( const QPointF & a,
const QPointF & b )
inlinestatic

Definition at line 41 of file qpathclipper.cpp.

◆ component()

qreal component ( const QPointF & point,
unsigned int i )
inlinestatic

Definition at line 627 of file qpathclipper.cpp.

◆ computeAngle()

double computeAngle ( const QPointF & v)
static

Definition at line 1122 of file qpathclipper.cpp.

References normalize().

Here is the call graph for this function:

◆ dot()

qreal dot ( const QPointF & a,
const QPointF & b )
static

Definition at line 48 of file qpathclipper.cpp.

◆ findCrossings()

QList< QCrossingEdge > findCrossings ( const QWingedEdge & list,
qreal y )
static

Definition at line 1748 of file qpathclipper.cpp.

References QPathEdge::first, and QPathEdge::second.

◆ fuzzyCompare()

bool fuzzyCompare ( qreal a,
qreal b )
static

Definition at line 1453 of file qpathclipper.cpp.

◆ fuzzyIsNull()

QT_BEGIN_NAMESPACE bool fuzzyIsNull ( qreal d)
inlinestatic

The algorithm is as follows:

  1. Find all intersections between the two paths (including self-intersections), and build a winged edge structure of non-intersecting parts.
  2. While there are more unhandled edges:
    1. Pick a y-coordinate from an unhandled edge.
    2. Intersect the horizontal line at y-coordinate with all edges.
    3. Traverse intersections left to right deciding whether each subpath should be added or not.
    4. If the subpath should be added, traverse the winged-edge structure and add the edges to a separate winged edge structure.
    5. Mark all edges in subpaths crossing the horizontal line as handled.

(Optional) Simplify the resulting winged edge structure by merging shared edges.

  1. Convert the resulting winged edge structure to a painter path.

Definition at line 33 of file qpathclipper.cpp.

◆ isLine()

bool isLine ( const QBezier & bezier)
static

Definition at line 856 of file qpathclipper.cpp.

◆ normalize()

void normalize ( double & x,
double & y )
static

Definition at line 53 of file qpathclipper.cpp.

Referenced by computeAngle().

Here is the caller graph for this function:

◆ Q_DECLARE_TYPEINFO() [1/2]

Q_DECLARE_TYPEINFO ( QCrossingEdge ,
Q_PRIMITIVE_TYPE  )

◆ Q_DECLARE_TYPEINFO() [2/2]

Q_DECLARE_TYPEINFO ( QIntersection ,
Q_PRIMITIVE_TYPE  )

◆ qFuzzyFind()

template<typename InputIterator>
InputIterator qFuzzyFind ( InputIterator first,
InputIterator last,
qreal val )

Definition at line 1446 of file qpathclipper.cpp.

◆ qTraverseKdPointTree()

template<typename T>
void qTraverseKdPointTree ( QKdPointTree::Node & node,
T & t,
int depth = 0 )

◆ traverse()

void traverse ( QWingedEdge & list,
int edge,
QPathEdge::Traversal traversal )
static

Definition at line 1672 of file qpathclipper.cpp.

References QPathEdge::flag, QPathEdge::Forward, and QPathEdge::LeftTraversal.