summaryrefslogtreecommitdiff
path: root/src/geom
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-06-27 12:28:40 +0200
committerMartin Haug <mhaug@live.de>2021-06-27 12:31:27 +0200
commit6b6cdae7ce95681d6a1194be70b375494166a8c6 (patch)
tree2fe370798919ee0d1d411c6cacc5518a76094ecd /src/geom
parentf64c772b6d969fa3aa1a7391a3d8118b21430434 (diff)
Testing for incremental
Also, constraint bugfixes.
Diffstat (limited to 'src/geom')
-rw-r--r--src/geom/length.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/geom/length.rs b/src/geom/length.rs
index ecfe5616..08bf3111 100644
--- a/src/geom/length.rs
+++ b/src/geom/length.rs
@@ -108,6 +108,11 @@ impl Length {
self.raw + 1e-6 >= other.raw
}
+ /// Compares to lengths for whether they are approximately equal.
+ pub fn approx_eq(self, other: Self) -> bool {
+ self == other || (self - other).to_raw().abs() < 1e-6
+ }
+
/// Whether the length is zero.
pub fn is_zero(self) -> bool {
self.raw == 0.0