summaryrefslogtreecommitdiff
path: root/src/geom/point.rs
diff options
context:
space:
mode:
authorPg Biel <9021226+PgBiel@users.noreply.github.com>2023-04-21 06:28:46 -0300
committerGitHub <noreply@github.com>2023-04-21 11:28:46 +0200
commita4075f8b9b387f4e0aea9cc0ee11ca62c99a648d (patch)
tree1090c82c7d7522d5750a6e7d31a91b3f88a3b53b /src/geom/point.rs
parent4cea7007d0d4f152097d753be3020c736e96cca0 (diff)
Implement math `cancel` function (#793)
Diffstat (limited to 'src/geom/point.rs')
-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(