Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

magnum.Vector3i class

Three-component signed integral vector

Static methods

def x_axis(length: int = 1) -> Vector3i
Vector in a direction of X axis (right)
def x_scale(scale: int) -> Vector3i
Scaling vector in a direction of X axis (width)
def y_axis(length: int = 1) -> Vector3i
Vector in a direction of Y axis (up)
def y_scale(scale: int) -> Vector3i
Scaling vector in a direction of Y axis (height)
def z_axis(length: int = 1) -> Vector3i
Vector in a direction of Z axis (backward)
def z_scale(scale: int) -> Vector3i
Scaling vector in a direction of Z axis (depth)
def zero_init() -> Vector3i
Construct a zero vector

Methods

def dot(self, /) -> int
Dot product of the vector
def flipped(self, /) -> Vector3i
Flipped vector
def is_zero(self, /) -> bool
Whether the vector is zero
def max(self, /) -> int
Maximal value in the vector
def min(self, /) -> int
Minimal value in the vector
def minmax(self, /) -> tuple[int, int]
Minimal and maximal value in the vector
def product(self, /) -> int
Product of values in the vector
def sum(self, /) -> int
Sum of values in the vector

Special methods

def __add__(self, arg0: Vector3i, /) -> Vector3i
Add a vector
def __and__(self, arg0: Vector3i, /) -> Vector3i
Bitwise AND of two integral vectors
def __buffer__(self, flags, /)
Return a buffer object that exposes the underlying memory of the object.
def __eq__(self, arg0: Vector3i, /) -> bool
Equality comparison
def __ge__(self, arg0: Vector3i, /) -> BitVector3
Component-wise greater than or equal comparison
def __getattr__(self, arg0: str, /) -> object
Vector swizzle
def __getitem__(self, arg0: int, /) -> int
Value at given position
def __getstate__(self, /) -> bytes
Dumps the in-memory representation of vector components
def __gt__(self, arg0: Vector3i, /) -> BitVector3
Component-wise greater than comparison
def __iadd__(self, arg0: Vector3i, /) -> Vector3i
Add and assign a vector
def __iand__(self, arg0: Vector3i, /) -> Vector3i
Do bitwise AND of two integral vectors and assign
def __ilshift__(self, arg0: int, /) -> Vector3i
Do bitwise left shift of an integral vector and assign
def __imod__(self, arg0: int, /) -> Vector3i
Do modulo of an integral vector and assign
def __imod__(self, arg0: Vector3i, /) -> Vector3i
Do module of two integral vectors and assign
def __imul__(self, arg0: int, /) -> Vector3i
Multiply with a scalar and assign
def __imul__(self, arg0: Vector3i, /) -> Vector3i
Multiply a vector component-wise and assign
def __imul__(self, arg0: float, /) -> Vector3i
Multiply an integral vector with a floating-point number and assign
def __init__(self, arg0: Vector3ui, /) -> None
Construct from different underlying type
def __init__(self, arg0: Vector3, /) -> None
Construct from different underlying type
def __init__(self, arg0: Vector3d, /) -> None
Construct from different underlying type
def __init__(self, arg0: Buffer, /) -> None
Construct from a buffer
def __init__(self, /) -> None
Default constructor
def __init__(self, arg0: int, /) -> None
Construct a vector with one value for all components
def __init__(self, arg0: int, arg1: int, arg2: int, /) -> None
Constructor
def __init__(self, arg0: Vector2i, arg1: int, /) -> None
Constructor
def __init__(self, arg0: tuple[int, int, int], /) -> None
Construct from a tuple
def __invert__(self, /) -> Vector3i
Bitwise NOT of an integral vector
def __ior__(self, arg0: Vector3i, /) -> Vector3i
Do bitwise OR of two integral vectors and assign
def __irshift__(self, arg0: int, /) -> Vector3i
Do bitwise right shift of an integral vector and assign
def __isub__(self, arg0: Vector3i, /) -> Vector3i
Subtract and assign a vector
def __itruediv__(self, arg0: int, /) -> Vector3i
Divide with a scalar and assign
def __itruediv__(self, arg0: Vector3i, /) -> Vector3i
Divide a vector component-wise and assign
def __itruediv__(self, arg0: float, /) -> Vector3i
Divide an integral vector with a floating-point number and assign
def __ixor__(self, arg0: Vector3i, /) -> Vector3i
Do bitwise XOR of two integral vectors and assign
def __le__(self, arg0: Vector3i, /) -> BitVector3
Component-wise less than or equal comparison
def __len__() -> int
Vector size. Returns 3.
def __lshift__(self, arg0: int, /) -> Vector3i
Bitwise left shift of an integral vector
def __lt__(self, arg0: Vector3i, /) -> BitVector3
Component-wise less than comparison
def __mod__(self, arg0: int, /) -> Vector3i
Modulo of an integral vector
def __mod__(self, arg0: Vector3i, /) -> Vector3i
Modulo of two integral vectors
def __mul__(self, arg0: int, /) -> Vector3i
Multiply with a scalar
def __mul__(self, arg0: Vector3i, /) -> Vector3i
Multiply a vector component-wise
def __mul__(self, arg0: float, /) -> Vector3i
Multiply an integral vector with a floating-point number
def __ne__(self, arg0: Vector3i, /) -> bool
Non-equality comparison
def __neg__(self, /) -> Vector3i
Negated vector
def __or__(self, arg0: Vector3i, /) -> Vector3i
Bitwise OR of two integral vectors
def __release_buffer__(self, buffer, /)
Release the buffer object that exposes the underlying memory of the object.
def __repr__(self, /) -> str
Object representation
def __rmul__(self, arg0: int, /) -> Vector3i
Multiply a scalar with a vector
def __rmul__(self, arg0: float, /) -> Vector3i
Multiply a floating-point number with an integral vector
def __rshift__(self, arg0: int, /) -> Vector3i
Bitwise right shift of an integral vector
def __rtruediv__(self, arg0: int, /) -> Vector3i
Divide a vector with a scalar and invert
def __setattr__(self, arg0: str, arg1: object, /) -> None
Vector swizzle
def __setitem__(self, arg0: int, arg1: int, /) -> None
Set a value at given position
def __setstate__(self, arg0: bytes, /) -> None
Treats the data as the in-memory representation of vector components
def __sub__(self, arg0: Vector3i, /) -> Vector3i
Subtract a vector
def __truediv__(self, arg0: int, /) -> Vector3i
Divide with a scalar
def __truediv__(self, arg0: Vector3i, /) -> Vector3i
Divide a vector component-wise
def __truediv__(self, arg0: float, /) -> Vector3i
Divide an integral vector with a floating-point number
def __xor__(self, arg0: Vector3i, /) -> Vector3i
Bitwise XOR of two integral vectors

Properties

b: int get set
B component
g: int get set
G component
r: int get set
R component
x: int get set
X component
xy: Vector2i get set
XY part of the vector
y: int get set
Y component
z: int get set
Z component

Method documentation

def magnum.Vector3i.__setstate__(self, arg0: bytes, /) -> None

Treats the data as the in-memory representation of vector components

Exceptions
ValueError If the data size doesn’t match type size