Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Apr 25, 2024
1 parent 734c6cb commit b69decd
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 32 deletions.
3 changes: 1 addition & 2 deletions crates/re_space_view_spatial/src/visualizers/arrows2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ impl VisualizerSystem for Arrows2DVisualizer {
let resolver = ctx.recording().resolver();

let vectors = match results.get_dense::<Vector2D>(resolver) {
Some(Ok(vectors)) => vectors,
Some(err @ Err(_)) => err?,
Some(vectors) => vectors?,
_ => return Ok(()),
};

Expand Down
3 changes: 1 addition & 2 deletions crates/re_space_view_spatial/src/visualizers/arrows3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ impl VisualizerSystem for Arrows3DVisualizer {
let resolver = ctx.recording().resolver();

let vectors = match results.get_dense::<Vector3D>(resolver) {
Some(Ok(vectors)) => vectors,
Some(err @ Err(_)) => err?,
Some(vectors) => vectors?,
_ => return Ok(()),
};

Expand Down
3 changes: 1 addition & 2 deletions crates/re_space_view_spatial/src/visualizers/boxes2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ impl VisualizerSystem for Boxes2DVisualizer {
let resolver = ctx.recording().resolver();

let half_sizes = match results.get_dense::<HalfSizes2D>(resolver) {
Some(Ok(vectors)) => vectors,
Some(err @ Err(_)) => err?,
Some(vectors) => vectors?,
_ => return Ok(()),
};

Expand Down
3 changes: 1 addition & 2 deletions crates/re_space_view_spatial/src/visualizers/boxes3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ impl VisualizerSystem for Boxes3DVisualizer {
let resolver = ctx.recording().resolver();

let half_sizes = match results.get_dense::<HalfSizes3D>(resolver) {
Some(Ok(vectors)) => vectors,
Some(err @ Err(_)) => err?,
Some(vectors) => vectors?,
_ => return Ok(()),
};

Expand Down
3 changes: 1 addition & 2 deletions crates/re_space_view_spatial/src/visualizers/lines2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ impl VisualizerSystem for Lines2DVisualizer {
let resolver = ctx.recording().resolver();

let strips = match results.get_dense::<LineStrip2D>(resolver) {
Some(Ok(strips)) => strips,
Some(err @ Err(_)) => err?,
Some(strips) => strips?,
_ => return Ok(()),
};

Expand Down
3 changes: 1 addition & 2 deletions crates/re_space_view_spatial/src/visualizers/lines3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ impl VisualizerSystem for Lines3DVisualizer {
let resolver = ctx.recording().resolver();

let strips = match results.get_dense::<LineStrip3D>(resolver) {
Some(Ok(strips)) => strips,
Some(err @ Err(_)) => err?,
Some(strips) => strips?,
_ => return Ok(()),
};

Expand Down
20 changes: 4 additions & 16 deletions crates/re_space_view_spatial/src/visualizers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ pub fn process_color_slice<'a>(
}
}
} else {
let colors = colors
.iter()
.chain(std::iter::repeat(colors.last().unwrap()))
.take(num_instances);
let colors = entity_iterator::clamped(colors, num_instances);
match annotation_infos {
ResolvedAnnotationInfos::Same(_count, annotation_info) => {
re_tracing::profile_scope!("many-colors, same annotation");
Expand Down Expand Up @@ -166,11 +163,8 @@ pub fn process_radius_slice(
if radii.is_empty() {
vec![re_renderer::Size::AUTO; num_instances]
} else {
radii
.iter()
.chain(std::iter::repeat(radii.last().unwrap()))
entity_iterator::clamped(radii, num_instances)
.map(|radius| process_radius(entity_path, *radius))
.take(num_instances)
.collect()
}
}
Expand Down Expand Up @@ -218,10 +212,7 @@ fn process_annotation_and_keypoint_slices(
);
};

let class_ids = class_ids
.iter()
.chain(std::iter::repeat(class_ids.last().unwrap()))
.take(num_instances);
let class_ids = entity_iterator::clamped(class_ids, num_instances);

if keypoint_ids.is_empty() {
let annotation_info = class_ids
Expand All @@ -236,10 +227,7 @@ fn process_annotation_and_keypoint_slices(
Default::default(),
)
} else {
let keypoint_ids = keypoint_ids
.iter()
.chain(std::iter::repeat(keypoint_ids.last().unwrap()))
.take(num_instances);
let keypoint_ids = entity_iterator::clamped(keypoint_ids, num_instances);
let annotation_info = itertools::izip!(positions, keypoint_ids, class_ids)
.map(|(position, keypoint_id, &class_id)| {
let class_description = annotations.resolved_class_description(Some(class_id));
Expand Down
3 changes: 1 addition & 2 deletions crates/re_space_view_spatial/src/visualizers/points2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ impl VisualizerSystem for Points2DVisualizer {
let resolver = ctx.recording().resolver();

let positions = match results.get_dense::<Position2D>(resolver) {
Some(Ok(positions)) => positions,
Some(err @ Err(_)) => err?,
Some(positions) => positions?,
_ => return Ok(()),
};

Expand Down
3 changes: 1 addition & 2 deletions crates/re_space_view_spatial/src/visualizers/points3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ impl VisualizerSystem for Points3DVisualizer {
let resolver = ctx.recording().resolver();

let positions = match results.get_dense::<Position3D>(resolver) {
Some(Ok(positions)) => positions,
Some(err @ Err(_)) => err?,
Some(positions) => positions?,
_ => return Ok(()),
};

Expand Down

0 comments on commit b69decd

Please sign in to comment.