Designed a tool for the user to input herd trajectories. It is programmed in python and the GUI uses the SFML library.
Here is how data collection takes place:
The list of positions thus contains all the locations where the mouse position was polled, and is used to determine the path the user wants the animals to move along.
Although the positions give us the path, they are difficult to use without being transformed first.
To facilitate our work, and get more visual data, we use the positions array to compute an array of velocities at each point we polled the mouse at.
To generalize the velocity vectors into a field, we use the Gaussian Blur algorithm to diffuse the vectors in the space.
If you look at the above picture, some unexpected behavior can be seen.
Firstly, although the Gaussian Blur algorithm does its job well, it is not meant to take into account any obstacles present in the space. Because of that, the lowest region on the picture had an effect on the left region, and, more importantly, some velocities also spread outside of the area the paths were originally drawn in.
The second shortcoming that can be observed is that many velocities point straight to an obstacle. However, this behavior and should be corrected as animals generally tend to avoid barriers.
To solve the two aforementioned problems, I decided to implement my own augmented Gaussian Blur routine. Instead of blindly spreading the velocities in the area, I could design it to be mindful of the environment as well.
Here is an example of a direction field, calculated using the custom routine: