Closed robwalton closed 4 years ago
Hey Rob,
Thanks for the suggestion, I think it's a good one.
If you've got a model that you want to display in a 3D view with links between turtles, the full NetLogo 3D app will do that already. You'd need to add code to the model to se the "height" of your turtles that the 2.5D does automatically, but that's usually pretty simple. Just wanted to point that out so you don't dive in to a load of extra work when there was an alternative.
What you're proposing should be possible, but from glancing at the code it will be a good bit of work. If you're interested in working on it yourself, you'll need sbt installed, it's the build tool for the project. While it's mostly associated with the Scala language, it compiles and packages Java just fine, too. You can use compile
to compile the project and package
to package the jar. Note while working you'll probably want to add isSnapshot := true
to the build.sbt
file to make sure sbt will package
your code even with uncommitted changes.
Once you've got things compiling and packaging, you can get down to development. The general NetLogo extensions API wiki page might be a good starting reference for how extensions work. For this project, the prims are published in the View25DExtension.java
file, and the interesting ones for turtle links would be MakeTurtleView.java
and UpdateOneTurtleView.java
which are the entry points for creating and updating the turtle views. That's where you'd want to add the link drawing, I suspect.
The first thing you'd need to look into is simply getting a collection of all the links for the turtles in the agentset for a view, possibly from the world
object. Once you've got those links, then you'd need to draw them out somehow. The drawing code is in the gl
folder, and I'll admit it's mostly a mystery to me. Hopefully the turtle and patch drawing code there would be good enough examples to try to add link drawing, as well.
Like I said, that's a good bit of work. If you do run into trouble with it you can visit us in our Gitter chat room or post to the NetLogo devel mailing list and I or someone else will try to help you out.
Hi @LaCuneta,
Thanks for your detailed thoughts on how to proceed and for your welcome to the netlogo community.
I had just assumed that netlogo 3d was overkill for my problem and then got sucked into view2.5d for visualisation. Thanks for pointing this out. I'll look into netlogo 3d first!
Link visualization has been added!
Links can be visualized going from turtle to turtle view2.5d 1.1.5
Links can be visualized either in the xy plane, or from turtle to turtle view2.5d 1.1.6
Thanks for the handy extension. Have you ever looked into drawing links between turtles? It would be very handy for my work. I can code Java and would be very grateful for a few hints to get me going. -- Thanks greatly Rob