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
qtriangulator_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTRIANGULATOR_P_H
5#define QTRIANGULATOR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include <QtGui/private/qvectorpath_p.h>
20#include <QtCore/qlist.h>
21
22QT_BEGIN_NAMESPACE
23
24class QVertexIndexVector
25{
26public:
27 enum Type {
28 UnsignedInt,
29 UnsignedShort
30 };
31
32 inline Type type() const { return t; }
33
34 inline void setDataUint(const QList<quint32> &data)
35 {
36 t = UnsignedInt;
37 indices32 = data;
38 }
39
40 inline void setDataUshort(const QList<quint16> &data)
41 {
42 t = UnsignedShort;
43 indices16 = data;
44 }
45
46 inline const void* data() const
47 {
48 if (t == UnsignedInt)
49 return indices32.data();
50 return indices16.data();
51 }
52
53 inline int size() const
54 {
55 if (t == UnsignedInt)
56 return indices32.size();
57 return indices16.size();
58 }
59
60private:
61
62 Type t;
63 QList<quint32> indices32;
64 QList<quint16> indices16;
65};
66
68{
69 // The vertices of a triangle are given by: (x[i[n]], y[i[n]]), (x[j[n]], y[j[n]]), (x[k[n]], y[k[n]]), n = 0, 1, ...
70 QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
71 QVertexIndexVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...]
72};
73
75{
76 QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
77 QVertexIndexVector indices; // End of polyline is marked with -1.
78};
79
80// The vertex coordinates of the returned triangle set will be rounded to a grid with a mesh size
81// of 1/32. The polygon is first transformed, then scaled by 32, the coordinates are rounded to
82// integers, the polygon is triangulated, and then scaled back by 1/32.
83// 'hint' should be a combination of QVectorPath::Hints.
84// 'lod' is the level of detail. Default is 1. Curves are split into more lines when 'lod' is higher.
85QTriangleSet Q_GUI_EXPORT qTriangulate(const qreal *polygon, int count,
86 uint hint = QVectorPath::PolygonHint | QVectorPath::OddEvenFill,
87 const QTransform &matrix = QTransform(),
88 bool allowUintIndices = true);
89QTriangleSet Q_GUI_EXPORT qTriangulate(const QVectorPath &path, const QTransform &matrix = QTransform(),
90 qreal lod = 1, bool allowUintIndices = true);
91QTriangleSet Q_GUI_EXPORT qTriangulate(const QPainterPath &path, const QTransform &matrix = QTransform(),
92 qreal lod = 1, bool allowUintIndices = true);
93QPolylineSet qPolyline(const QVectorPath &path, const QTransform &matrix = QTransform(),
94 qreal lod = 1, bool allowUintIndices = true);
95QPolylineSet Q_GUI_EXPORT qPolyline(const QPainterPath &path, const QTransform &matrix = QTransform(),
96 qreal lod = 1, bool allowUintIndices = true);
97
98QT_END_NAMESPACE
99
100#endif
bool isValid() const
void insert(quint64 key)
bool contains(quint64 key) const
void push(const T &x)
bool isEmpty() const
bool empty() const
const T & top() const
int size() const
ComplexToSimple(QTriangulator< T > *parent)
MonotoneToTriangles(QTriangulator< T > *parent)
SimpleToMonotone(QTriangulator< T > *parent)
QVarLengthArray< int, 6 > ShortArray
void initialize(const qreal *polygon, int count, uint hint, const QTransform &matrix)
QVertexSet< T > polyline()
void initialize(const QVectorPath &path, const QTransform &matrix, qreal lod)
QVertexSet< T > triangulate()
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)
#define Q_FIXED_POINT_SCALE
static int primeForCount(int count)
static QIntersectionPoint qIntersectionPoint(const QPodPoint &u1, const QPodPoint &u2, const QPodPoint &v1, const QPodPoint &v2)
static int compare(quint64 a, quint64 b)
static QIntersectionPoint qIntersectionPoint(const QPodPoint &point)
static QFraction qFraction(quint64 n, quint64 d)
static qint64 qCross(const QPodPoint &u, const QPodPoint &v)
QPolylineSet qPolyline(const QVectorPath &path, const QTransform &matrix, qreal lod, bool allowUintIndices)
QTriangleSet qTriangulate(const QPainterPath &path, const QTransform &matrix, qreal lod, bool allowUintIndices)
static quint64 gcd(quint64 x, quint64 y)
static int qCompareFractions(quint64 a, quint64 b, quint64 c, quint64 d)
static qint64 qPointDistanceFromLine(const QPodPoint &p, const QPodPoint &v1, const QPodPoint &v2)
static bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, const QPodPoint &v2)
bool operator<=(const QFraction &other) const
bool isValid() const
bool operator!=(const QFraction &other) const
bool operator>(const QFraction &other) const
bool operator<(const QFraction &other) const
quint64 denominator
bool operator>=(const QFraction &other) const
quint64 numerator
bool operator==(const QFraction &other) const
bool operator<(const QIntersectionPoint &other) const
bool operator>(const QIntersectionPoint &other) const
bool isOnLine(const QPodPoint &u, const QPodPoint &v) const
bool operator>=(const QIntersectionPoint &other) const
QPodPoint round() const
bool operator<=(const QIntersectionPoint &other) const
bool operator==(const QIntersectionPoint &other) const
bool operator!=(const QIntersectionPoint &other) const
bool isAccurate() const
bool operator>=(const QPodPoint &other) const
QPodPoint & operator+=(const QPodPoint &other)
QPodPoint operator-(const QPodPoint &other) const
QPodPoint operator+(const QPodPoint &other) const
bool operator!=(const QPodPoint &other) const
QPodPoint & operator-=(const QPodPoint &other)
bool operator<=(const QPodPoint &other) const
bool operator>(const QPodPoint &other) const
bool operator<(const QPodPoint &other) const
bool operator==(const QPodPoint &other) const
QList< qreal > vertices
QVertexIndexVector indices
QList< qreal > vertices
QVertexIndexVector indices