QVector4D

The QVector4D class represents a vector or vertex in 4D space. More

Inheritance diagram of PySide2.QtGui.QVector4D

New in version 4.6.

Synopsis

Functions

Static functions

Detailed Description

The QVector4D class can also be used to represent vertices in 4D space. We therefore do not need to provide a separate vertex class.

class QVector4D

QVector4D(point)

QVector4D(point)

QVector4D(vector)

QVector4D(vector, zpos, wpos)

QVector4D(vector)

QVector4D(vector, wpos)

QVector4D(xpos, ypos, zpos, wpos)

param ypos

float

param point

QPoint

param wpos

float

param zpos

float

param vector

QVector2D

param xpos

float

Constructs a null vector, i.e. with coordinates (0, 0, 0, 0).

Constructs a 4D vector from the specified 2D vector . The z and w coordinates are set to zpos and wpos respectively.

See also

toVector2D()

Constructs a 4D vector from the specified 3D vector . The w coordinate is set to wpos .

See also

toVector3D()

Constructs a vector with coordinates (xpos , ypos , zpos , wpos ).

PySide2.QtGui.QVector4D.__reduce__()
Return type

PyObject

PySide2.QtGui.QVector4D.__repr__()
Return type

PyObject

static PySide2.QtGui.QVector4D.dotProduct(v1, v2)
Parameters
Return type

float

Returns the dot product of v1 and v2 .

PySide2.QtGui.QVector4D.isNull()
Return type

bool

Returns true if the x, y, z, and w coordinates are set to 0.0, otherwise returns false .

PySide2.QtGui.QVector4D.length()
Return type

float

Returns the length of the vector from the origin.

PySide2.QtGui.QVector4D.lengthSquared()
Return type

float

Returns the squared length of the vector from the origin. This is equivalent to the dot product of the vector with itself.

PySide2.QtGui.QVector4D.normalize()

Normalizes the currect vector in place. Nothing happens if this vector is a null vector or the length of the vector is very close to 1.

PySide2.QtGui.QVector4D.normalized()
Return type

QVector4D

Returns the normalized unit vector form of this vector.

If this vector is null, then a null vector is returned. If the length of the vector is very close to 1, then the vector will be returned as-is. Otherwise the normalized form of the vector of length 1 will be returned.

PySide2.QtGui.QVector4D.__ne__(v2)
Parameters

v2QVector4D

Return type

bool

PySide2.QtGui.QVector4D.__mul__(matrix)
Parameters

matrixQMatrix4x4

Return type

QVector4D

PySide2.QtGui.QVector4D.__mul__(matrix)
Parameters

matrixQMatrix4x4

Return type

QVector4D

PySide2.QtGui.QVector4D.__mul__(v2)
Parameters

v2QVector4D

Return type

QVector4D

PySide2.QtGui.QVector4D.__mul__(factor)
Parameters

factorfloat

Return type

QVector4D

PySide2.QtGui.QVector4D.__mul__(factor)
Parameters

factorfloat

Return type

QVector4D

PySide2.QtGui.QVector4D.__imul__(vector)
Parameters

vectorQVector4D

Return type

QVector4D

PySide2.QtGui.QVector4D.__imul__(factor)
Parameters

factorfloat

Return type

QVector4D

Multiplies this vector’s coordinates by the given factor , and returns a reference to this vector.

See also

operator/=()

PySide2.QtGui.QVector4D.__add__(v2)
Parameters

v2QVector4D

Return type

QVector4D

PySide2.QtGui.QVector4D.__iadd__(vector)
Parameters

vectorQVector4D

Return type

QVector4D

Adds the given vector to this vector and returns a reference to this vector.

See also

operator-=()

PySide2.QtGui.QVector4D.__sub__(v2)
Parameters

v2QVector4D

Return type

QVector4D

PySide2.QtGui.QVector4D.__sub__()
Return type

QVector4D

PySide2.QtGui.QVector4D.__isub__(vector)
Parameters

vectorQVector4D

Return type

QVector4D

Subtracts the given vector from this vector and returns a reference to this vector.

See also

operator+=()

PySide2.QtGui.QVector4D.__div__(divisor)
Parameters

divisorQVector4D

Return type

QVector4D

PySide2.QtGui.QVector4D.__div__(divisor)
Parameters

divisorfloat

Return type

QVector4D

PySide2.QtGui.QVector4D.__idiv__(vector)
Parameters

vectorQVector4D

Return type

QVector4D

PySide2.QtGui.QVector4D.__idiv__(divisor)
Parameters

divisorfloat

Return type

QVector4D

Divides this vector’s coordinates by the given divisor , and returns a reference to this vector.

See also

operator*=()

PySide2.QtGui.QVector4D.__eq__(v2)
Parameters

v2QVector4D

Return type

bool

PySide2.QtGui.QVector4D.operator[](i)
Parameters

iint

Return type

float

Returns the component of the vector at index position i .

i must be a valid index position in the vector (i.e., 0 <= i < 4).

PySide2.QtGui.QVector4D.setW(w)
Parameters

wfloat

Sets the w coordinate of this point to the given w coordinate.

See also

w() setX() setY() setZ()

PySide2.QtGui.QVector4D.setX(x)
Parameters

xfloat

Sets the x coordinate of this point to the given x coordinate.

See also

x() setY() setZ() setW()

PySide2.QtGui.QVector4D.setY(y)
Parameters

yfloat

Sets the y coordinate of this point to the given y coordinate.

See also

y() setX() setZ() setW()

PySide2.QtGui.QVector4D.setZ(z)
Parameters

zfloat

Sets the z coordinate of this point to the given z coordinate.

See also

z() setX() setY() setW()

PySide2.QtGui.QVector4D.toPoint()
Return type

QPoint

Returns the QPoint form of this 4D vector. The z and w coordinates are dropped.

PySide2.QtGui.QVector4D.toPointF()
Return type

QPointF

Returns the QPointF form of this 4D vector. The z and w coordinates are dropped.

PySide2.QtGui.QVector4D.toTuple()
Return type

PyObject

PySide2.QtGui.QVector4D.toVector2D()
Return type

QVector2D

Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.

PySide2.QtGui.QVector4D.toVector2DAffine()
Return type

QVector2D

Returns the 2D vector form of this 4D vector, dividing the x and y coordinates by the w coordinate and dropping the z coordinate. Returns a null vector if w is zero.

PySide2.QtGui.QVector4D.toVector3D()
Return type

QVector3D

Returns the 3D vector form of this 4D vector, dropping the w coordinate.

PySide2.QtGui.QVector4D.toVector3DAffine()
Return type

QVector3D

Returns the 3D vector form of this 4D vector, dividing the x, y, and z coordinates by the w coordinate. Returns a null vector if w is zero.

PySide2.QtGui.QVector4D.w()
Return type

float

Returns the w coordinate of this point.

See also

setW() x() y() z()

PySide2.QtGui.QVector4D.x()
Return type

float

Returns the x coordinate of this point.

See also

setX() y() z() w()

PySide2.QtGui.QVector4D.y()
Return type

float

Returns the y coordinate of this point.

See also

setY() x() z() w()

PySide2.QtGui.QVector4D.z()
Return type

float

Returns the z coordinate of this point.

See also

setZ() x() y() w()