NetLogo-3d bug in hatch?

21 views
Skip to first unread message

Steve Scott

unread,
Mar 3, 2020, 4:31:54 PM3/3/20
to netlogo-devel
when I call:
hatch-points 1 []

the z value of the point is not inherited. It is set to zero.

To get it to work I have to explicitly assign the z coordinate:

hatch-points 1 [
set zcor [zcor] of myself
]

This is not the behavior I expected.

--
From the personal email account of Steve Scott.

Aaron Andre Brandes

unread,
Mar 3, 2020, 8:37:19 PM3/3/20
to netlogo-devel
Hi Scott,
I've attached a NetLogo model that I believe tests this issue. The code is also below.
I don't get the behavior you described on my Mac running 6.1.1

Could you give me
  • Your system information: NetLogo version, OS version, Java version, and so on. This information is available from NetLogo’s “About NetLogo” menu item, then clicking the System tab.
  • If the attached model doesn't reproduce the behavior you are seeing, please create a model that does.
breed [ points point ]

to setup
  clear-all
  create-points 1 [ setxyz 1 2 3 ]
  ask points [ hatch-points 1 ]
  ask points [ show zcor ]
end

Aaron
observer> setup
(point 0): 3
(point 1): 3
hatch-3d.nlogo3d

Charles

unread,
Mar 4, 2020, 12:45:34 PM3/4/20
to netlogo-devel
As a frequent user of 3D, I tested this out on my Windows version 3D 6.1.1.  It's weird.  When I run the following

breed [ points point ]

to setup
  clear-all
  create-points 1 [ setxyz 1 2 3  set size 5 set color red]
  ask point 0 [ hatch-points 1 ]
  create-points 1 [ setxyz -2 -3 -4 set size 5 set color green]
  ask point 2 [ hatch-points 1 ]
  ask points [ show zcor ]
  wait 20
  ask point 3 [ setxyz -2 -3 -4 ]
end

The command center gives exactly what you would expect.  But, when I look at the 3D View, the hatched and hacher points do appear to have different x coordinates.  (You need to rotate the world up to see the z dimension.)  They should be on top of each other, but they are not.  Indeed, after the 20 seconds of wait time, you see points 2 and 3 visually merge together so, as far as the view window is concerned, they must have had different z coordinates before merging.

Charles

Steve Scott

unread,
Mar 4, 2020, 12:59:04 PM3/4/20
to Charles, netlogo-devel
I am running 6.1.1 on Windows. See attached to recreate bug.

breed [walkers walker]
breed [points point]

to go
  ca
  reset-ticks
 ask patch 0 0 10
  [
    sprout-walkers 1
  ]  
while [ticks < 50] [
  ask walkers [
      rt random 30
tilt-up random 10 - 5
      forward 1
      hatch-points 1 []
    ]
    tick
]
end
hatch_bug_v.6.1.1_image.png
> --
> You received this message because you are subscribed to the Google Groups "netlogo-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-deve...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-devel/3d8dc3e7-c6f9-4e5d-80ba-60f29375e3bf%40googlegroups.com.
hatch_bug_v.6.1.1

Aaron Andre Brandes

unread,
Mar 4, 2020, 8:58:45 PM3/4/20
to Steve Scott, Charles, netlogo-devel

Hi Charles and Steve,

I tried your code and did not see the bug.

 

I made models using a version of your code in which the hatcher is a dot, and the hatchee is a larger circle.

The dots seem to always be in the circles. I have orbited and zoomed.

 

Could you let me know if you get the bug with these models?

 

If so I will find a Windows machine for testing.

Aaron

 

-- 

Aaron Brandes, Software Developer

Center for Connected Learning and Computer-Based Modeling

 

 

From: <netlog...@googlegroups.com> on behalf of Steve Scott <steves...@gmail.com>
Date: Wednesday, March 4, 2020 at 11:59 AM
To: Charles <csta...@smith.edu>
Cc: netlogo-devel <netlog...@googlegroups.com>
Subject: Re: [netlogo-devel] Re: NetLogo-3d bug in hatch?

 

I am running 6.1.1 on Windows. See attached to recreate bug.

 

breed [walkers walker]
breed [points point]

to go
  ca
  reset-ticks
 ask patch 0 0 10
  [
    sprout-walkers 1
  ]  
while [ticks < 50] [
  ask walkers [
      rt random 30

tilt-up random 10 - 5

      forward 1
      hatch-points 1 []
    ]
    tick
]
end

hatch_bug_v.6.1.1_aab.nlogo3d
hatch_bug2_aab.3d

Steve Scott

unread,
Mar 4, 2020, 9:17:56 PM3/4/20
to Aaron Andre Brandes, Charles, netlogo-devel
The bug does not appear in your code but it still appears in mine. Can anyone confirm my bug by running my code? It appears in 6.1.1 and 6.1.0 in Windows.

Steve Scott

unread,
Mar 4, 2020, 9:20:57 PM3/4/20
to Aaron Andre Brandes, Charles, netlogo-devel
@Charles  when I print the zcor of the points breed they all say zero. it is not an optical illusion.

