QVector2D

PyQt5.QtGui.QVector2D

Description

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

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

Methods

__init__()

TODO


__init__(QPoint)

TODO


__init__(Union[QPointF, QPoint])

TODO


__init__(QVector3D)

Constructs a vector with x and y coordinates from a 3D vector. The z coordinate of vector is dropped.

See also

toVector3D().


__init__(QVector4D)

Constructs a vector with x and y coordinates from a 3D vector. The z and w coordinates of vector are dropped.

See also

toVector4D().


__init__(QVector2D)

TODO


__init__(float, float)

TODO


__add__(QVector2D) QVector2D

TODO


distanceToLine(QVector2D, QVector2D) float

TODO


distanceToPoint(QVector2D) float

TODO


@staticmethod
dotProduct(QVector2D, QVector2D) float

Returns the dot product of v1 and v2.


__eq__(QVector2D) bool

TODO


__getitem__(int) float

TODO


__iadd__(QVector2D) QVector2D

TODO


__imul__(float) QVector2D

TODO


__imul__(QVector2D) QVector2D

TODO


isNull() bool

TODO


__isub__(QVector2D) QVector2D

TODO


__itruediv__(float) QVector2D

TODO


__itruediv__(QVector2D) QVector2D

TODO


length() float

Returns the length of the vector from the origin.


lengthSquared() float

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

See also

length(), dotProduct().


__mul__(float) QVector2D

TODO


__mul__(QVector2D) QVector2D

TODO


__ne__(QVector2D) bool

TODO


__neg__() QVector2D

TODO


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.

See also

length(), normalized().


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.

See also

length(), normalize().


__repr__() str

TODO


__rmul__(float) QVector2D

TODO


setX(float)

TODO


setY(float)

TODO


__sub__(QVector2D) QVector2D

TODO


toPoint() QPoint

TODO


toPointF() QPointF

TODO


toVector3D() QVector3D

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

See also

toVector4D(), toPoint().


toVector4D() QVector4D

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

See also

toVector3D(), toPoint().


__truediv__(float) QVector2D

TODO


__truediv__(QVector2D) QVector2D

TODO


x() float

See also

setX().


y() float

See also

setY().