Table Of Contents

Previous topic

QTileRules

Next topic

QMatrix4x4

QVector2D

Inheritance diagram of QVector2D

Note

This class was introduced in Qt 4.6

Synopsis

Functions

Static functions

Detailed Description

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

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

class PySide.QtGui.QVector2D
class PySide.QtGui.QVector2D(point)
class PySide.QtGui.QVector2D(point)
class PySide.QtGui.QVector2D(QVector2D)
class PySide.QtGui.QVector2D(vector)
class PySide.QtGui.QVector2D(vector)
class PySide.QtGui.QVector2D(xpos, ypos)
Parameters:

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

Constructs a vector with x and y coordinates from a 2D point .

Constructs a vector with x and y coordinates from a 2D point .

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

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

Constructs a vector with coordinates (xpos , ypos ).

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

PySide.QtCore.qreal

Returns the dot product of v1 and v2 .

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

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

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

Returns the length of the vector from the origin.

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

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

PySide.QtGui.QVector2D.normalized()
Return type:PySide.QtGui.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.

PySide.QtGui.QVector2D.__ne__(v2)
Parameters:v2PySide.QtGui.QVector2D
Return type:PySide.QtCore.bool
PySide.QtGui.QVector2D.__mul__(factor)
Parameters:factorPySide.QtCore.qreal
Return type:PySide.QtGui.QVector2D
PySide.QtGui.QVector2D.__mul__(factor)
Parameters:factorPySide.QtCore.qreal
Return type:PySide.QtGui.QVector2D
PySide.QtGui.QVector2D.__mul__(v2)
Parameters:v2PySide.QtGui.QVector2D
Return type:PySide.QtGui.QVector2D
PySide.QtGui.QVector2D.__imul__(vector)
Parameters:vectorPySide.QtGui.QVector2D
Return type:PySide.QtGui.QVector2D

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

PySide.QtGui.QVector2D.__imul__(factor)
Parameters:factorPySide.QtCore.qreal
Return type:PySide.QtGui.QVector2D

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

See also

PySide.QtGui.QVector2D.operator/=()

PySide.QtGui.QVector2D.__add__(v2)
Parameters:v2PySide.QtGui.QVector2D
Return type:PySide.QtGui.QVector2D
PySide.QtGui.QVector2D.__iadd__(vector)
Parameters:vectorPySide.QtGui.QVector2D
Return type:PySide.QtGui.QVector2D

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

See also

PySide.QtGui.QVector2D.operator-=()

PySide.QtGui.QVector2D.__sub__(v2)
Parameters:v2PySide.QtGui.QVector2D
Return type:PySide.QtGui.QVector2D
PySide.QtGui.QVector2D.__sub__()
Return type:PySide.QtGui.QVector2D
PySide.QtGui.QVector2D.__isub__(vector)
Parameters:vectorPySide.QtGui.QVector2D
Return type:PySide.QtGui.QVector2D

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

See also

PySide.QtGui.QVector2D.operator+=()

PySide.QtGui.QVector2D.__div__(divisor)
Parameters:divisorPySide.QtCore.qreal
Return type:PySide.QtGui.QVector2D
PySide.QtGui.QVector2D.__idiv__(divisor)
Parameters:divisorPySide.QtCore.qreal
Return type:PySide.QtGui.QVector2D

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

See also

PySide.QtGui.QVector2D.operator*=()

PySide.QtGui.QVector2D.__eq__(v2)
Parameters:v2PySide.QtGui.QVector2D
Return type:PySide.QtCore.bool
PySide.QtGui.QVector2D.setX(x)
Parameters:xPySide.QtCore.qreal

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

PySide.QtGui.QVector2D.setY(y)
Parameters:yPySide.QtCore.qreal

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

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

Returns the PySide.QtCore.QPoint form of this 2D vector.

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

Returns the PySide.QtCore.QPointF form of this 2D vector.

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

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

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

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

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

Returns the x coordinate of this point.

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

Returns the y coordinate of this point.