sound closeness

This commit is contained in:
2015-02-19 17:15:59 -08:00
parent b86d6869c3
commit 5fc4f20045
3 changed files with 28 additions and 13 deletions

View File

@@ -62,9 +62,11 @@
(.r))]
(+ (* percent-complete (- maximum-size minimum-size)) minimum-size)))))
(defn dist [x1 y1 x2 y2]
(let [dx (- x1 x2)
dy (- y1 y2)]
(defn dist [x1 y1 x2 y2 & {:keys [y-sign x-sign]}]
(let [y-sign (or y-sign 1.0)
x-sign (or x-sign 1.0)
dx (* (- x1 x2) x-sign)
dy (* y-sign (- y1 y2))]
(Math/sqrt (+ (* dx dx) (* dy dy)))))