3D capsules; cylinders with hemispherical caps.
Capsules are defined by two endpoints (the centers of their end cap spheres), which are located at (0, 0, 0) and (0, 0, length), that is, extending along the positive direction of the Z axis. Capsules in other orientations may be produced by applying a rotation to the entity or instances.
If there's more instance poses than lengths & radii, the last capsule's orientation will be repeated for the remaining poses.
Orienting and placing capsules forms a separate transform that is applied prior to archetypes.InstancePoses3D and archetypes.Transform3D.
Fields
Required
Recommended
translations:Translation3Dcolors:Color
Optional
rotation_axis_angles:RotationAxisAnglequaternions:RotationQuatline_radii:Radiusfill_mode:FillModelabels:Textshow_labels:ShowLabelsclass_ids:ClassId
Can be shown in
- Spatial3DView
- Spatial2DView (if logged above active projection)
- DataframeView
API reference links
- π C++ API docs for
Capsules3D - π Python API docs for
Capsules3D - π¦ Rust API docs for
Capsules3D
Example
Batch of capsules
"""Log a batch of capsules."""
import rerun as rr
rr.init("rerun_example_capsule3d_batch", spawn=True)
rr.log(
"capsules",
rr.Capsules3D(
lengths=[0.0, 2.0, 4.0, 6.0, 8.0],
radii=[1.0, 0.5, 0.5, 0.5, 1.0],
colors=[
(255, 0, 0),
(188, 188, 0),
(0, 255, 0),
(0, 188, 188),
(0, 0, 255),
],
translations=[
(0.0, 0.0, 0.0),
(2.0, 0.0, 0.0),
(4.0, 0.0, 0.0),
(6.0, 0.0, 0.0),
(8.0, 0.0, 0.0),
],
rotation_axis_angles=[
rr.RotationAxisAngle(
[1.0, 0.0, 0.0],
rr.Angle(deg=float(i) * -22.5),
)
for i in range(5)
],
),
)
