---
title: "BBox"
description: "An axis-aligned bounding box defined by minimum and maximum corner points."
canonical_url: "https://www.rosette.dev/docs/api-reference/BBox"
markdown_url: "https://www.rosette.dev/docs/api-reference/BBox.md"
source_url: "https://github.com/PreFab-Photonics/rosette/blob/f086d7670645fd36c05362d696d442a2b2e74850/www/content/docs/api-reference/BBox.mdx"
docs_channel: "main"
docs_revision: "f086d7670645fd36c05362d696d442a2b2e74850"
---

# BBox

An axis-aligned bounding box defined by minimum and maximum corner points.

Bounding boxes are used to query the spatial extent of geometry. They are
returned by `Polygon.bbox()` and `Cell.bbox()`, and can be merged to
compute the bounds of composite shapes.

```python
box = BBox(Point(0, 0), Point(10, 5))
box.width()     # 10.0
box.height()    # 5.0
box.center()    # Point(5.0, 2.5)
box.area()      # 50.0

# Merge two bounding boxes
other = BBox(Point(8, 3), Point(15, 9))
combined = box.merge(other)  # BBox(Point(0, 0), Point(15, 9))
```

## Attributes



### `min`

```python
min: Point
```

The minimum corner (bottom-left) of the bounding box.





### `max`

```python
max: Point
```

The maximum corner (top-right) of the bounding box.



## Methods



### `__init__`

```python
__init__(min, max) -> None
```

Create a bounding box from two corner points.



- **`min`** (`Point`)

  Minimum corner (bottom-left).





- **`max`** (`Point`)

  Maximum corner (top-right).





**Returns:** `None`





### `width`

```python
width() -> float
```

Return the width of the bounding box (extent along the X axis).



**Returns:** `float`





### `height`

```python
height() -> float
```

Return the height of the bounding box (extent along the Y axis).



**Returns:** `float`





### `center`

```python
center() -> Point
```

Return the center point of the bounding box.



**Returns:** `Point`





### `area`

```python
area() -> float
```

Return the area of the bounding box (`width * height`).



**Returns:** `float`





### `contains`

```python
contains(p) -> bool
```

Check whether a point lies inside (or on the boundary of) the bounding box.



- **`p`** (`Point`)

  The point to test.





**Returns:** `bool`





### `merge`

```python
merge(other) -> BBox
```

Return a new bounding box that encloses both this box and `other`.



- **`other`** (`BBox`)

  The other bounding box.





**Returns:** `BBox`

A new bounding box covering the union of both boxes.