summaryrefslogtreecommitdiff
path: root/src/geom/length.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-30 16:59:09 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-30 16:59:09 +0200
commitee84bf74083f5b9cc88a2a0a968dc905b1eef22c (patch)
treed2756f462ee242c328c526d2a65de4105830cb27 /src/geom/length.rs
parentff25573224400673d08b31e576d5a0d87751dbe1 (diff)
Add abs() function
Diffstat (limited to 'src/geom/length.rs')
-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 f8484f75..b9eb7b75 100644
--- a/src/geom/length.rs
+++ b/src/geom/length.rs
@@ -92,6 +92,11 @@ impl Length {
self.0.into_inner().is_infinite()
}
+ /// The absolute value of the this length.
+ pub fn abs(self) -> Self {
+ Self::raw(self.to_raw().abs())
+ }
+
/// The minimum of this and another length.
pub fn min(self, other: Self) -> Self {
Self(self.0.min(other.0))