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.Vector4i class

Four-component signed integral vector

Static methods

def zero_init() -> Vector4i
Construct a zero vector

Methods

def dot(self, /) -> int
Dot product of the vector
def flipped(self, /) -> Vector4i
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, /) -> typing.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: Vector4i, /) -> Vector4i
Add a vector
def __and__(self, arg0: Vector4i, /) -> Vector4i
Bitwise AND of two integral vectors
def __eq__(self, arg0: Vector4i, /) -> bool
Equality comparison
def __ge__(self, arg0: Vector4i, /) -> BitVector4
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: Vector4i, /) -> BitVector4
Component-wise greater than comparison
def __iadd__(self, arg0: Vector4i, /) -> Vector4i
Add and assign a vector
def __iand__(self, arg0: Vector4i, /) -> Vector4i
Do bitwise AND of two integral vectors and assign
def __ilshift__(self, arg0: int, /) -> Vector4i
Do bitwise left shift of an integral vector and assign
def __imod__(self, arg0: int, /) -> Vector4i
Do modulo of an integral vector and assign
def __imod__(self, arg0: Vector4i, /) -> Vector4i
Do module of two integral vectors and assign
def __imul__(self, arg0: int, /) -> Vector4i
Multiply with a scalar and assign
def __imul__(self, arg0: Vector4i, /) -> Vector4i
Multiply a vector component-wise and assign
def __imul__(self, arg0: float, /) -> Vector4i
Multiply an integral vector with a floating-point number and assign
def __init__(self, arg0: Vector4ui, /) -> None
Construct from different underlying type
def __init__(self, arg0: Vector4, /) -> None
Construct from different underlying type
def __init__(self, arg0: Vector4d, /) -> 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, arg3: int, /) -> None
Constructor
def __init__(self, arg0: Vector3i, arg1: int, /) -> None
Constructor
def __init__(self, arg0: typing.Tuple[int, int, int, int], /) -> None
Construct from a tuple
def __invert__(self, /) -> Vector4i
Bitwise NOT of an integral vector
def __ior__(self, arg0: Vector4i, /) -> Vector4i
Do bitwise OR of two integral vectors and assign
def __irshift__(self, arg0: int, /) -> Vector4i
Do bitwise right shift of an integral vector and assign
def __isub__(self, arg0: Vector4i, /) -> Vector4i
Subtract and assign a vector
def __itruediv__(self, arg0: int, /) -> Vector4i
Divide with a scalar and assign
def __itruediv__(self, arg0: Vector4i, /) -> Vector4i
Divide a vector component-wise and assign
def __itruediv__(self, arg0: float, /) -> Vector4i
Divide an integral vector with a floating-point number and assign
def __ixor__(self, arg0: Vector4i, /) -> Vector4i
Do bitwise XOR of two integral vectors and assign
def __le__(self, arg0: Vector4i, /) -> BitVector4
Component-wise less than or equal comparison
def __len__() -> int
Vector size. Returns 4.
def __lshift__(self, arg0: int, /) -> Vector4i
Bitwise left shift of an integral vector
def __lt__(self, arg0: Vector4i, /) -> BitVector4
Component-wise less than comparison
def __mod__(self, arg0: int, /) -> Vector4i
Modulo of an integral vector
def __mod__(self, arg0: Vector4i, /) -> Vector4i
Modulo of two integral vectors
def __mul__(self, arg0: int, /) -> Vector4i
Multiply with a scalar
def __mul__(self, arg0: Vector4i, /) -> Vector4i
Multiply a vector component-wise
def __mul__(self, arg0: float, /) -> Vector4i
Multiply an integral vector with a floating-point number
def __ne__(self, arg0: Vector4i, /) -> bool
Non-equality comparison
def __neg__(self, /) -> Vector4i
Negated vector
def __or__(self, arg0: Vector4i, /) -> Vector4i
Bitwise OR of two integral vectors
def __repr__(self, /) -> str
Object representation
def __rmul__(self, arg0: int, /) -> Vector4i
Multiply a scalar with a vector
def __rmul__(self, arg0: float, /) -> Vector4i
Multiply a floating-point number with an integral vector
def __rshift__(self, arg0: int, /) -> Vector4i
Bitwise right shift of an integral vector
def __rtruediv__(self, arg0: int, /) -> Vector4i
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: Vector4i, /) -> Vector4i
Subtract a vector
def __truediv__(self, arg0: int, /) -> Vector4i
Divide with a scalar
def __truediv__(self, arg0: Vector4i, /) -> Vector4i
Divide a vector component-wise
def __truediv__(self, arg0: float, /) -> Vector4i
Divide an integral vector with a floating-point number
def __xor__(self, arg0: Vector4i, /) -> Vector4i
Bitwise XOR of two integral vectors

Properties

a: int get set
A component
b: int get set
B component
g: int get set
G component
r: int get set
R component
rgb: Vector3i get set
RGB part of the vector
w: int get set
W component
x: int get set
X component
xy: Vector2i get set
XY part of the vector
xyz: Vector3i get set
XYZ part of the vector
y: int get set
Y component
z: int get set
Z component

Method documentation

def magnum.Vector4i.__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