summaryrefslogtreecommitdiff
path: root/src/engine/geometry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/geometry.rs')
-rw-r--r--src/engine/geometry.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/engine/geometry.rs b/src/engine/geometry.rs
index a946bf9..23e0433 100644
--- a/src/engine/geometry.rs
+++ b/src/engine/geometry.rs
@@ -25,3 +25,17 @@ impl Point {
}
}
}
+
+use std::cmp::Ord;
+use std::cmp::Ordering;
+
+impl PartialOrd for Point {
+ fn partial_cmp(&self, other: &Point) -> Option<Ordering> {
+ Some(self.cmp(other))
+ }
+}
+impl Ord for Point {
+ fn cmp(&self, other: &Point) -> Ordering {
+ self.x.cmp(&other.x).then(self.y.cmp(&other.y))
+ }
+}