Skip to content

Commit

Permalink
Improve type safety
Browse files Browse the repository at this point in the history
Make sure that a valid triangle is passed into the method.
  • Loading branch information
hannobraun committed Sep 16, 2022
1 parent b8d5f7f commit 9217761
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crates/fj-kernel/src/algorithms/triangulate/polygon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use fj_math::{Point, PolyChain, Segment};
use fj_math::{Point, PolyChain, Segment, Triangle};

use crate::algorithms::intersect::{
ray_segment::RaySegmentIntersection, HorizontalRayToTheRight, Intersect,
Expand Down Expand Up @@ -42,11 +42,8 @@ impl Polygon {
self
}

pub fn contains_triangle(
&self,
triangle: [impl Into<Point<2>>; 3],
) -> bool {
let [a, b, c] = triangle.map(Into::into);
pub fn contains_triangle(&self, triangle: impl Into<Triangle<2>>) -> bool {
let [a, b, c] = triangle.into().points();

let mut might_be_hole = true;

Expand Down

0 comments on commit 9217761

Please sign in to comment.