PyANGKernel.GKVector

class GKVector

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

It can be used to contain a 2d vector as most of the methods for points have a default z value assigned to 0.

__init__()
__init__(pini, pfin)
Parameters:

Constructs a 3D vector using an initial and end points that will be used to calculate its coordinates.

__init__(ax, ay[, az=0.0])
Parameters:
  • ax – float

  • ay – float

  • az – float

Constructs a 3D vector setting the x, y and z coordinates.

angle(v2)
Parameters:

v2GKVector

Return type:

float

It returns the smallest angle between “this” and “v2” vectors in radians

angleWithTheHorizontal()
Return type:

float

It returns the angle this vector makes with the horizontal in radians between - GKPI and GKPI. Note: The horizontal is interpreted as the vector (1.0, 0.0)

crossProduct(v2)
Parameters:

v2GKVector

Return type:

GKVector

Returns the resulting vector of calculating the cross (vector) product between this vector and v2

dotProduct(v2)
Parameters:

v2GKVector

Return type:

float

Returns the dot (scalar) product between to vectors

fullAngle(v2)
Parameters:

v2GKVector

Return type:

float

It returns the angle between “this” and “v2” vectors in radians (0 - 2PI)

getLength()
Return type:

float

Gets the vector length calculated using the points or coordinates defined for the vector.

getX()
Return type:

float

Gets the x coordinate of this vector.

getY()
Return type:

float

Gets the y coordinate of this vector.

getZ()
Return type:

float

Gets the z coordinate of this vector.

normalize()

Normalizes this vector changing its length to 1.0 meter and normalizing the x,y and z coordinates

normalized()
Return type:

GKVector

Returns a normalized version of this vector

__mul__(d)
Parameters:

d – float

Return type:

GKVector

__imul__(d)
Parameters:

d – float

Return type:

GKVector

__add__(_point)
Parameters:

_pointGKPoint

Return type:

GKVector

__add__(_vector)
Parameters:

_vectorGKVector

Return type:

GKVector

__iadd__(rhs)
Parameters:

rhsGKVector

Return type:

GKVector

__sub__()
Return type:

GKVector

Devuelve un objeto diferente.

__sub__(_point)
Parameters:

_pointGKPoint

Return type:

GKVector

__sub__(_vector)
Parameters:

_vectorGKVector

Return type:

GKVector

__isub__(rhs)
Parameters:

rhsGKVector

Return type:

GKVector

rotate(center, angle)
Parameters:
  • centerGKPoint

  • angle – float

Rotates the vector an angle ‘angle’ in radians taking ‘center’ as the center of rotation

set(pini, pfin)
Parameters:

Sets the origin and destination point of this vector, used to indicate the vector’s direction.

set(ax, ay[, az=0.0])
Parameters:
  • ax – float

  • ay – float

  • az – float

Sets the x, y and z coordinates of this vector.

setX(_x)
Parameters:

_x – float

Sets the x coordinate of this vector

setY(_y)
Parameters:

_y – float

Sets the y coordinate of this vector

setZ(_z)
Parameters:

_z – float

Sets the z coordinate of this vector