72 qreal x_tmp = x2; x2 = x1; x1 = x_tmp;
73 qreal y_tmp = y2; y2 = y1; y1 = y_tmp;
77 if (y >= y1 && y < y2) {
78 qreal x = x1 + ((x2 - x1) / (y2 - y1)) * (y - y1);
240 if (dx == 0 && dy == 0)
244 register int i =
size();
355 setPoint(i++, *points, *(points+1));
383 va_start(ap, firsty);
408 if (index + nPoints >
size())
412 setPoint(i++, *points, *(points+1));
441 if (index + nPoints >
size())
447 va_start(ap, firsty);
473 if (index + nPoints >
size())
479 setPoint(index + n, from[fromIndex+n]);
495 return QRect(0, 0, 0, 0);
497 int minx, maxx, miny, maxy;
498 minx = maxx = pd->
x();
499 miny = maxy = pd->
y();
501 for (
int i = 1; i <
size(); ++i) {
504 else if (pd->
x() > maxx)
508 else if (pd->
y() > maxy)
515 #ifndef QT_NO_DEBUG_STREAM 518 #ifndef Q_BROKEN_DEBUG_STREAM 520 for (
int i = 0; i < a.
count(); ++i)
525 qWarning(
"This compiler doesn't support streaming QPolygon to QDebug");
651 for (
int i=0; i<a.
size(); ++i)
677 register int i =
size();
745 return QRectF(0, 0, 0, 0);
747 qreal minx, maxx, miny, maxy;
748 minx = maxx = pd->
x();
749 miny = maxy = pd->
y();
751 for (
int i = 1; i <
size(); ++i) {
754 else if (pd->
x() > maxx)
758 else if (pd->
y() > maxy)
762 return QRectF(minx,miny, maxx - minx, maxy - miny);
776 for (
int i=0; i<
size(); ++i)
814 #ifndef QT_NO_DATASTREAM 852 #endif // QT_NO_DATASTREAM 857 #ifndef QT_NO_DATASTREAM 877 for (i = 0; i < len; ++i)
903 for (i = 0; i < len; ++i) {
909 #endif //QT_NO_DATASTREAM 911 #ifndef QT_NO_DEBUG_STREAM 914 #ifndef Q_BROKEN_DEBUG_STREAM 916 for (
int i = 0; i < a.
count(); ++i)
921 qWarning(
"This compiler doesn't support streaming QPolygonF to QDebug");
945 int winding_number = 0;
949 for (
int i = 1; i <
size(); ++i) {
956 if (last_pt != last_start)
960 ? (winding_number != 0)
961 : ((winding_number % 2) != 0));
979 int winding_number = 0;
983 for (
int i = 1; i <
size(); ++i) {
990 if (last_pt != last_start)
994 ? (winding_number != 0)
995 : ((winding_number % 2) != 0));
The QVariant class acts like a union for the most common Qt data types.
The QDebug class provides an output stream for debugging information.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
QPolygon united(const QPolygon &r) const
Returns a polygon which is the union of this polygon and r.
QDataStream & operator>>(QDataStream &stream, QPolygon &polygon)
Reads a polygon from the given stream into the given polygon, and returns a reference to the stream...
#define QT_END_NAMESPACE
This macro expands to.
QDataStream & operator<<(QDataStream &stream, const QPolygon &polygon)
Writes the given polygon to the given stream, and returns a reference to the stream.
QPolygon translated(int dx, int dy) const
Returns a copy of the polygon that is translated by ({dx}, {dy}).
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
int count(const T &t) const
Returns the number of occurrences of value in the vector.
QDebug & nospace()
Clears the stream's internal flag that records whether the last character was a space and returns a r...
The QPointF class defines a point in the plane using floating point precision.
QPainterPath subtracted(const QPainterPath &r) const
Returns a path which is p's fill area subtracted from this path's fill area.
QPainterPath intersected(const QPainterPath &r) const
Returns a path which is the intersection of this path's fill area and p's fill area.
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
QPolygon()
Constructs a polygon with no points.
long ASN1_INTEGER_get ASN1_INTEGER * a
void putPoints(int index, int nPoints, const int *points)
Copies nPoints points from the points coord array into this point array, and resizes the point array ...
QPolygonF()
Constructs a polygon with no points.
The QPolygon class provides a vector of points using integer precision.
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
int height() const
Returns the height of the rectangle.
QRectF boundingRect() const
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty...
QPolygon toPolygon() const
Creates and returns a QPolygon by converting each QPointF to a QPoint.
qreal x() const
Returns the x-coordinate of this point.
void resize(int size)
Sets the size of the vector to size.
QPolygonF translated(qreal dx, qreal dy) const
Returns a copy of the polygon that is translated by ({dx}, {dy}).
void translate(int dx, int dy)
Translates all points in the polygon by ({dx}, {dy}).
QPolygonF united(const QPolygonF &r) const
Returns a polygon which is the union of this polygon and r.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QPolygonF toFillPolygon(const QMatrix &matrix=QMatrix()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QPolygonF intersected(const QPolygonF &r) const
Returns a polygon which is the intersection of this polygon and r.
QPolygon subtracted(const QPolygon &r) const
Returns a polygon which is r subtracted from this polygon.
qreal height() const
Returns the height of the rectangle.
The QPolygonF class provides a vector of points using floating point precision.
void append(const QPoint &t)
Inserts value at the end of the vector.
Q_CORE_EXPORT void qWarning(const char *,...)
qreal width() const
Returns the width of the rectangle.
static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QPointF &pos, int *winding)
void translate(qreal dx, qreal dy)
Translates all points in the polygon by ({dx}, {dy}).
const QPoint & at(int i) const
Returns the item at index position i in the vector.
void insert(int i, const T &t)
Inserts value at index position i in the vector.
int top() const
Returns the y-coordinate of the rectangle's top edge.
int y() const
Returns the y-coordinate of the rectangle's top edge.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
QPainterPath united(const QPainterPath &r) const
Returns a path which is the union of this path's fill area and p's fill area.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
The QRect class defines a rectangle in the plane using integer precision.
void setPoint(int index, int x, int y)
Sets the point at the given index to the point specified by ({x}, {y}).
QRect boundingRect() const
Returns the bounding rectangle of the polygon, or QRect(0, 0, 0, 0) if the polygon is empty...
bool isNull() const
Returns true if both the x and y coordinates are set to +0.
bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const
Returns true if the given point is inside the polygon according to the specified fillRule; otherwise ...
int y() const
Returns the y coordinate of this point.
qreal y() const
Returns the y-coordinate of this point.
bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const
Returns true if the given point is inside the polygon according to the specified fillRule; otherwise ...
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.
QPoint * data()
Returns a pointer to the data stored in the vector.
void setPoints(int nPoints, const int *points)
Resizes the polygon to nPoints and populates it with the given points.
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
The QDataStream class provides serialization of binary data to a QIODevice.
const QPoint * constData() const
Returns a const pointer to the data stored in the vector.
void reserve(int size)
Attempts to allocate memory for at least size elements.
int x() const
Returns the x coordinate of this point.
QPolygonF subtracted(const QPolygonF &r) const
Returns a polygon which is r subtracted from this polygon.
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
void point(int i, int *x, int *y) const
Extracts the coordinates of the point at the given index to {x} and *{y} (if they are valid pointers)...
QPolygon intersected(const QPolygon &r) const
Returns a polygon which is the intersection of this polygon and r.