You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Screw barnes-hut. Too much memory thrashing for modern architectures (I'm making this up).
Off-load N-body simulation to a web worker, and:
Use a very compact linear memory structure, probably typed arrays for positions ,velocities, mass, all mashed into one big array with named indices for access.
Find out the most efficient memory order in which to do direct N-body. Maybe even duplication for increased memory linearity?
Split simulation into near/far interactions. Probably only two levels to avoid memory usage.
Keep a rich-object copy of all the N bodies in the non-web-worker code, and:
Update positions, velocities and accelerations when web worker outputs them
Extrapolate form position, velocity, accelerations, and:
Soft-snap to new correct position when available
Handle visual-effects-only particles particles, let them gravitate toward the N bodies (using very soft Plummer model?). Should probably also use near/far update intervals, or simply use sqr distance threshold).
Probably use Plummer model for gravity
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: