hid the deg->rad conversion inside the angle decompose function

This commit is contained in:
Richard Harrington 2013-08-22 11:24:33 -04:00
parent e2baa8e29d
commit 63fd4c157d
2 changed files with 5 additions and 4 deletions

View File

@ -7,9 +7,10 @@
(* angle (/ Math/PI 180)))
(defn decompose-angle
[angle]
{:x (Math/cos angle)
:y (Math/sin angle)})
[angle-in-degrees]
(let [angle (deg->rad angle-in-degrees)]
{:x (Math/cos angle)
:y (Math/sin angle)}))
; classical mechanics functions

View File

@ -6,7 +6,7 @@
[pos-x pos-y aim distance]
; TODO: make the starting point dependent upon the robot radius,
; which should be in constants.
(let [{unit-x :x unit-y :y} (physics/decompose-angle (physics/deg->rad aim))]
(let [{unit-x :x unit-y :y} (physics/decompose-angle aim)]
{:pos-x pos-x
:pos-y pos-y
:v-x (* unit-x SHELL-SPEED)