Nice screen shot, thanks for providing that, it makes the problem easy to grasp. It looks like the farther from the origin, the worse the discrepancy is, like the error is radiating out from the origin.
I know the GIS extension documentation recommends gis:set-world-envelope (list min-pxcor max-pxcor min-pycor max-pycor)
, but I have to wonder if it's actually correct. min/max-pxcor/pycor
are the minimum and maximum patch coordinates, not the minimum and maximum turtle coordinates. So for example if max-pxcor
is 10, then a turtle's x coordinate can be as high as 10.499999[...], and if min-pxcor
is -10, a turtle's x coordinate can be as low -10.5. Thus world-width
is 21, not 20.
Maybe try changing it to gis:set-world-envelope (list min-pxcor - 0.5 max-pxcor + 0.5 min-pycor - 0.5 max-pycor + 0.5)
and see if that fixes it. Or if it doesn't fix it exactly, try flipping the signs or try 1 instead of 0.5. It sure looks from the screen shot like the problem is an off-by-one or off-by-0.5 error.