diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-30 16:59:09 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-30 16:59:09 +0200 |
| commit | ee84bf74083f5b9cc88a2a0a968dc905b1eef22c (patch) | |
| tree | d2756f462ee242c328c526d2a65de4105830cb27 /src/geom/relative.rs | |
| parent | ff25573224400673d08b31e576d5a0d87751dbe1 (diff) | |
Add abs() function
Diffstat (limited to 'src/geom/relative.rs')
| -rw-r--r-- | src/geom/relative.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/geom/relative.rs b/src/geom/relative.rs index 056af206..9122af84 100644 --- a/src/geom/relative.rs +++ b/src/geom/relative.rs @@ -42,6 +42,11 @@ impl Relative { pub fn is_zero(self) -> bool { self.0 == 0.0 } + + /// The absolute value of the this relative. + pub fn abs(self) -> Self { + Self::new(self.get().abs()) + } } impl Debug for Relative { |
