# Bounding Boxes

## What are Bounding Boxes?

You want to check off the box on bounding boxes, so let's cut the bad puns and dive right into it. To understand bounding boxes, consider this stock photo of the sherlock holmes among penguins and its bounding box:

![](/files/-McpLls9LvfnvTMdKq8j)

In short, a bounding box is the smallest box that contains every feature of an object. This makes them a powerful tool to realize intersections.

## How are bounding boxes handled in scenery?

\
There are many ways to define such a bounding box mathematically, in *scenery*, we do it via a min vector and a max vector:

```kotlin
open class OrientedBoundingBox(val n: Node, val min: Vector3f, val max: Vector3f)
```

Here is a visual explanation of what this looks like:

![](/files/-McpVkE_TZIXPN-HIeTt)

Note that both of these vectors are local coordinates so that the bounding box remains flexible when translating or rescaling a node.

Accessing the bounding box of a node is rather easy:

```kotlin
val someNode = ThisIsSomeNodeClass()
val boundingBox = node.getMaximumBoundingBox()
```

In case you are dealing with a more sphere-like object, e.g. a biological cell, you should consider using a bounding sphere instead. Simply use the function:

```kotlin
BoundingBox.getBoundingSphere()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scenery.graphics/scenery/introduction/bounding-boxes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
