1// qvector4d.sip generated by MetaSIP
2//
3// This file is part of the QtGui Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23%ModuleCode
24#include <qvector4d.h>
25%End
26
27class QVector4D
28{
29%TypeHeaderCode
30#include <qvector4d.h>
31%End
32
33%PickleCode
34    sipRes = Py_BuildValue((char *)"dddd", (double)sipCpp->x(),
35            (double)sipCpp->y(), (double)sipCpp->z(), (double)sipCpp->w());
36%End
37
38public:
39    QVector4D();
40    QVector4D(float xpos, float ypos, float zpos, float wpos);
41    explicit QVector4D(const QPoint &point);
42    explicit QVector4D(const QPointF &point);
43    QVector4D(const QVector2D &vector);
44    QVector4D(const QVector2D &vector, float zpos, float wpos);
45    QVector4D(const QVector3D &vector);
46    QVector4D(const QVector3D &vector, float wpos);
47    SIP_PYOBJECT __repr__() const /TypeHint="str"/;
48%MethodCode
49        PyObject *x = PyFloat_FromDouble(sipCpp->x());
50        PyObject *y = PyFloat_FromDouble(sipCpp->y());
51        PyObject *z = PyFloat_FromDouble(sipCpp->z());
52        PyObject *w = PyFloat_FromDouble(sipCpp->w());
53
54        if (x && y && z && w)
55        {
56        #if PY_MAJOR_VERSION >= 3
57            sipRes = PyUnicode_FromFormat("PyQt5.QtGui.QVector4D(%R, %R, %R, %R)", x,
58                    y, z, w);
59        #else
60            sipRes = PyString_FromString("PyQt5.QtGui.QVector4D(");
61            PyString_ConcatAndDel(&sipRes, PyObject_Repr(x));
62            PyString_ConcatAndDel(&sipRes, PyString_FromString(", "));
63            PyString_ConcatAndDel(&sipRes, PyObject_Repr(y));
64            PyString_ConcatAndDel(&sipRes, PyString_FromString(", "));
65            PyString_ConcatAndDel(&sipRes, PyObject_Repr(z));
66            PyString_ConcatAndDel(&sipRes, PyString_FromString(", "));
67            PyString_ConcatAndDel(&sipRes, PyObject_Repr(w));
68            PyString_ConcatAndDel(&sipRes, PyString_FromString(")"));
69        #endif
70        }
71
72        Py_XDECREF(x);
73        Py_XDECREF(y);
74        Py_XDECREF(z);
75        Py_XDECREF(w);
76%End
77
78    float length() const;
79    float lengthSquared() const;
80    QVector4D normalized() const;
81    void normalize();
82    static float dotProduct(const QVector4D &v1, const QVector4D &v2);
83    QVector2D toVector2D() const;
84    QVector2D toVector2DAffine() const;
85    QVector3D toVector3D() const;
86    QVector3D toVector3DAffine() const;
87    bool isNull() const;
88    float x() const;
89    float y() const;
90    float z() const;
91    float w() const;
92    void setX(float aX);
93    void setY(float aY);
94    void setZ(float aZ);
95    void setW(float aW);
96    QVector4D &operator+=(const QVector4D &vector);
97    QVector4D &operator-=(const QVector4D &vector);
98    QVector4D &operator*=(float factor);
99    QVector4D &operator*=(const QVector4D &vector);
100    QVector4D &operator/=(float divisor);
101%If (Qt_5_5_0 -)
102    QVector4D &operator/=(const QVector4D &vector);
103%End
104    QPoint toPoint() const;
105    QPointF toPointF() const;
106%If (Qt_5_2_0 -)
107    float operator[](int i) const;
108%End
109};
110
111bool operator==(const QVector4D &v1, const QVector4D &v2);
112bool operator!=(const QVector4D &v1, const QVector4D &v2);
113const QVector4D operator+(const QVector4D &v1, const QVector4D &v2);
114const QVector4D operator-(const QVector4D &v1, const QVector4D &v2);
115const QVector4D operator*(float factor, const QVector4D &vector);
116const QVector4D operator*(const QVector4D &vector, float factor);
117const QVector4D operator*(const QVector4D &v1, const QVector4D &v2);
118const QVector4D operator-(const QVector4D &vector);
119const QVector4D operator/(const QVector4D &vector, float divisor);
120%If (Qt_5_5_0 -)
121const QVector4D operator/(const QVector4D &vector, const QVector4D &divisor);
122%End
123bool qFuzzyCompare(const QVector4D &v1, const QVector4D &v2);
124QDataStream &operator<<(QDataStream &, const QVector4D & /Constrained/) /ReleaseGIL/;
125QDataStream &operator>>(QDataStream &, QVector4D & /Constrained/) /ReleaseGIL/;
126