Use the function hypot for distances

This commit is contained in:
alonso.torres 2023-01-04 16:18:12 +01:00
parent 84e9f69213
commit 10439934d4
4 changed files with 12 additions and 8 deletions

View file

@ -890,8 +890,7 @@
(defn calculate-ratio
;; sqrt((actual-width)**2 + (actual-height)**2)/sqrt(2).
[width height]
(/ (mth/sqrt (+ (mth/pow width 2)
(mth/pow height 2)))
(/ (mth/hypot width height)
(mth/sqrt 2)))
(defn fix-percents