| ## 3D HeatBugs By Gabriel Catalin Balan

[Requires Java3D]

3D HeatBugs displays the HeatBugs example in a cute 3D visualizer. Don't be confused by this: it's still the classic 2D HeatBugs. As the bugs heat up the environment, the heat grid warps to represent the amount of heat present. You might find the visualization nicer if you click on the Options () icon and choose "Draw Polygons as Edges". Dragging rotates. Other mouse buttons (or Option-Drag or Command-Drag on Macs) translate and magnify.

You might compare to plain HeatBugs. Or try HexaBugs: HeatBugs on a 2D hexagonal grid.

From the HeatBugs console documentation: HeatBugs is a model originally developed on the Swarm toolkit. The environment is a toroidal 100x100 grid of "heat", populated with 100 "bugs" with built-in heaters which heat up their environment. The bugs prefer it to be not too warm and not too cold (the range differs from bug to bug), and will follow the gradient towards regions more to their liking. The heat diffuses and evaporates at the provided rate. We have set up various model parameters you might like to play with.

HeatBugs spends the large majority of its computer time in the diffusion of heat. Our version of HeatBugs optimizes this in two ways:

1. We've hand-optimized it carefully. In the body of the Diffuser.java we have a step-by-step tutorial showing optimization after optimization.
2. We have a special version of Diffuser.java, called ThreadedDiffuser.java, which takes advantage of dual-processor machines to break the diffusion work up among two processors. If you have more than two processors, ThreadedDiffuser.java can be modified with some elbow grease to take advantage of them as well.

In the Model tab we've added two unusual parameters: BugXPos and BugYPos. These return arrays of doubles reflecting the x and y coordinates of the bugs respectively. They're included to show how to make histograms.