内容表

上一话题

QValidator

下一话题

QVector3D

QVector2D

QVector2D class represents a vector or vertex in 2D space. 更多

Inheritance diagram of PySide2.QtGui.QVector2D

4.6 版新增。

概要

函数

静态函数

详细描述

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

class QVector2D

QVector2D(point)

QVector2D(point)

QVector2D(vector)

QVector2D(vector)

QVector2D(xpos, ypos)

param ypos

float

param point

QPoint

param vector

QVector3D

param xpos

float

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

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

PySide2.QtGui.QVector2D. __reduce__ ( )
返回类型

PyObject

PySide2.QtGui.QVector2D. __repr__ ( )
返回类型

PyObject

PySide2.QtGui.QVector2D. distanceToLine ( point , direction )
参数
返回类型

float

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 is returned.

另请参阅

distanceToPoint()

PySide2.QtGui.QVector2D. distanceToPoint ( point )
参数

point QVector2D

返回类型

float

Returns the distance from this vertex to a point defined by the vertex point .

另请参阅

distanceToLine()

static PySide2.QtGui.QVector2D. dotProduct ( v1 , v2 )
参数
返回类型

float

Returns the dot product of v1 and v2 .

PySide2.QtGui.QVector2D. isNull ( )
返回类型

bool

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

PySide2.QtGui.QVector2D. length ( )
返回类型

float

从原点返回向量长度。

PySide2.QtGui.QVector2D. lengthSquared ( )
返回类型

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.QVector2D. 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.QVector2D. normalized ( )
返回类型

QVector2D

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.QVector2D. __ne__ ( v2 )
参数

v2 QVector2D

返回类型

bool

PySide2.QtGui.QVector2D. __mul__ ( v2 )
参数

v2 QVector2D

返回类型

QVector2D

PySide2.QtGui.QVector2D. __mul__ ( factor )
参数

factor float

返回类型

QVector2D

PySide2.QtGui.QVector2D. __mul__ ( factor )
参数

factor float

返回类型

QVector2D

PySide2.QtGui.QVector2D. __imul__ ( factor )
参数

factor float

返回类型

QVector2D

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

另请参阅

operator/=()

PySide2.QtGui.QVector2D. __imul__ ( vector )
参数

vector QVector2D

返回类型

QVector2D

PySide2.QtGui.QVector2D. __add__ ( v2 )
参数

v2 QVector2D

返回类型

QVector2D

PySide2.QtGui.QVector2D. __iadd__ ( vector )
参数

vector QVector2D

返回类型

QVector2D

添加给定 vector to this vector and returns a reference to this vector.

另请参阅

operator-=()

PySide2.QtGui.QVector2D. __sub__ ( )
返回类型

QVector2D

PySide2.QtGui.QVector2D. __sub__ ( v2 )
参数

v2 QVector2D

返回类型

QVector2D

PySide2.QtGui.QVector2D. __isub__ ( vector )
参数

vector QVector2D

返回类型

QVector2D

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

另请参阅

operator+=()

PySide2.QtGui.QVector2D. __div__ ( divisor )
参数

divisor QVector2D

返回类型

QVector2D

PySide2.QtGui.QVector2D. __div__ ( divisor )
参数

divisor float

返回类型

QVector2D

PySide2.QtGui.QVector2D. __idiv__ ( vector )
参数

vector QVector2D

返回类型

QVector2D

PySide2.QtGui.QVector2D. __idiv__ ( divisor )
参数

divisor float

返回类型

QVector2D

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

另请参阅

operator*=()

PySide2.QtGui.QVector2D. __eq__ ( v2 )
参数

v2 QVector2D

返回类型

bool

PySide2.QtGui.QVector2D.operator[](i)
参数

i int

返回类型

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 < 2).

PySide2.QtGui.QVector2D. setX ( x )
参数

x float

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

另请参阅

x() setY()

PySide2.QtGui.QVector2D. setY ( y )
参数

y float

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

另请参阅

y() setX()

PySide2.QtGui.QVector2D. toPoint ( )
返回类型

QPoint

返回 QPoint form of this 2D vector.

PySide2.QtGui.QVector2D. toPointF ( )
返回类型

QPointF

返回 QPointF form of this 2D vector.

PySide2.QtGui.QVector2D. toTuple ( )
返回类型

PyObject

PySide2.QtGui.QVector2D. toVector3D ( )
返回类型

QVector3D

Returns the 3D form of this 2D vector, with the z coordinate set to zero.

PySide2.QtGui.QVector2D. toVector4D ( )
返回类型

QVector4D

Returns the 4D form of this 2D vector, with the z and w coordinates set to zero.

PySide2.QtGui.QVector2D. x ( )
返回类型

float

返回此点的 x 坐标。

另请参阅

setX() y()

PySide2.QtGui.QVector2D. y ( )
返回类型

float

返回此点的 y 坐标。

另请参阅

setY() x()