diff --git a/crates/parry2d/tests/query/point_composite_shape.rs b/crates/parry2d/tests/query/point_composite_shape.rs index a289a50..0f50f14 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 0989519..576a13d 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;