Boxes3D

3D boxes with half-extents and optional center, rotations, rotations, colors etc.

Components components

Required: HalfSizes3D

Recommended: Position3D, Rotation3D, Color

Optional: Radius, Text, ClassId

Shown in shown-in

Examples examples

Simple 3D boxes simple-3d-boxes

"""Log a single 3D Box."""

import rerun as rr

rr.init("rerun_example_box3d", spawn=True)

rr.log("simple", rr.Boxes3D(half_sizes=[2.0, 2.0, 1.0]))

Batch of 3D boxes batch-of-3d-boxes

"""Log a batch of oriented bounding boxes."""

import rerun as rr
from rerun.datatypes import Angle, Quaternion, Rotation3D, RotationAxisAngle

rr.init("rerun_example_box3d_batch", spawn=True)

rr.log(
    "batch",
    rr.Boxes3D(
        centers=[[2, 0, 0], [-2, 0, 0], [0, 0, 2]],
        half_sizes=[[2.0, 2.0, 1.0], [1.0, 1.0, 0.5], [2.0, 0.5, 1.0]],
        rotations=[
            Rotation3D.identity(),
            Quaternion(xyzw=[0.0, 0.0, 0.382683, 0.923880]),  # 45 degrees around Z
            RotationAxisAngle(axis=[0, 1, 0], angle=Angle(deg=30)),
        ],
        radii=0.025,
        colors=[(255, 0, 0), (0, 255, 0), (0, 0, 255)],
        labels=["red", "green", "blue"],
    ),
)