diff options
| author | Arne Dußin | 2020-12-27 21:54:31 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-12-27 21:54:31 +0100 |
| commit | 53d376eaeef991850d35318b147f75c8f103319d (patch) | |
| tree | 7e95a1666818dc7a804b145f263bdb4b76fef83a /src/math/rect.rs | |
| parent | 2d2f45df9d47db25ac5a91c8f926a025c3a5dc7a (diff) | |
| download | graf_karto-53d376eaeef991850d35318b147f75c8f103319d.tar.gz graf_karto-53d376eaeef991850d35318b147f75c8f103319d.zip | |
Change to polygongraph instead of polygon in roomtool
The polygon room tool used a convoluted process for determining what the
user actually wants to draw. I have changed to the polygon graph
instead, which makes the checks easier and restricts the user a bit
less. In the process however I found a serious problem with my handling
float, so everything needed to change to margin compares (which I of
course should have done in the beginning. Guys, take the warning
seriously and don't ignore it for ten years like I did. It will come
back to haunt you.. apparently) instead of direct equality.
Diffstat (limited to 'src/math/rect.rs')
| -rw-r--r-- | src/math/rect.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/math/rect.rs b/src/math/rect.rs index 6f993d1..b019ad5 100644 --- a/src/math/rect.rs +++ b/src/math/rect.rs @@ -1,9 +1,8 @@ //! Rectangles where the sides are parallel to the x and y-axes. -use super::{LineSegment, Polygon, Surface, Vec2}; +use super::{ExactSurface, LineSegment, Polygon, Vec2}; //use alga::general::{Additive, Identity}; -use nalgebra::{ClosedAdd, ClosedSub, RealField, Scalar}; -use num_traits::identities::Zero; +use nalgebra::{RealField, Scalar}; use num_traits::{NumCast, ToPrimitive}; use serde::{Deserialize, Serialize}; use std::ops::{Add, AddAssign}; @@ -150,7 +149,7 @@ impl<T: Scalar + Copy> Rect<T> { } } -impl<T: Scalar + Copy + PartialOrd + ClosedAdd + ClosedSub + Zero> Surface<T> for Rect<T> { +impl<T: RealField> ExactSurface<T> for Rect<T> { fn contains_point(&self, point: &Vec2<T>) -> bool { point.x >= self.x && point.x <= self.x + self.w |
