pyinterp.geometry.cartesian.Box

Contents

pyinterp.geometry.cartesian.Box#

class pyinterp.geometry.cartesian.Box(self, min_corner: tuple[float, float] | None = None, max_corner: tuple[float, float] | None = None)#

Bases: object

A box (rectangle) in Cartesian coordinates.

The box is represented by two corner points: the minimum corner (bottom-left) and the maximum corner (top-right).

Examples

>>> from pyinterp.geometry.cartesian import Box

Create box from (0, 0) to (100, 100)

>>> x = (0.0, 100.0)
>>> y = (0.0, 100.0)
>>> box = Box(x, y)
>>> box.min_corner()
Point(x=0.0, y=0.0)
>>> box.max_corner()
Point(x=100.0, y=100.0)

Construct a box from x and y tuples.

Parameters:
  • min_corner – Tuple of (x_min, y_min) for the minimum corner.

  • max_corner – Tuple of (x_max, y_max) for the maximum corner.

Attributes

max_corner

Maximum corner (top-right) of the box.

min_corner

Minimum corner (bottom-left) of the box.

Special Methods

__eq__(self, other)

Check if two boxes are equal.

__getstate__(self)

Return the state of the Box for pickling.

__ne__(self, other)

Check if two boxes are not equal.

__new__(*args, **kwargs)

__repr__(self)

Return the official string representation of the Box.

__setstate__(self, state)

Restore the state of the Box from pickling.

__str__(self)

Return the informal string representation of the Box.