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

Two-dimensional double range

Static methods

def from_center(arg0: Vector2d, arg1: Vector2d, /) -> Range2Dd
Create a range from center and half size
def from_size(arg0: Vector2d, arg1: Vector2d, /) -> Range2Dd
Create a range from minimal coordinates and size
def zero_init() -> Range2Dd
Construct a zero range

Methods

def center(self, /) -> Vector2d
Range center
def center_x(self, /) -> float
Range center on X axis
def center_y(self, /) -> float
Range center on Y axis
def contains(self, arg0: Vector2d, /) -> bool
Whether given point is contained inside the range
def contains(self, arg0: Range2Dd, /) -> bool
Whether another range is fully contained inside this range
def padded(self, arg0: Vector2d, /) -> Range2Dd
Padded ange
def scaled(self, arg0: Vector2d, /) -> Range2Dd
Scaled range
def scaled(self, arg0: float, /) -> Range2Dd
Scaled range
def scaled_from_center(self, arg0: Vector2d, /) -> Range2Dd
Range scaled from the center
def scaled_from_center(self, arg0: float, /) -> Range2Dd
Range scaled from the center
def size(self, /) -> Vector2d
Range size
def size_x(self, /) -> float
Range width
def size_y(self, /) -> float
Range height
def translated(self, arg0: Vector2d, /) -> Range2Dd
Translated range
def x(self, /) -> Range1Dd
Range in the X axis
def y(self, /) -> Range1Dd
Range in the Y axis

Special methods

def __eq__(self, arg0: Range2Dd, /) -> bool
Equality comparison
def __getstate__(self, /) -> bytes
Dumps the in-memory representation of range min/max components
def __init__(self, arg0: Range2Di, /) -> None
Construct from different underlying type
def __init__(self, arg0: Range2D, /) -> None
Construct from different underlying type
def __init__(self, /) -> None
Default constructor
def __init__(self, arg0: Vector2d, arg1: Vector2d, /) -> None
Construct a range from minimal and maximal coordinates
def __init__(self, arg0: tuple[Vector2d, Vector2d], /) -> None
Construct a range from minimal and maximal coordinates
def __init__(self, arg0: tuple[tuple[float, float], tuple[float, float]], /) -> None
Construct a range from a pair of minimal and maximal coordinates
def __ne__(self, arg0: Range2Dd, /) -> bool
Non-equality comparison
def __repr__(self, /) -> str
Object representation
def __setstate__(self, arg0: bytes, /) -> None
Treats the data as the in-memory representation of range min/max components

Properties

bottom: float get set
Bottom edge
bottom_left: Vector2d get set
Bottom left corner
bottom_right: Vector2d get set
Bottom right corner
left: float get set
Left edge
max: Vector2d get set
Maximal coordinates (exclusive)
min: Vector2d get set
Minimal coordinates (inclusive)
Right edge
top: float get set
Top edge
top_left: Vector2d get set
Top left corner
top_right: Vector2d get set
Top right corner

Method documentation

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

Treats the data as the in-memory representation of range min/max components

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