Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce roundtrip-able Points3D archetype (py + rs) #2774

Merged
merged 11 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/re_types/definitions/rerun/archetypes.fbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include "./archetypes/points2d.fbs";
include "./archetypes/points3d.fbs";
include "./archetypes/transform3d.fbs";

include "./testing/archetypes/fuzzy.fbs";
Expand Down
72 changes: 72 additions & 0 deletions crates/re_types/definitions/rerun/archetypes/points3d.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
include "fbs/attributes.fbs";

include "rerun/datatypes.fbs";
include "rerun/components.fbs";

namespace rerun.archetypes;

// ---

/// A 3D point cloud with positions and optional colors, radii, labels, etc.
///
/// \py Example
/// \py -------
/// \py
/// \py ```python
/// \py \include:../../../../../docs/code-examples/point3d_simple_v2.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/point3d_simple_v2.rs
/// \rs ```
table Points3D (
"attr.rust.derive": "PartialEq",
order: 100
) {
// --- Required ---

/// All the actual 3D points that make up the point cloud.
points: [rerun.components.Point3D] ("attr.rerun.component_required", order: 1000);

// --- Recommended ---

/// Optional radii for the points, effectively turning them into circles.
radii: [rerun.components.Radius] ("attr.rerun.component_recommended", nullable, order: 2000);

/// Optional colors for the points.
///
/// \python The colors are interpreted as RGB or RGBA in sRGB gamma-space,
/// \python As either 0-1 floats or 0-255 integers, with separate alpha.
colors: [rerun.components.Color] ("attr.rerun.component_recommended", nullable, order: 2100);

// --- Optional ---

/// Optional text labels for the points.
labels: [rerun.components.Label] ("attr.rerun.component_optional", nullable, order: 3000);

/// An optional floating point value that specifies the 3D drawing order.
/// Objects with higher values are drawn on top of those with lower values.
///
/// The default for 3D points is 30.0.
draw_order: rerun.components.DrawOrder ("attr.rerun.component_optional", nullable, order: 3100);

/// Optional class Ids for the points.
///
/// The class ID provides colors and labels if not specified explicitly.
class_ids: [rerun.components.ClassId] ("attr.rerun.component_optional", nullable, order: 3200);

/// Optional keypoint IDs for the points, identifying them within a class.
///
/// If keypoint IDs are passed in but no class IDs were specified, the class ID will
/// default to 0.
/// This is useful to identify points within a single classification (which is identified
/// with `class_id`).
/// E.g. the classification might be 'Person' and the keypoints refer to joints on a
/// detected skeleton.
keypoint_ids: [rerun.components.KeypointId] ("attr.rerun.component_optional", nullable, order: 3300);

/// Unique identifiers for each individual point in the batch.
instance_keys: [rerun.components.InstanceKey] ("attr.rerun.component_optional", nullable, order: 3400);
}
1 change: 1 addition & 0 deletions crates/re_types/definitions/rerun/components.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ include "./components/instance_key.fbs";
include "./components/keypoint_id.fbs";
include "./components/label.fbs";
include "./components/point2d.fbs";
include "./components/point3d.fbs";
include "./components/radius.fbs";
include "./components/transform3d.fbs";
21 changes: 21 additions & 0 deletions crates/re_types/definitions/rerun/components/point3d.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include "arrow/attributes.fbs";
include "python/attributes.fbs";
include "rust/attributes.fbs";

include "rerun/datatypes.fbs";
include "rerun/attributes.fbs";

namespace rerun.components;

// ---

/// A point in 3D space.
struct Point3D (
"attr.python.aliases": "npt.NDArray[np.float32], Sequence[float], Tuple[float, float, float]",
"attr.python.array_aliases": "npt.NDArray[np.float32], Sequence[float]",
"attr.rerun.legacy_fqname": "rerun.point3d",
"attr.rust.derive": "Default, Copy, PartialEq, PartialOrd",
order: 100
) {
xy: rerun.datatypes.Point3D (order: 100);
}
1 change: 1 addition & 0 deletions crates/re_types/definitions/rerun/datatypes.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include "./datatypes/angle.fbs";
include "./datatypes/mat3x3.fbs";
include "./datatypes/mat4x4.fbs";
include "./datatypes/point2d.fbs";
include "./datatypes/point3d.fbs";
include "./datatypes/quaternion.fbs";
include "./datatypes/rotation3d.fbs";
include "./datatypes/rotation_axis_angle.fbs";
Expand Down
20 changes: 20 additions & 0 deletions crates/re_types/definitions/rerun/datatypes/point3d.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include "arrow/attributes.fbs";
include "python/attributes.fbs";
include "fbs/attributes.fbs";
include "rust/attributes.fbs";

namespace rerun.datatypes;

// ---

/// A point in 3D space.
struct Point3D (
"attr.python.aliases": "Sequence[float]",
"attr.python.array_aliases": "npt.NDArray[Any], Sequence[npt.NDArray[Any]], Sequence[Tuple[float, float]], Sequence[float]",
"attr.rust.derive": "Default, Copy, PartialEq, PartialOrd",
order: 100
) {
x: float (order: 100);
y: float (order: 200);
z: float (order: 300);
}
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a sha256 hash for all direct and indirect dependencies of this crate's build script.
# It can be safely removed at anytime to force the build script to run again.
# Check out build.rs to see how it's computed.
94f7feacba1a7d75fee69d10294c77e2f4539106e4906f3d58a5db776e11c4be
173356986894caad5a2b01f9b985726839309968b8466a9f1e19401efe546b87
2 changes: 2 additions & 0 deletions crates/re_types/src/archetypes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

mod fuzzy;
mod points2d;
mod points3d;
mod transform3d;

pub use self::fuzzy::AffixFuzzer1;
pub use self::points2d::Points2D;
pub use self::points3d::Points3D;
pub use self::transform3d::Transform3D;
Loading
Loading