Vector enables mathematical operations of vectors.
Its constructor takes either a tuple/list of three values (x, y, z), a single number as (x, x, x) or three numbers as (x, y, z).
Examples:
luxmath.Vector((1, 2, 3)) # -> (1, 2, 3)
luxmath.Vector(1) # -> (1, 1, 1)
luxmath.Vector(1, 2, 3) # -> (1, 2, 3)
Additionally, whenever a luxmath.Vector is accepted it is also allowed to give a tuple/list of size 3 or a number.
Examples:
luxmath.Vector(1).add(1) # -> (2, 2, 2)
luxmath.Vector(1).add((1, 2, 3)) # -> (2, 3, 4)
Methods defined here:
- __eq__(self, value, /)
- Return self==value.
- __ge__(self, value, /)
- Return self>=value.
- __gt__(self, value, /)
- Return self>value.
- __hash__(self, /)
- Return hash(self).
- __init__(self, /, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- __le__(self, value, /)
- Return self<=value.
- __lt__(self, value, /)
- Return self<value.
- __ne__(self, value, /)
- Return self!=value.
- __repr__(self, /)
- Return repr(self).
- __str__(self, /)
- Return str(self).
- add(...)
- Adds the Vector to a copy of this Vector and returns the result.
vec = Vector to add. *
- cross(...)
- Calculates the cross product and returns the result.
vec1 = Vector one. *
vec2 = Vector two. *
- div(...)
- Divides a copy of this Vector with a number and returns the result.
num = Number to divide with. *
- getOrthogonalBasis(...)
- Gets the orthogonal basis as two Vectors.
- len(...)
- Returns the length of the Vector.
- mul(...)
- Multiplies the Vector or number to a copy of this Vector and returns the result.
val = Vector or number to multiply with.
- normalize(...)
- Normalizes a copy of the Vector and returns the result.
- set(...)
- Set (x, y, z) values.
tup = Tuple of size 3 to assign. *
- setOrthogonal(...)
- Sets orthogonal to input Vector.
vec = Vector make orthogonal to. *
- sub(...)
- Subtracts the Vector from a copy of this Vector and returns the result.
vec = Vector to subtract. *
- val(...)
- Returns the values in a tuple (x, y, z).
Class methods defined here:
- dot(...) from builtins.type
- Calculates the dot product and returns the result (class method).
vec1 = Vector one. *
vec2 = Vector two. *
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- x
- The X part.
- y
- The Y part.
- z
- The Z part.