Skip to content

Commit 23111c4

Browse files
committed
fast track for source's root == target
1 parent 4143100 commit 23111c4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

crates/store/re_tf/src/transform_forest.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,13 @@ impl TransformForest {
412412

413413
// Common case: both source & target share the same root.
414414
let result = if source.root == target.root {
415-
// TODO: fast track for root being target.
416-
// target_from_source = target_from_reference * root_from_source
417-
let target_from_source = root_from_source.left_multiply(target.target_from_root);
418-
Ok(target_from_source)
415+
if source.root == target.id {
416+
// Fast track for source's root being the target.
417+
Ok(source.root_from_source.clone())
418+
} else {
419+
// target_from_source = target_from_reference * root_from_source
420+
Ok(root_from_source.left_multiply(target.target_from_root))
421+
}
419422
}
420423
// There might be a connection via a pinhole making this 3D in 2D.
421424
else if let Some(TransformTreeRootInfo::Pinhole(pinhole_tree_root)) = target_root_info

0 commit comments

Comments
 (0)