Home · All Classes · Modules |

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

**__init__**(*self*)**__init__**(*self*, QVector3D)- bool
**isNull**(*self*) - float
**length**(*self*) - float
**lengthSquared**(*self*) **normalize**(*self*)- QVector3D
**normalized**(*self*) - QPoint
**toPoint**(*self*) - QPointF
**toPointF**(*self*) - QVector2D
**toVector2D**(*self*) - QVector4D
**toVector4D**(*self*) - float
**x**(*self*) - float
**y**(*self*) - float
**z**(*self*)

This class can be pickled.

The 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 QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class.

**Note:** By design values in the QVector3D instance are
stored as `float`. This means that on platforms where the
`qreal` arguments to QVector3D functions are represented by
`double` values, it is possible to lose precision.

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

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

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.

**See also** toVector2D().

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

**See also** toVector2D().

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

**See also** toVector4D().

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

**See also** normal().

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.

**See also** distanceToPlane().

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.

**See also** normal() and
distanceToLine().

This is an overloaded function.

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*.

**See also** normal() and
distanceToLine().

Returns the dot product of *v1* and *v2*.

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

Returns the length of the vector from the origin.

**See also** lengthSquared() and normalized().

**See also** length() and
dotProduct().

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

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

**See also** crossProduct() and distanceToPlane().

This is an overloaded function.

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

Use 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.

**See also** crossProduct() and distanceToPlane().

**See also** length() and
normalized().

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.

**See also** length() and
normalize().

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

**See also** x(), setY(), and setZ().

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

**See also** y(), setX(), and setZ().

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

**See also** z(), setX(), and setY().

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

**See also** toPointF()
and toVector2D().

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

**See also** toPoint()
and toVector2D().

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

**See also** toVector4D() and toPoint().

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

**See also** toVector2D() and toPoint().

Returns the x coordinate of this point.

**See also** setX(),
y(), and z().

Returns the y coordinate of this point.

**See also** setY(),
x(), and z().

Returns the z coordinate of this point.

**See also** setZ(),
x(), and y().

PyQt 4.9.4 for Windows | Copyright © Riverbank Computing Ltd and Nokia 2012 | Qt 4.8.2 |