From 5f9bfb0e7e9ba799ddd9bef552babcb7b260addb Mon Sep 17 00:00:00 2001 From: William Linna Date: Fri, 17 May 2024 22:42:53 +0300 Subject: [PATCH] Link to educational material and fixes on comments (#198) * Fix comments in point_composite_shape test * Add a link to educational material --- crates/parry2d/tests/query/point_composite_shape.rs | 4 ++-- src/query/point/point_triangle.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/parry2d/tests/query/point_composite_shape.rs b/crates/parry2d/tests/query/point_composite_shape.rs index a289a50b..0f50f140 100644 --- a/crates/parry2d/tests/query/point_composite_shape.rs +++ b/crates/parry2d/tests/query/point_composite_shape.rs @@ -37,7 +37,7 @@ fn project_local_point_and_get_feature_projects_correctly_from_outside() { let mesh = TriMesh::new(vertices, vec![[0, 1, 2], [3, 0, 2]]); { - let query_pt = Point2::new(-1.0, 0.0); // Inside the top-right triangle (index 1) + let query_pt = Point2::new(-1.0, 0.0); // Left from the bottom-left triangle (index 0) let (proj, feat) = mesh.project_local_point_and_get_feature(&query_pt); @@ -52,7 +52,7 @@ fn project_local_point_and_get_feature_projects_correctly_from_outside() { assert_eq!(feat.unwrap_face(), correct_tri_idx); } { - let query_pt = Point2::new(0.5, 2.0); // Inside the top-right triangle (index 1) + let query_pt = Point2::new(0.5, 2.0); // Above the top-right triangle (index 1) let (proj, feat) = mesh.project_local_point_and_get_feature(&query_pt); diff --git a/src/query/point/point_triangle.rs b/src/query/point/point_triangle.rs index 09895198..576a13db 100644 --- a/src/query/point/point_triangle.rs +++ b/src/query/point/point_triangle.rs @@ -60,6 +60,9 @@ impl PointQueryWithLocation for Triangle { pt: &Point, solid: bool, ) -> (PointProjection, Self::Location) { + // To understand the ideas, consider reading the slides below + // https://box2d.org/files/ErinCatto_GJK_GDC2010.pdf + let a = self.a; let b = self.b; let c = self.c;