diff options
| author | Pg Biel <9021226+PgBiel@users.noreply.github.com> | 2023-04-21 06:28:46 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-21 11:28:46 +0200 |
| commit | a4075f8b9b387f4e0aea9cc0ee11ca62c99a648d (patch) | |
| tree | 1090c82c7d7522d5750a6e7d31a91b3f88a3b53b /src/geom | |
| parent | 4cea7007d0d4f152097d753be3020c736e96cca0 (diff) | |
Implement math `cancel` function (#793)
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/point.rs | 5 |
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( |
