NDRectComplex API
- class ndrect.ndrect_complex.NDRectComplex(rects, align_dim: Any = NOTHING)
Bases:
IsAligned[NDRect,NDRectComplex]Aligned complex n-dim rectangle of multiple rectangles in sequence.
- __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.
- along(align_dim: Any) NDRectComplex
Aligns this along a dimension to create a NDRectComplex.
- Parameters:
align_dim – The dimension name along which to align the rectangles.
- Returns:
A new
NDRectComplexaligned along the specified dimension.
- 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.
- property shape: dict[Any, Real]
Mapping of dimension names to their lengths.
- Returns:
An immutable mapping of dimension names to lengths.