vray.Vector

class vray.Vector

Bases: object

A mathematical vector in 3D space. Supports the usual mathematical operations including dot and cross products (* and ^). The three components can be indexed like a list. This object is immutable.

  • Vector() -> new Vector with value (0, 0, 0)

  • Vector(x,y,z) -> new Vector initialized to (x,y,z)

Attributes

x

Vector X axis value

y

Vector Y axis value

z

Vector Z axis value

Methods

__init__()

length(self)

Returns the length of this vector.

lengthSqr(self)

Returns the length of this vector squared.

mixed(a, b, c)

Returns the mixed product of the three vectors ((a ^ b) * c)

mul(first, second)

Mutiplies the components of the given vectors.

normalize(self)

Returns the normalized copy of the given vector.

rotate(self, axis)

Get a rotated vector along the given axis.

length(self) → float

Returns the length of this vector.

lengthSqr(self) → float

Returns the length of this vector squared.

static mixed(a: Vector, b: Vector, c: Vector) → Vector

Returns the mixed product of the three vectors ((a ^ b) * c)

static mul(first: Vector, second: Vector) → Vector

Mutiplies the components of the given vectors. Note that this is different from operator*, which does dot product.

normalize(self) → Vector

Returns the normalized copy of the given vector.

rotate(self, axis: Vector) → Vector

Get a rotated vector along the given axis.

  • axis - An axis vector to rotate around. The length of the axis is the tangent of the angle of rotation.

Returns rotated vector

x

Vector X axis value

y

Vector Y axis value

z

Vector Z axis value