LogoLogo
  • Welcome
  • FAQ
  • GPU compatibility
  • Introduction
    • Getting Started
    • Rendering Meshes
    • Rendering Volumetric Data
    • Slice and Crop Volume Renderings
    • Attributes API
    • Node transformations
    • Bounding Boxes
  • Controls & Input Handling
    • Custom Controls
    • Gamepads
  • Advanced Topics
    • Custom Rendering Pipelines
    • Instancing
    • Rendering on Distributed Machines
    • Profiling
    • Volume Shaders and Uniforms
    • Network
Powered by GitBook
On this page
  • What are Bounding Boxes?
  • How are bounding boxes handled in scenery?

Was this helpful?

Export as PDF
  1. Introduction

Bounding Boxes

PreviousNode transformationsNextCustom Controls

Last updated 3 years ago

Was this helpful?

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:

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:

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

Here is a visual explanation of what this looks like:

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:

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:

BoundingBox.getBoundingSphere()