Reputation: 9796
How do I calculate the above angle specified in the figure. The patch is known beforehand.
Upvotes: 2
Views: 709
Reputation: 9796
to-report calculate-turtles-in-cone2
let px [pxcor] of patch-goal
let py [pycor] of patch-goal
; show [pxcor] of patch-goal
set corner-1 list (px + 0.5 - .25)(py - 0.5)
set corner-2 list (px - 0.5 + .25)(py - 0.5)
; show corner-1
; show corner-2
let head-1 towardsxy (item 0 corner-1) (item 1 corner-1)
let head-2 towardsxy (item 0 corner-2) (item 1 corner-2)
report abs (subtract-headings head-1 head-2)
end
Upvotes: 1
Reputation: 14972
I won't write code for it, but here is a general recipe:
pxcor
and pycor
;distancexy
;towardsxy
;subtract-headings
.Upvotes: 6