Vector3 class

Vector3 class

A vector with three components.

The Vector3 type exposes the following members:

Constructors

ConstructorDescription
__init__(self, x, y, z)Initializes a new instance of the Vector3 struct.
__init__(self, vec)Initializes a new instance of the Vector3 struct.
__init__(self, v)Initializes a new instance of the Vector3 struct.
__init__(self, vec4)Initializes a new instance of the Vector3 struct.
__init__(self)Constructs a new instance of Vector3

Properties

PropertyDescription
length2Gets the square of the length.
lengthGets the length of this vector.
zeroGets unit vector (0, 0, 0)
oneGets unit vector (1, 1, 1)
unit_xGets unit vector (1, 0, 0)
unit_yGets unit vector (0, 1, 0)
unit_zGets unit vector (0, 0, 1)
xThe x component.
yThe y component.
zThe z component.

Indexer

NameDescription
[index]

Methods

MethodDescription
angle_between(self, dir, up)Calculate the inner angle between two direction
Two direction can be non-normalized vectors
angle_between(self, dir)Calculate the inner angle between two direction
Two direction can be non-normalized vectors
dot(self, rhs)Gets the dot product of two vectors
normalize(self)Normalizes this instance.
sin(self)Calculates sine on each component
cos(self)Calculates cosine on each component
cross(self, rhs)Cross product of two vectors
set(self, new_x, new_y, new_z)Sets the x/y/z component in one call.
compare_to(self, other)Compare current vector to another instance.

See Also