get patch color value

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

get patch color value

vita
Good morning everyone,
 I'm new user of netlogo, i want to calculate the gradient of my image as the result of my code is always "0" i don,t know why!! right now i want to get the patch color value...anyone can help me plz and thank you =)
 this is the  code :
 ;*************************
  to grdn
   let p1 [bw] of patch-at -1 1
  let p2 [bw] of patch-at 0 1
  let p3 [bw] of patch-at 1 1
  let p4 [bw] of patch-at -1 0
 

 let p5 [bw] of patch-at 1 0
 let p6 [bw] of patch-at -1 -1
  let p7 [bw] of patch-at 0 -1
  let p8 [bw] of patch-at 1 -1
 

   set gx  (p6 + 2 * p7 + p8 ) - (p1 + 2 * p2 + p3 )
   set gy (p3 + 2 * p5 + p8 ) - (p1 + 2 * p4 + p6 )
 

   set grad sqrt  ( (gx)  ^2 +  (gy) ^2 )
 ; print result
   print grad
 

 

 end