Skip to content

Commit

Permalink
IntersectionCompositeShapeShapeVisitor is now able to return partId (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz authored Dec 6, 2024
1 parent 37663ce commit aaeb17f
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ where
let mut visitor = IntersectionCompositeShapeShapeVisitor::new(dispatcher, pos12, g1, g2);

let _ = g1.typed_qbvh().traverse_depth_first(&mut visitor);
visitor.found_intersection
visitor.found_intersection.is_some()
}

/// Proximity between a shape and a composite (`Mesh`, `Compound`) shape.
Expand All @@ -38,15 +38,21 @@ where
}

/// A visitor for checking if a composite-shape and a shape intersect.
pub struct IntersectionCompositeShapeShapeVisitor<'a, D: ?Sized, G1: ?Sized + 'a> {
pub struct IntersectionCompositeShapeShapeVisitor<'a, D: ?Sized, G1: 'a>
where
G1: ?Sized + TypedSimdCompositeShape,
{
ls_aabb2: SimdAabb,

dispatcher: &'a D,
pos12: &'a Isometry<Real>,
g1: &'a G1,
g2: &'a dyn Shape,

found_intersection: bool,
/// Populated after the traversal.
///
/// Is [`None`] if no intersection was found.
pub found_intersection: Option<G1::PartId>,
}

impl<'a, D, G1> IntersectionCompositeShapeShapeVisitor<'a, D, G1>
Expand All @@ -69,7 +75,7 @@ where
pos12,
g1,
g2,
found_intersection: false,
found_intersection: None,
}
}
}
Expand Down Expand Up @@ -103,7 +109,7 @@ where
});

if found_intersection {
self.found_intersection = true;
self.found_intersection = Some(part_id);
return SimdVisitStatus::ExitEarly;
}
}
Expand Down

0 comments on commit aaeb17f

Please sign in to comment.