From a4075f8b9b387f4e0aea9cc0ee11ca62c99a648d Mon Sep 17 00:00:00 2001 From: Pg Biel <9021226+PgBiel@users.noreply.github.com> Date: Fri, 21 Apr 2023 06:28:46 -0300 Subject: Implement math `cancel` function (#793) --- src/geom/point.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/geom') 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( -- cgit v1.2.3