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

One-dimensional double range

Static methods

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

Methods

def center(self, /) -> float
Range center
def contains(self, arg0: float, /) -> bool
Whether given point is contained inside the range
def contains(self, arg0: Range1Dd, /) -> bool
Whether another range is fully contained inside this range
def padded(self, arg0: float, /) -> Range1Dd
Padded ange
def scaled(self, arg0: float, /) -> Range1Dd
Scaled range
def scaled_from_center(self, arg0: float, /) -> Range1Dd
Range scaled from the center
def size(self, /) -> float
Range size
def translated(self, arg0: float, /) -> Range1Dd
Translated range

Special methods

def __eq__(self, arg0: Range1Dd, /) -> bool
Equality comparison
def __getstate__(self, /) -> bytes
Dumps the in-memory representation of range min/max components
def __init__(self, arg0: Range1Di, /) -> None
Construct from different underlying type
def __init__(self, arg0: Range1D, /) -> None
Construct from different underlying type
def __init__(self, /) -> None
Default constructor
def __init__(self, arg0: float, arg1: float, /) -> None
Construct a range from minimal and maximal coordinates
def __init__(self, arg0: typing.Tuple[float, float], /) -> None
Construct a range from minimal and maximal coordinates
def __ne__(self, arg0: Range1Dd, /) -> 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

max: float get set
Maximal coordinates (exclusive)
min: float get set
Minimal coordinates (inclusive)

Method documentation

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