QVector4D

QStyleOption

# QVector3D¶

Note

This class was introduced in Qt 4.6

## Detailed Description¶

The PySide.QtGui.QVector3D class represents a vector or vertex in 3D space.

Vectors are one of the main building blocks of 3D representation and drawing. They consist of three coordinates, traditionally called x, y, and z.

The PySide.QtGui.QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class.

class PySide.QtGui.QVector3D
class PySide.QtGui.QVector3D(point)
class PySide.QtGui.QVector3D(point)
class PySide.QtGui.QVector3D(vector)
class PySide.QtGui.QVector3D(vector, zpos)
class PySide.QtGui.QVector3D(QVector3D)
class PySide.QtGui.QVector3D(vector)
class PySide.QtGui.QVector3D(xpos, ypos, zpos)
Parameters: vector – PySide.QtGui.QVector2D point – PySide.QtCore.QPoint zpos – PySide.QtCore.qreal ypos – PySide.QtCore.qreal xpos – PySide.QtCore.qreal QVector3D – PySide.QtGui.QVector3D

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

Constructs a vector with x and y coordinates from a 2D point , and a z coordinate of 0.

Constructs a vector with x and y coordinates from a 2D point , and a z coordinate of 0.

Constructs a 3D vector from the specified 2D vector . The z coordinate is set to zero.

Constructs a 3D vector from the specified 2D vector . The z coordinate is set to zpos .

Constructs a 3D vector from the specified 4D vector . The w coordinate is dropped.

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

PySide.QtGui.QVector3D.__reduce__()
Return type: PyObject
PySide.QtGui.QVector3D.__repr__()
Return type: PyObject
static PySide.QtGui.QVector3D.crossProduct(v1, v2)
Parameters: PySide.QtGui.QVector3D

Returns the cross-product of vectors v1 and v2 , which corresponds to the normal vector of a plane defined by v1 and v2 .

PySide.QtGui.QVector3D.distanceToLine(point, direction)
Parameters: point – PySide.QtGui.QVector3D direction – PySide.QtGui.QVector3D PySide.QtCore.qreal

Returns the distance that this vertex is from a line defined by point and the unit vector direction .

If direction is a null vector, then it does not define a line. In that case, the distance from point to this vertex is returned.

PySide.QtGui.QVector3D.distanceToPlane(plane1, plane2, plane3)
Parameters: plane1 – PySide.QtGui.QVector3D plane2 – PySide.QtGui.QVector3D plane3 – PySide.QtGui.QVector3D PySide.QtCore.qreal

Returns the distance from this vertex a plane defined by the vertices plane1 , plane2 and plane3 .

The return value will be negative if the vertex is below the plane, or zero if it is on the plane.

The two vectors that define the plane are plane2 - plane1 and plane3 - plane1 .

PySide.QtGui.QVector3D.distanceToPlane(plane, normal)
Parameters: plane – PySide.QtGui.QVector3D normal – PySide.QtGui.QVector3D PySide.QtCore.qreal

Returns the distance from this vertex to a plane defined by the vertex plane and a normal unit vector. The normal parameter is assumed to have been normalized to a unit vector.

The return value will be negative if the vertex is below the plane, or zero if it is on the plane.

static PySide.QtGui.QVector3D.dotProduct(v1, v2)
Parameters: PySide.QtCore.qreal

Returns the dot product of v1 and v2 .

PySide.QtGui.QVector3D.isNull()
Return type: PySide.QtCore.bool

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

PySide.QtGui.QVector3D.length()
Return type: PySide.QtCore.qreal

Returns the length of the vector from the origin.

PySide.QtGui.QVector3D.lengthSquared()
Return type: PySide.QtCore.qreal

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

static PySide.QtGui.QVector3D.normal(v1, v2, v3)
Parameters: PySide.QtGui.QVector3D

Returns the normal vector of a plane defined by vectors v2 - v1 and v3 - v1 , normalized to be a unit vector.

Use PySide.QtGui.QVector3D.crossProduct() to compute the cross-product of v2 - v1 and v3 - v1 if you do not need the result to be normalized to a unit vector.

static PySide.QtGui.QVector3D.normal(v1, v2)
Parameters: PySide.QtGui.QVector3D

Returns the normal vector of a plane defined by vectors v1 and v2 , normalized to be a unit vector.

Use PySide.QtGui.QVector3D.crossProduct() to compute the cross-product of v1 and v2 if you do not need the result to be normalized to a unit vector.

