M.F. Miller Supply Co.
Back to Interactive Lab
rust-wasmstudio-mathstudio-geometrystudio-demosstudio-wasm

Shot Dispersion Explorer

Correlated bivariate Gaussian dispersion, polygon hazard integration, and tactical aim optimization in Rust & WebAssembly.

Rust / WASMInitializing Rust WASM worker…
-30-20-100+10+20+30LONG (+40 yd) · 10 yd grid
GreenWaterBunkerOptimal Aim
Green Hit
—
Penalty
—
Exp. Strokes
—
Optimal Aim
—
0 yd (Pin)
162 yd (Target 160)
±8.5 yd
±10.5 yd
-0.25
0.0°
26 yd
250

How the Computation Works

Every shot landing coordinate (x,y)(x, y) relative to the center of the green is modeled as a correlated bivariate normal random vector:

p∼N ⁣(μ,Σ),Σ=(σx2ρσxσyρσxσyσy2)\mathbf{p} \sim \mathcal{N}\!\left(\boldsymbol{\mu}, \Sigma\right), \qquad \Sigma = \begin{pmatrix} \sigma_x^2 & \rho \sigma_x \sigma_y \\ \rho \sigma_x \sigma_y & \sigma_y^2 \end{pmatrix}

Rather than relying on rough circular approximations, the compiled Rust WebAssembly engine performs three exact steps in a background Web Worker:

  1. Analytical Covariance Eigendecomposition (studio-math): Computes exact major/minor axes and principal rotation angles for the 50% CEP, 68% Core, and 90% Envelope confidence ellipses using the two-degree-of-freedom chi-squared quantile χ22(p)=−2ln⁡(1−p)\chi^2_2(p) = -2\ln(1 - p).
  2. Composite 2D Gauss-Legendre Quadrature (studio-demos + studio-geometry): Integrates the bivariate PDF across $900$ weighted quadrature nodes spanning ±4.5σ\pm 4.5\sigma, classifying each node against exact ray-cast hazard and putting-green polygons.
  3. Lateral Aim Sweep & Deterministic Simulation: Evaluates expected strokes across lateral aim lines from −24-24 to +24+24 yards to surface the mathematically optimal target line, and generates deterministic SplitMix64 + Box-Muller simulated shots for tabular inspection and JSON export.