Skip to content

Commit

Permalink
Rename HalfSizes2D/3D to HalfSize2D/3D (#6768)
Browse files Browse the repository at this point in the history
### What
We use the singular for every other component.

* Closes #6620

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6768?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6768?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/6768)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
emilk committed Jul 5, 2024
1 parent 1fa1d6b commit af680b1
Show file tree
Hide file tree
Showing 59 changed files with 253 additions and 240 deletions.
8 changes: 4 additions & 4 deletions crates/re_space_view_spatial/src/visualizers/boxes2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use re_query::range_zip_1x6;
use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId};
use re_types::{
archetypes::Boxes2D,
components::{ClassId, Color, DrawOrder, HalfSizes2D, KeypointId, Position2D, Radius, Text},
components::{ClassId, Color, DrawOrder, HalfSize2D, KeypointId, Position2D, Radius, Text},
};
use re_viewer_context::{
auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext,
Expand Down Expand Up @@ -49,7 +49,7 @@ impl Boxes2DVisualizer {
/// Otherwise, produces one label per center position passed.
fn process_labels<'a>(
entity_path: &'a EntityPath,
half_sizes: &'a [HalfSizes2D],
half_sizes: &'a [HalfSize2D],
centers: impl Iterator<Item = &'a Position2D> + 'a,
labels: &'a [Text],
colors: &'a [egui::Color32],
Expand Down Expand Up @@ -196,7 +196,7 @@ impl Boxes2DVisualizer {

struct Boxes2DComponentData<'a> {
// Point of views
half_sizes: &'a [HalfSizes2D],
half_sizes: &'a [HalfSize2D],

// Clamped to edge
centers: &'a [Position2D],
Expand Down Expand Up @@ -249,7 +249,7 @@ impl VisualizerSystem for Boxes2DVisualizer {

let resolver = ctx.recording().resolver();

let half_sizes = match results.get_required_component_dense::<HalfSizes2D>(resolver)
let half_sizes = match results.get_required_component_dense::<HalfSize2D>(resolver)
{
Some(vectors) => vectors?,
_ => return Ok(()),
Expand Down
6 changes: 3 additions & 3 deletions crates/re_space_view_spatial/src/visualizers/boxes3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use re_query::range_zip_1x7;
use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId};
use re_types::{
archetypes::Boxes3D,
components::{ClassId, Color, HalfSizes3D, KeypointId, Position3D, Radius, Rotation3D, Text},
components::{ClassId, Color, HalfSize3D, KeypointId, Position3D, Radius, Rotation3D, Text},
};
use re_viewer_context::{
auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl Boxes3DVisualizer {

struct Boxes3DComponentData<'a> {
// Point of views
half_sizes: &'a [HalfSizes3D],
half_sizes: &'a [HalfSize3D],

// Clamped to edge
centers: &'a [Position3D],
Expand Down Expand Up @@ -200,7 +200,7 @@ impl VisualizerSystem for Boxes3DVisualizer {

let resolver = ctx.recording().resolver();

let half_sizes = match results.get_required_component_dense::<HalfSizes3D>(resolver)
let half_sizes = match results.get_required_component_dense::<HalfSize3D>(resolver)
{
Some(vectors) => vectors?,
_ => return Ok(()),
Expand Down
4 changes: 2 additions & 2 deletions crates/re_types/.gitattributes

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

2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/archetypes/boxes2d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ table Boxes2D (
// --- Required ---

/// All half-extents that make up the batch of boxes.
half_sizes: [rerun.components.HalfSizes2D] ("attr.rerun.component_required", order: 1000);
half_sizes: [rerun.components.HalfSize2D] ("attr.rerun.component_required", order: 1000);

// --- Recommended ---

Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/archetypes/boxes3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ table Boxes3D (
// --- Required ---

/// All half-extents that make up the batch of boxes.
half_sizes: [rerun.components.HalfSizes3D] ("attr.rerun.component_required", order: 1000);
half_sizes: [rerun.components.HalfSize3D] ("attr.rerun.component_required", order: 1000);

// --- Recommended ---

Expand Down
4 changes: 2 additions & 2 deletions crates/re_types/definitions/rerun/components.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ include "./components/disconnected_space.fbs";
include "./components/draw_order.fbs";
include "./components/fill_ratio.fbs";
include "./components/gamma_correction.fbs";
include "./components/half_sizes2d.fbs";
include "./components/half_sizes3d.fbs";
include "./components/half_size2d.fbs";
include "./components/half_size3d.fbs";
include "./components/image_plane_distance.fbs";
include "./components/keypoint_id.fbs";
include "./components/line_strip2d.fbs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace rerun.components;
///
/// The box extends both in negative and positive direction along each axis.
/// Negative sizes indicate that the box is flipped along the respective axis, but this has no effect on how it is displayed.
struct HalfSizes2D (
struct HalfSize2D (
"attr.docs.unreleased",
"attr.rust.derive": "Copy, PartialEq"
) {
xy: rerun.datatypes.Vec2D (order: 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace rerun.components;
///
/// The box extends both in negative and positive direction along each axis.
/// Negative sizes indicate that the box is flipped along the respective axis, but this has no effect on how it is displayed.
struct HalfSizes3D (
struct HalfSize3D (
"attr.docs.unreleased",
"attr.rust.derive": "Copy, PartialEq"
) {
xyz: rerun.datatypes.Vec3D (order: 100);
Expand Down
14 changes: 7 additions & 7 deletions crates/re_types/src/archetypes/boxes2d.rs

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

8 changes: 4 additions & 4 deletions crates/re_types/src/archetypes/boxes2d_ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
components::{HalfSizes2D, Position2D},
components::{HalfSize2D, Position2D},
datatypes::Vec2D,
};

Expand All @@ -8,15 +8,15 @@ use super::Boxes2D;
impl Boxes2D {
/// Creates new [`Boxes2D`] with [`Self::half_sizes`] centered around the local origin.
#[inline]
pub fn from_half_sizes(half_sizes: impl IntoIterator<Item = impl Into<HalfSizes2D>>) -> Self {
pub fn from_half_sizes(half_sizes: impl IntoIterator<Item = impl Into<HalfSize2D>>) -> Self {
Self::new(half_sizes)
}

/// Creates new [`Boxes2D`] with [`Self::centers`] and [`Self::half_sizes`].
#[inline]
pub fn from_centers_and_half_sizes(
centers: impl IntoIterator<Item = impl Into<Position2D>>,
half_sizes: impl IntoIterator<Item = impl Into<HalfSizes2D>>,
half_sizes: impl IntoIterator<Item = impl Into<HalfSize2D>>,
) -> Self {
Self::new(half_sizes).with_centers(centers)
}
Expand All @@ -28,7 +28,7 @@ impl Boxes2D {
pub fn from_sizes(sizes: impl IntoIterator<Item = impl Into<Vec2D>>) -> Self {
Self::new(sizes.into_iter().map(|wh| {
let wh = wh.into();
HalfSizes2D::new(wh.x() / 2.0, wh.y() / 2.0)
HalfSize2D::new(wh.x() / 2.0, wh.y() / 2.0)
}))
}

Expand Down
14 changes: 7 additions & 7 deletions crates/re_types/src/archetypes/boxes3d.rs

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

8 changes: 4 additions & 4 deletions crates/re_types/src/archetypes/boxes3d_ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
components::{HalfSizes3D, Position3D},
components::{HalfSize3D, Position3D},
datatypes::Vec3D,
};

Expand All @@ -8,15 +8,15 @@ use super::Boxes3D;
impl Boxes3D {
/// Creates new [`Boxes3D`] with [`Self::half_sizes`] centered around the local origin.
#[inline]
pub fn from_half_sizes(half_sizes: impl IntoIterator<Item = impl Into<HalfSizes3D>>) -> Self {
pub fn from_half_sizes(half_sizes: impl IntoIterator<Item = impl Into<HalfSize3D>>) -> Self {
Self::new(half_sizes)
}

/// Creates new [`Boxes3D`] with [`Self::centers`] and [`Self::half_sizes`].
#[inline]
pub fn from_centers_and_half_sizes(
centers: impl IntoIterator<Item = impl Into<Position3D>>,
half_sizes: impl IntoIterator<Item = impl Into<HalfSizes3D>>,
half_sizes: impl IntoIterator<Item = impl Into<HalfSize3D>>,
) -> Self {
Self::new(half_sizes).with_centers(centers)
}
Expand All @@ -28,7 +28,7 @@ impl Boxes3D {
pub fn from_sizes(sizes: impl IntoIterator<Item = impl Into<Vec3D>>) -> Self {
Self::new(sizes.into_iter().map(|size| {
let wh = size.into();
HalfSizes3D::new(wh.x() / 2.0, wh.y() / 2.0, wh.z() / 2.0)
HalfSize3D::new(wh.x() / 2.0, wh.y() / 2.0, wh.z() / 2.0)
}))
}

Expand Down
4 changes: 2 additions & 2 deletions crates/re_types/src/components/.gitattributes

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

Loading

0 comments on commit af680b1

Please sign in to comment.