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// Qt-Security score:significant reason:default
4
5#ifndef QTRIANGULATOR_P_H
6#define QTRIANGULATOR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtGui/private/qtguiglobal_p.h>
20#include <QtGui/private/qvectorpath_p.h>
21#include <QtCore/qlist.h>
22
23QT_BEGIN_NAMESPACE
24
25class QVertexIndexVector
26{
27public:
28 enum Type {
29 UnsignedInt,
30 UnsignedShort
31 };
32
33 inline Type type() const { return t; }
34
35 inline void setDataUint(const QList<quint32> &data)
36 {
37 t = UnsignedInt;
38 indices32 = data;
39 }
40
41 inline void setDataUshort(const QList<quint16> &data)
42 {
43 t = UnsignedShort;
44 indices16 = data;
45 }
46
47 inline const void* data() const
48 {
49 if (t == UnsignedInt)
50 return indices32.data();
51 return indices16.data();
52 }
53
54 inline int size() const
55 {
56 if (t == UnsignedInt)
57 return indices32.size();
58 return indices16.size();
59 }
60
61private:
62
63 Type t;
64 QList<quint32> indices32;
65 QList<quint16> indices16;
66};
67
69{
70 // 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, ...
71 QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
72 QVertexIndexVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...]
73};
74
76{
77 QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
78 QVertexIndexVector indices; // End of polyline is marked with -1.
79};
80
81// The vertex coordinates of the returned triangle set will be rounded to a grid with a mesh size
82// of 1/32. The polygon is first transformed, then scaled by 32, the coordinates are rounded to
83// integers, the polygon is triangulated, and then scaled back by 1/32.
84// 'hint' should be a combination of QVectorPath::Hints.
85// 'lod' is the level of detail. Default is 1. Curves are split into more lines when 'lod' is higher.
86QTriangleSet Q_GUI_EXPORT qTriangulate(const qreal *polygon, int count,
87 uint hint = QVectorPath::PolygonHint | QVectorPath::OddEvenFill,
88 const QTransform &matrix = QTransform(),
89 bool allowUintIndices = true);
90QTriangleSet Q_GUI_EXPORT qTriangulate(const QVectorPath &path, const QTransform &matrix = QTransform(),
91 qreal lod = 1, bool allowUintIndices = true);
92QTriangleSet Q_GUI_EXPORT qTriangulate(const QPainterPath &path, const QTransform &matrix = QTransform(),
93 qreal lod = 1, bool allowUintIndices = true);
94QPolylineSet qPolyline(const QVectorPath &path, const QTransform &matrix = QTransform(),
95 qreal lod = 1, bool allowUintIndices = true);
96QPolylineSet Q_GUI_EXPORT qPolyline(const QPainterPath &path, const QTransform &matrix = QTransform(),
97 qreal lod = 1, bool allowUintIndices = true);
98
99QT_END_NAMESPACE
100
101#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()
Combined button and popup list for selecting options.
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