From cf3c8378557457363853d6795e4ddf9e70a4738e Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Thu, 26 Nov 2020 20:50:30 +0100 Subject: Make polygons deletable Before, the deletion tool was not targeting polygons. I also took the liberty to broaden the functionality of the surface trait, which now can check if a rectangle or polygon is contained. --- src/math/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/math/mod.rs') diff --git a/src/math/mod.rs b/src/math/mod.rs index 6f83c98..b84d270 100644 --- a/src/math/mod.rs +++ b/src/math/mod.rs @@ -20,6 +20,12 @@ pub trait Surface { /// Checks if a line segment is entirely contained by this surface. fn contains_line_segment(&self, line_segment: &LineSegment) -> bool; + + /// Checks if a rectangle is entirely contained inside this surface. + fn contains_rect(&self, rect: &Rect) -> bool; + + /// Checks if a polygon is contained wholly by this surface. + fn contains_polygon(&self, polygon: &Polygon) -> bool; } /// Round a floating point number to the nearest step given by the step argument. For instance, if -- cgit v1.2.3-70-g09d2