-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix incorrect non-solid point projection called by project_local_poin…
…t_and_get_location (#195) * Fix d_abc and d_bc computation in project_local_point_and_get_location * Fix #194
- Loading branch information
Showing
4 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ extern crate nalgebra as na; | |
extern crate parry2d; | ||
|
||
mod geometry; | ||
mod query; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod point_triangle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use parry2d::{math::Point, query::PointQuery, shape::Triangle}; | ||
|
||
#[test] | ||
fn project_local_point_point_on_ab() { | ||
let verts = [ | ||
Point::new(2.0, 1.0), | ||
Point::new(0.0, 1.0), | ||
Point::new(1.0, 0.0), | ||
]; | ||
let tri1 = Triangle::new(verts[0], verts[1], verts[2]); | ||
let tri2 = Triangle::new(verts[2], verts[0], verts[1]); | ||
|
||
let query_pt = Point::new(1.4, 1.0); | ||
|
||
let proj1 = tri1.project_local_point(&query_pt, false); // Used to fail on 0.14 and earlier | ||
let proj2 = tri2.project_local_point(&query_pt, false); | ||
|
||
assert_eq!(proj1.point, proj2.point); | ||
assert_eq!(proj1.point, query_pt); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters