netlogo - Line computed in turtle's direction doesn't match shape heading -


code:

;call check in code below

 to-report calculate-line[x y angle]       let m tan angle       let m        let b -1        let c (- m * x + y)        report (list b c)     end      make-line[a]; list containing a, b , c , in order.       let x 0       let y((- item 2 a) / item 1 a)       let y1 0       let x1((- item 2 a) / item 0 a)       hatch 1[         set size 0.15 setxy x y         pendown         facexy x1 y1              fd 7          ]     end      check       clear-all       crt 1[         set size 2         set shape "arrow"         setxy -3 3         set heading 268         make-line calculate-line xcor ycor heading-to-angle heading         ]     end to-report heading-to-angle [ h ]   report (90 - h) mod 360 end 

output: enter image description here

question:

why isn't arrow heading , line in same direction? compute line coordinates of turtle , heading , plot it. missing approximation happening in btw code?

it works fine if have arrow centred @ (0,0). see version of check procedure code:

to check   clear-all   crt 1   [ set size 2     set shape "arrow"     setxy 0 0     set heading random 360     make-line calculate-line xcor ycor heading   ] end 

but if change thesetxy 0 0 other locations (such setxy 3 2) whole thing separates. suggests there no approximation, problem calculation of line coordinates. in calculation of list of a, b , c, can't work out supposed , variable names no help.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -