NDRect API
- class ndrect.ndrect.NDRect(shape)
Bases:
IsAligned[NDRect,NDRectComplex]An n-dim rectangle defined by its shape.
- __add__(other: IsAligned) TComplex
Shorthand for
then().Sequences the other rectangle after this one.
- Parameters:
other – Another rectangle to sequence after this one.
- Returns:
A new
NDRectComplexrepresenting the sequence.
- __mul__(n: int) TComplex
Shorthand for
repeat().Repeats the current rectangle n times.
- Parameters:
n – Number of times to repeat.
- Returns:
A new
NDRectComplexrepresenting the repeated sequence.
- fill_into(bounding: Mapping[DimensionName, DimensionLength], fill_order: Sequence[DimensionName] | None = None) TComplex
Fill the current rectangle until it matches the bounding shape.
- Parameters:
bounding – The target bounding shape to fill into.
fill_order – The order in which to fill dimensions. If None, uses the order of the current shape’s keys.
- Returns:
A new
NDRectComplexrepresenting the filled rectangle.
- repeat(n: int = 2) TComplex
Repeats the current rectangle n times in sequence.
- Parameters:
n – Number of times to repeat. n=1 returns the same rectangle, n=2 returns two in sequence, etc.
- Returns:
A new
NDRectComplexrepresenting the repeated sequence.
- then(other: IsAligned) TComplex
Sequences the other rectangle after this one.
- Parameters:
other – Another rectangle to sequence after this one.
- Returns:
A new
NDRectComplexrepresenting the sequence.
- property ndim: int
Number of unique dimensions.
- Returns:
The number of unique dimensions in the shape.