Skip to content

Commit

Permalink
Add Capsules3D archetype.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Oct 2, 2024
1 parent 866ed4b commit 55f8e36
Show file tree
Hide file tree
Showing 50 changed files with 1,858 additions and 23 deletions.
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5538,6 +5538,7 @@ dependencies = [
"mimalloc",
"nohash-hasher",
"once_cell",
"ordered-float",
"re_chunk_store",
"re_data_ui",
"re_entity_db",
Expand Down
1 change: 1 addition & 0 deletions crates/store/re_types/definitions/rerun/archetypes.fbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions crates/store/re_types/definitions/rerun/archetypes/capsules3d.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
namespace rerun.archetypes;

// ---

/// 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.
//
// TODO: Needs an example image.
// TODO(#1361): This archetype should eventually generalize to cylinders without caps, truncated
// cones, and tapered capsules -- all common shapes based on expanding a line segment circularly.
table Capsules3D (
"attr.rust.derive": "PartialEq",
"attr.rust.new_pub_crate",
"attr.cpp.no_field_ctors",
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection",
"attr.docs.unreleased"
) {
// --- Required ---

/// The shape of the capsule defined as the length of the line between its endpoints.
lengths: [rerun.components.Length] ("attr.rerun.component_required", order: 1000);

/// Radius of the capsules.
//
// TODO(#1361): This should eventually become two radii, to generate truncated cones and tapered capsules.
radii: [rerun.components.Radius] ("attr.rerun.component_required", order: 1100);

// --- Recommended ---

/// Optional translations of the capsules.
///
/// If not specified, one end of each capsule will be at (0, 0, 0).
/// Note that this uses a [components.PoseTranslation3D] which is also used by [archetypes.InstancePoses3D].
translations: [rerun.components.PoseTranslation3D] ("attr.rerun.component_recommended", nullable, order: 2000);

/// Rotations via axis + angle.
///
/// If no rotation is specified, the capsules align with the +Z axis of the local coordinate system.
/// Note that this uses a [components.PoseRotationAxisAngle] which is also used by [archetypes.InstancePoses3D].
rotation_axis_angles: [rerun.components.PoseRotationAxisAngle] ("attr.rerun.component_optional", nullable, order: 2100);

/// Rotations via quaternion.
///
/// If no rotation is specified, the capsules align with the +Z axis of the local coordinate system.
/// Note that this uses a [components.PoseRotationQuat] which is also used by [archetypes.InstancePoses3D].
quaternions: [rerun.components.PoseRotationQuat] ("attr.rerun.component_optional", nullable, order: 2200);

/// Optional colors for the capsules.
colors: [rerun.components.Color] ("attr.rerun.component_recommended", nullable, order: 2300);

// --- Optional ---

// TODO(#1361): Add fill_mode component, or whatever succeeds it in case a wireframe
// or other alternate rendering is wanted.

/// Optional text labels for the capsules, which will be located at their centers.
labels: [rerun.components.Text] ("attr.rerun.component_optional", nullable, order: 3100);

/// Optional choice of whether the text labels should be shown by default.
show_labels: rerun.components.ShowLabels ("attr.rerun.component_optional", nullable, order: 3200);

/// Optional class ID for the ellipsoids.
///
/// The class ID provides colors and labels if not specified explicitly.
class_ids: [rerun.components.ClassId] ("attr.rerun.component_optional", nullable, order: 3300);
}
1 change: 1 addition & 0 deletions crates/store/re_types/definitions/rerun/components.fbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions crates/store/re_types/definitions/rerun/components/length.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace rerun.components;

// ---

/// Length, or one-dimensional size.
///
/// Measured in its local coordinate system; consult the archetype in use to determine which
/// axis or part of the entity this is the length of.
struct Length (
"attr.python.aliases": "float",
"attr.python.array_aliases": "float, npt.NDArray[np.float32]",
"attr.rust.derive": "Copy, PartialEq, PartialOrd, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
length: rerun.datatypes.Float32 (order: 100);
}
1 change: 1 addition & 0 deletions crates/store/re_types/src/archetypes/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 55f8e36

Please sign in to comment.