mini_arcade_core.spaces.geometry.bounds

2D geometry data structures.

Classes

Position2D

Simple 2D position.

Size2D

Simple 2D size.

Bounds2D

Axis-aligned rectangular bounds in world space.

Module Contents

class mini_arcade_core.spaces.geometry.bounds.Position2D[source]

Simple 2D position.

Variables:
  • (float) (y) – X coordinate.

  • (float) – Y coordinate.

x: float
y: float
to_tuple() tuple[float, float][source]

Convert Position2D to a tuple.

Returns:

Tuple of (x, y).

Return type:

tuple[float, float]

class mini_arcade_core.spaces.geometry.bounds.Size2D[source]

Simple 2D size.

Variables:
  • (int) (height) – Width.

  • (int) – Height.

width: int
height: int
to_tuple() tuple[int, int][source]

Convert Size2D to a tuple.

Returns:

Tuple of (width, height).

Return type:

tuple[int, int]

class mini_arcade_core.spaces.geometry.bounds.Bounds2D[source]

Axis-aligned rectangular bounds in world space. (left, top) .. (right, bottom)

Variables:
  • (float) (bottom) – Left boundary.

  • (float) – Top boundary.

  • (float) – Right boundary.

  • (float) – Bottom boundary.

left: float
top: float
right: float
bottom: float
classmethod from_size(size: Size2D) Bounds2D[source]

Convenience factory for screen/world bounds starting at (0, 0).

Parameters:

size (Size2D) – Size2D defining the bounds.

Returns:

Bounds2D from (0,0) to (size.width, size.height).

Return type:

Bounds2D