This week we have worked on making some improvements to existing code, but we have added some new features as well. We had quite a large issue before regarding the transition of agents to new cells and the subsequent update of the densities. Basically, what happened was that every time an agent left a cell, the density in that cell became zero during one frame. In the very next frame, the density value was normal again. This could actually be seen in the color representation of each cell. It was of great importance that we dealt with these sudden density drops as they could have turned out to cause problems later on. So that is what we did! And we succeeded! The solution was rather simple. By letting the agents themselves manage the transition into new cells and the update of densities, the problem was solved.
The video below is that from the previous post were you can clearly see that the cells flicker.
In the following video, the change in color is much smoother and the flickering is completely gone.
As mentioned before, apart from the improvements made, some new features have been added to further enrich the visualization. We have added green arrows pointing in the direction of the preferred velocity and red arrows that visualize the velocity component that is added upon collision to avoid other agents. The actual velocity is the sum of these two vectors. This way of visualizing the different velocities turned out much better looking than visualizing the actual velocity itself. It clearly shows what happens when agents try to avoid fellow agents.
We also added the possibility to show the trajectories of each agent consisting of a line connecting its current position and its target position. This looked quite neat too.
And finally, here is a video showing these visualizations in action!