QVector3D Class Reference

[ QtGui module]

QVector3D 类表示 3D 空间中的向量或顶点。 更多...

方法

Static Methods

Special Methods


详细描述

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 类。

注意: 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.


方法文档编制

QVector3D.__init__ ( self )

构造 null 向量,即:采用坐标 (0, 0, 0)。

QVector3D.__init__ ( self , float  xpos , float  ypos , float  zpos )

构造向量采用坐标 ( xpos , ypos , zpos ).

QVector3D.__init__ ( self , QPoint   point )

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

QVector3D.__init__ ( self , QPointF   point )

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

QVector3D.__init__ ( self , QVector2D   vector )

构造 3D 向量从指定 2D vector 。 z coordinate is set to zero.

另请参阅 toVector2D ().

QVector3D.__init__ ( self , QVector2D   vector , float  zpos )

构造 3D 向量从指定 2D vector 。 z coordinate is set to zpos .

另请参阅 toVector2D ().

QVector3D.__init__ ( self , QVector4D   vector )

构造 3D 向量从指定 4D vector 。 w coordinate is dropped.

另请参阅 toVector4D ().

QVector3D.__init__ ( self , QVector3D )

QVector3D QVector3D.crossProduct ( QVector3D   v1 , QVector3D   v2 )

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

另请参阅 normal ().

float QVector3D.distanceToLine ( self , QVector3D   point , QVector3D   direction )

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

direction is a null vector, then it does not define a line. In that case, the distance from point to this vertex 被返回。

另请参阅 distanceToPlane ().

float QVector3D.distanceToPlane ( self , QVector3D   plane , QVector3D   normal )

Returns the distance from this vertex to a plane defined by the vertex plane 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.

另请参阅 normal () 和 distanceToLine ().

float QVector3D.distanceToPlane ( self , QVector3D   plane1 , QVector3D   plane2 , QVector3D   plane3 )

这是重载函数。

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 .

另请参阅 normal () 和 distanceToLine ().

float QVector3D.dotProduct ( QVector3D   v1 , QVector3D   v2 )

Returns the dot product of v1 and v2 .

bool QVector3D.isNull ( self )

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

float QVector3D.length ( self )

从原点返回向量长度。

另请参阅 lengthSquared () 和 normalized ().

float QVector3D.lengthSquared ( self )

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

另请参阅 length () 和 dotProduct ().

QVector3D QVector3D.normal ( QVector3D   v1 , QVector3D   v2 )

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

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

另请参阅 crossProduct () 和 distanceToPlane ().

QVector3D QVector3D.normal ( QVector3D   v1 , QVector3D   v2 , QVector3D   v3 )

这是重载函数。

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

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

另请参阅 crossProduct () 和 distanceToPlane ().

QVector3D.normalize ( self )

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.

另请参阅 length () 和 normalized ().

QVector3D QVector3D.normalized ( self )

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.

另请参阅 length () 和 normalize ().

QVector3D.setX ( self , float  aX )

Sets the x coordinate of this point to the given x 坐标。

另请参阅 x (), setY (),和 setZ ().

QVector3D.setY ( self , float  aY )

Sets the y coordinate of this point to the given y 坐标。

另请参阅 y (), setX (),和 setZ ().

QVector3D.setZ ( self , float  aZ )

Sets the z coordinate of this point to the given z 坐标。

另请参阅 z (), setX (),和 setY ().

QPoint QVector3D.toPoint ( self )

返回 QPoint form of this 3D vector. The z coordinate is dropped.

另请参阅 toPointF () and toVector2D ().

QPointF QVector3D.toPointF ( self )

返回 QPointF form of this 3D vector. The z coordinate is dropped.

另请参阅 toPoint () and toVector2D ().

QVector2D QVector3D.toVector2D ( self )

Returns the 2D vector form of this 3D vector, dropping the z 坐标。

另请参阅 toVector4D () 和 toPoint ().

QVector4D QVector3D.toVector4D ( self )

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

另请参阅 toVector2D () 和 toPoint ().

float QVector3D.x ( self )

返回此点的 x 坐标。

另请参阅 setX (), y (),和 z ().

float QVector3D.y ( self )

返回此点的 y 坐标。

另请参阅 setY (), x (),和 z ().

float QVector3D.z ( self )

返回此点的 z 坐标。

另请参阅 setZ (), x (),和 y ().

QVector3D QVector3D.__add__ ( self , QVector3D   v2 )

QVector3D QVector3D.__div__ ( self , float  divisor )

bool QVector3D.__eq__ ( self , QVector3D   v2 )

QVector3D QVector3D.__iadd__ ( self , QVector3D   vector )

QVector3D QVector3D.__idiv__ ( self , float  divisor )

QVector3D QVector3D.__imul__ ( self , float  factor )

QVector3D QVector3D.__imul__ ( self , QVector3D   vector )

QVector3D QVector3D.__isub__ ( self , QVector3D   vector )

QVector3D QVector3D.__mul__ ( self , QMatrix4x4   matrix )

QVector3D QVector3D.__mul__ ( self , QVector3D   vector )

QVector3D QVector3D.__mul__ ( self , float  factor )

QVector3D QVector3D.__mul__ ( self , QVector3D   v2 )

bool QVector3D.__ne__ ( self , QVector3D   v2 )

QVector3D QVector3D.__neg__ ( self )

str QVector3D.__repr__ ( self )

QVector3D QVector3D.__sub__ ( self , QVector3D   v2 )