pub fn generate_bolt(
start: Vec2,
end: Vec2,
grid_size: usize,
branch_prob: f32,
) -> LightningBoltExpand description
Generate a lightning bolt from start to end using the Dielectric Breakdown Model.
The algorithm:
- Initialize the bolt at the start position.
- Solve Laplace’s equation for the potential field.
- Find candidate growth sites (neighbors of the bolt not yet part of it).
- Weight candidates by the local electric field (potential gradient).
- Select a growth site (deterministically using a hash for reproducibility).
- Extend the bolt and repeat.