Previous | Next --- Slide 19 of 46
Back to Lecture Thumbnails
acpatel

How do we determine neighbors in this case? Would it be based on nearest neighbors, or neighbors within a radius? Also how would we quickly access these neighbors? A spatial data structure like a BVH could work, but we would need to continuously update it/rebuild it to account for the movement. Is there any simple intuition to understand how some spatial data could retain its structure with moving elements?

jkalapos

This kind of makes watching flocks of birds seem a bit less magical in a sense but pretty cool that their behavior can be described in a very simple way. At least the rules are simple but the ODE is pretty large with so many birds to consider.

tcl1

So would you simply use the lagrangian to compute the force from each of these forces, sum them, and then just use basic equations of motion to update each particles position?

keenan

@acpatel The short answer is: you use a dynamic spatial data structure (of which there are many). The idea is the same as a static spatial data structure, but you take advantage of temporal coherence to intelligently maintain the hierarchy over time. For instance, in an axis aligned bounding box hierarchy (like you implemented for A3) it's pretty easy to update for small changes in position: just re-fit the bounding boxes. Eventually, of course, you have to do something else, so that the tree doesn't become super inefficient.

keenan

@tcl1 Yeah, you could develop a flocking simulator from a Lagrangian point of view; actually, I don't think I've ever seen that done. Could be quite fun. Usually people just hack it with pseudo-physical forces that they cook up by hand. ;-)