PySide.QtGui.QVector3D.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.

PySide.QtGui.QVector3D.normalized()
Return type: PySide.QtGui.QVector3D

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.

PySide.QtGui.QVector3D.__ne__(v2)
Parameters: v2 – PySide.QtGui.QVector3D PySide.QtCore.bool
PySide.QtGui.QVector3D.__mul__(factor)
Parameters: factor – PySide.QtCore.qreal PySide.QtGui.QVector3D
PySide.QtGui.QVector3D.__mul__(factor)
Parameters: factor – PySide.QtCore.qreal PySide.QtGui.QVector3D
PySide.QtGui.QVector3D.__mul__(matrix)
Parameters: matrix – PySide.QtGui.QMatrix4x4 PySide.QtGui.QVector3D
PySide.QtGui.QVector3D.__mul__(v2)
Parameters: v2 – PySide.QtGui.QVector3D PySide.QtGui.QVector3D
PySide.QtGui.QVector3D.__mul__(matrix)
Parameters: matrix – PySide.QtGui.QMatrix4x4 PySide.QtGui.QVector3D
PySide.QtGui.QVector3D.__imul__(factor)
Parameters: factor – PySide.QtCore.qreal PySide.QtGui.QVector3D

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

PySide.QtGui.QVector3D.operator/=()

PySide.QtGui.QVector3D.__imul__(vector)
Parameters: vector – PySide.QtGui.QVector3D PySide.QtGui.QVector3D

Multiplies the components of this vector by the corresponding components in vector .

Note: this is not the same as the PySide.QtGui.QVector3D.crossProduct() of this vector and vector .

Parameters: v2 – PySide.QtGui.QVector3D PySide.QtGui.QVector3D
Parameters: vector – PySide.QtGui.QVector3D PySide.QtGui.QVector3D

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

PySide.QtGui.QVector3D.operator-=()

PySide.QtGui.QVector3D.__sub__()
Return type: PySide.QtGui.QVector3D
PySide.QtGui.QVector3D.__sub__(v2)
Parameters: v2 – PySide.QtGui.QVector3D PySide.QtGui.QVector3D
PySide.QtGui.QVector3D.__isub__(vector)
Parameters: vector – PySide.QtGui.QVector3D PySide.QtGui.QVector3D

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

PySide.QtGui.QVector3D.operator+=()

PySide.QtGui.QVector3D.__div__(divisor)
Parameters: divisor – PySide.QtCore.qreal PySide.QtGui.QVector3D
PySide.QtGui.QVector3D.__idiv__(divisor)
Parameters: divisor – PySide.QtCore.qreal PySide.QtGui.QVector3D

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

PySide.QtGui.QVector3D.operator*=()

PySide.QtGui.QVector3D.__eq__(v2)
Parameters: v2 – PySide.QtGui.QVector3D PySide.QtCore.bool
PySide.QtGui.QVector3D.setX(x)
Parameters: x – PySide.QtCore.qreal

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

PySide.QtGui.QVector3D.setY(y)
Parameters: y – PySide.QtCore.qreal

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

PySide.QtGui.QVector3D.setZ(z)
Parameters: z – PySide.QtCore.qreal

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

PySide.QtGui.QVector3D.toPoint()
Return type: PySide.QtCore.QPoint

Returns the PySide.QtCore.QPoint form of this 3D vector. The z coordinate is dropped.

PySide.QtGui.QVector3D.toPointF()
Return type: PySide.QtCore.QPointF

Returns the PySide.QtCore.QPointF form of this 3D vector. The z coordinate is dropped.

PySide.QtGui.QVector3D.toTuple()
Return type: PyObject
PySide.QtGui.QVector3D.toVector2D()
Return type: PySide.QtGui.QVector2D

Returns the 2D vector form of this 3D vector, dropping the z coordinate.

PySide.QtGui.QVector3D.toVector4D()
Return type: PySide.QtGui.QVector4D

Returns the 4D form of this 3D vector, with the w coordinate set to zero.

PySide.QtGui.QVector3D.x()
Return type: PySide.QtCore.qreal

Returns the x coordinate of this point.

PySide.QtGui.QVector3D.y()
Return type: PySide.QtCore.qreal

Returns the y coordinate of this point.

PySide.QtGui.QVector3D.z()
Return type: PySide.QtCore.qreal

Returns the z coordinate of this point.