Skip to content

Commit

Permalink
Added test and increased epsilon again
Browse files Browse the repository at this point in the history
  • Loading branch information
MJohnson459 committed Jan 17, 2024
1 parent 328d654 commit bc0c2c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use tracing::instrument;

use crate::instance::EdgeSide;

const EPSILON: f32 = 1e-6;
const EPSILON: f32 = 1e-4;

pub(crate) trait Vec2Helper {
fn side(self, edge: (Vec2, Vec2)) -> EdgeSide;
Expand Down Expand Up @@ -224,6 +224,16 @@ mod tests {
),
EdgeSide::Edge
);

// Test epsilon value is large enough
assert_eq!(
Vec2Helper::side(
Vec2::new(5.585231282, 5.3880110045),
(Vec2::new(9.56, 7.42), Vec2::new(1.54, 3.32))
),
EdgeSide::Edge
);
// Test epsilon value is small enough
assert_ne!(
Vec2Helper::side(
Vec2::new(1.8266357, 1.2239377),
Expand Down

0 comments on commit bc0c2c7

Please sign in to comment.