Expand description
Lightning generation using the Dielectric Breakdown Model (DBM). Solves Laplace’s equation to determine growth direction, with branching and return stroke animation.
Structs§
- Dielectric
Breakdown - Grid for dielectric breakdown simulation.
- Lightning
Bolt - A lightning bolt represented as line segments with brightness.
- Lightning
Renderer - Renderer for lightning bolts.
Functions§
- add_
branches - Add branches to an existing bolt. Each segment has a probability of spawning a short branch.
- animate_
bolt - Animate a bolt: leader progresses downward, then return stroke brightens. Returns segments with animated brightness at the given time.
- bolt_
with_ return_ stroke - Apply a return stroke effect: brighten the main channel.
- generate_
bolt - Generate a lightning bolt from
starttoendusing the Dielectric Breakdown Model. - laplace_
solve - Solve Laplace’s equation ∇²φ = 0 on a grid using Jacobi/SOR iteration.
boundary_mask[i]= true means the cell is a fixed boundary. - stepped_
leader - Generate a stepped leader: a series of step-wise advances with random jitter.