mirror of
https://github.com/richardharrington/robotwar.git
synced 2024-05-28 08:41:28 +00:00
hid the deg->rad conversion inside the angle decompose function
This commit is contained in:
parent
e2baa8e29d
commit
63fd4c157d
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user