diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-30 14:12:28 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-30 14:12:28 +0200 |
| commit | f9e115daf54c29358f890b137f50a33a781af680 (patch) | |
| tree | 496de52246629ea8039db6beea94eb779ed2851d /src/geom | |
| parent | f7c67cde72e6a67f45180856b332bae9863243bd (diff) | |
New block spacing model
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/relative.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/geom/relative.rs b/src/geom/relative.rs index fc77fb9f..f213ae52 100644 --- a/src/geom/relative.rs +++ b/src/geom/relative.rs @@ -68,6 +68,18 @@ impl<T: Numeric> From<Ratio> for Relative<T> { } } +impl<T: Numeric + PartialOrd> PartialOrd for Relative<T> { + fn partial_cmp(&self, other: &Self) -> Option<Ordering> { + if self.rel.is_zero() && other.rel.is_zero() { + self.abs.partial_cmp(&other.abs) + } else if self.abs.is_zero() && other.abs.is_zero() { + self.rel.partial_cmp(&other.rel) + } else { + None + } + } +} + impl<T: Numeric> Neg for Relative<T> { type Output = Self; |
