summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/geom/point.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/geom/point.rs b/src/geom/point.rs
index b31ea296..e7811e1e 100644
--- a/src/geom/point.rs
+++ b/src/geom/point.rs
@@ -45,6 +45,11 @@ impl Point {
Self { x: self.x.max(other.x), y: self.y.max(other.y) }
}
+ /// The distance between this point and the origin.
+ pub fn hypot(self) -> Abs {
+ Abs::raw(self.x.to_raw().hypot(self.y.to_raw()))
+ }
+
/// Transform the point with the given transformation.
pub fn transform(self, ts: Transform) -> Self {
Self::new(