Particle Dynamics

This program demonstrates how easily a particle system can be simulated and visualized in real time.

This program simulates the dynamics of a system of non-interacting particles bouncing on a surface. The surface is given by a simple function and the scene graph used to visualize the surface is generated in the same way as the previous surface plot:

let f x z =
  let r = 5. * sqrt(x*x + z*z)
  sinc r + 0.01 * sin x + 3e-3*r*r

let floor = (Plot3D(f, -3., 3., -3., 3., PlotStyle=Color.BurlyWood) :> Graphics3D).scene

The particle dynamics are integrated using a simple Euler time integrator. The delta in time used for the simulation is taken from a real time clock. To avoid the poor approximation given by the integrator in the event of a collision with the surface, the simulation over significant (>1ms) time slices spanning a collision are recursively bisected. This alleviates the conventional problem of handling particles that are temporarily beneath the surface.

The particle system is visualized using a simple scene graph composed of a group of transformations of spheres:

let particles =
  (fun i -> dynamic_transform (particle i) sphere) |>
  Seq.init_finite state.Length |>
  group |>
  color Color.Red

The transformations are dynamic, meaning the actual transformation matrix is generated by a function call each time it is used. By using a function that generates a transformation matrix from the position of each particle, this allows the scene graph to follow the particle dynamics whilst retaining the elegance of an immutable data structure.

Our library allows the dynamics of this particle system to be visualized interactively in real time.

(Note: We are not VAT registered and, therefore, cannot provide VAT receipts)

Mastercard VISA VISA Delta VISA Electron VISA Purchasing JCB Solo Switch