aboutsummaryrefslogtreecommitdiff
path: root/src/math/mod.rs
diff options
context:
space:
mode:
authorArne Dußin2020-11-26 20:50:30 +0100
committerArne Dußin2020-11-26 20:50:30 +0100
commitcf3c8378557457363853d6795e4ddf9e70a4738e (patch)
treecba843ac32c6e15d565528592c857ee05d0805c6 /src/math/mod.rs
parent9d469c353eb179a35fad6d42fa3f6fc985b49188 (diff)
downloadgraf_karto-cf3c8378557457363853d6795e4ddf9e70a4738e.tar.gz
graf_karto-cf3c8378557457363853d6795e4ddf9e70a4738e.zip
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.
Diffstat (limited to 'src/math/mod.rs')
-rw-r--r--src/math/mod.rs6
1 files changed, 6 insertions, 0 deletions
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<T: Scalar + Copy> {
/// Checks if a line segment is entirely contained by this surface.
fn contains_line_segment(&self, line_segment: &LineSegment<T>) -> bool;
+
+ /// Checks if a rectangle is entirely contained inside this surface.
+ fn contains_rect(&self, rect: &Rect<T>) -> bool;
+
+ /// Checks if a polygon is contained wholly by this surface.
+ fn contains_polygon(&self, polygon: &Polygon<T>) -> bool;
}
/// Round a floating point number to the nearest step given by the step argument. For instance, if