Steve Scott

unread,
Mar 4, 2020, 9:43:49 PM3/4/20
to Aaron Andre Brandes, Charles, netlogo-devel
  • Your system information: NetLogo version, I tried 6.1.1 on one machine and 6.1.0 on another machine
  • OS version Windows 10
  •  Java version, and so on. latest java

  • This information is available from NetLogo’s “About NetLogo” menu item, then clicking the System tab.
  • NetLogo 3D 6.1.0 (May 13, 2019)
    Extension API version: 6.1
    Java HotSpot(TM) 64-Bit Server VM 1.8.0_202 (Oracle Corporation; 1.8.0_202-b08)
    operating system: Windows 10 10.0 (amd64 processor)
    Scala version 2.12.8
    Java heap: used = 25 MB, free = 321 MB, max = 910 MB

    JOGL: 2.3.2
    OpenGL graphics: GeForce GTX 970/PCIe/SSE2
    OpenGL version: 4.6.0 NVIDIA 432.00
    OpenGL vendor: NVIDIA Corporation
  • If the attached model doesn't reproduce the behavior you are seeing, please create a model that does.
    model hatch-3d prints the correct zcor but they appear in the wrong location.
    The model I uploaded shows the bug. This model attached also shows the bug. The points appear in the wrong location and have 0 for the zcor.


    breed [ points point ]

    to setup
      clear-all
      reset-ticks
      create-points 1 [ setxyz 0 0 10 ]
      while [ticks < 20] [
       
        ask points with [who = 0] [lt 10
        tilt-down 10

         forward 1
          hatch-points 1 ]
        tick
      ]
      ask points [ show zcor ]
    end
    hatch-3d-with-bug.netlogo

    Charles Staelin

    unread,
    Mar 5, 2020, 11:04:58 AM3/5/20
    to Aaron Andre Brandes, Steve Scott, netlogo-devel
    Aaron,

    I've done some more testing.  First, my system:

    NetLogo 3D 6.1.1 (September 26, 2019)

    Extension API version: 6.1
    Java HotSpot(TM) 64-Bit Server VM 1.8.0_202 (Oracle Corporation; 1.8.0_202-b08)
    operating system: Windows 10 10.0 (amd64 processor)
    Scala version 2.12.8
    Java heap: used = 29 MB, free = 348 MB, max = 910 MB

    JOGL: 2.3.2
    OpenGL graphics: Intel(R) HD Graphics 4600
    OpenGL version: 4.3.0 - Build 20.19.15.5063
    OpenGL vendor: Intel

    To show you what I see, I've attached a pdf with screen shots of the command center, and the View window, both before and after the 20 second wait has passed.  But, your code works, and I think I know why.  If you look at the .nlogo3D file attached, I have a version of my code that sets the color of the hatched point.  Now, the problem goes away.  I haven't tried other modifications to the hatched point to see if they too would solve the problem, but setting the color (or shape? or ?) seems to force the View to put the point at the right z coordinate.  

    I'll look at Steve's model when I get a chance to see if I get the same behavior.

    Charles

    -------------------------------
    Charles P. Staelin
    Professor of Economics
    Smith College
    Northampton, MA 01063


    On Wed, Mar 4, 2020 at 8:58 PM Aaron Andre Brandes <aaron....@northwestern.edu> wrote:
    my_code_screen_shots.pdf
    hatch_bug2_aab_cps.nlogo3d

    Aaron Andre Brandes

    unread,
    Mar 5, 2020, 11:36:01 AM3/5/20
    to Charles Staelin, Steve Scott, netlogo-devel

    Hi Charles and Scott,

    Thanks for following up.

    I have created an issue for this bug

     

    hatched turtle in 3D does not have zcor of parent #1822

     

    It appears that the bug only occurs when the hatched turtle is not given commands. That explains why my version did not reproduce the bug.

    The problem also goes away when optimization is turned off, because optimization runs specialized code in the no commands case.

    Steve Scott

    unread,
    Mar 5, 2020, 11:38:46 AM3/5/20
    to Aaron Andre Brandes, Charles Staelin, netlogo-devel
    Great! Thanks for getting to the bottom of this.

    Charles

    unread,
    Mar 5, 2020, 11:43:13 AM3/5/20
    to netlogo-devel
    Thanks Aaron.  And nice that there is a pretty simple work-around.

    Charles

    > To unsubscribe from this group and stop receiving emails from it, send an email to netlog...@googlegroups.com.


    > To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-devel/3d8dc3e7-c6f9-4e5d-80ba-60f29375e3bf%40googlegroups.com.



    --
    From the personal email account of Steve Scott.

    --
    You received this message because you are subscribed to the Google Groups "netlogo-devel" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to netlog...@googlegroups.com.

    --
    You received this message because you are subscribed to the Google Groups "netlogo-devel" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to netlog...@googlegroups.com.

    Reply all
    Reply to author
    Forward
    0 new messages