Skip to content

Instantly share code, notes, and snippets.

@Nectarineimp
Created April 16, 2013 22:02
Show Gist options
  • Select an option

  • Save Nectarineimp/5400030 to your computer and use it in GitHub Desktop.

Select an option

Save Nectarineimp/5400030 to your computer and use it in GitHub Desktop.
experiments in trigonometry in Clojure
(defn get-slope [[x1 y1] [x2 y2]]
(/ (- x2 x1) (- y2 y1)))
(get-slope [500 400][290 600])
(defn angle-offset [slope]
(java.lang.Math/atan slope))
(angle-offset (get-slope [500 400][300 490]))
(java.lang.Math/sin (angle-offset -0.45))
(/ java.lang.Math/PI 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment