From 5656059795badfdcfe675009117d4deba31c1966 Mon Sep 17 00:00:00 2001 From: William Linna Date: Fri, 3 May 2024 12:40:38 +0300 Subject: [PATCH 1/2] Fix comments in point_composite_shape test --- crates/parry2d/tests/query/point_composite_shape.rs | 4 ++-- 1 file changed, 2 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); From 9c6bff9a3bad087cf7f7a0e5c85a48e516a0f1ff Mon Sep 17 00:00:00 2001 From: William Linna Date: Fri, 3 May 2024 12:57:24 +0300 Subject: [PATCH 2/2] Add a link to educational material --- src/query/point/point_triangle.rs | 3 +++ 1 file changed, 3 insertions(+) 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;