RI-Driven Pavilion Angles
The pavilion's performance depends on how closely you aim each facet at the material's critical angle. Now that FSL expressions can read the gemstone's refractive index through the built-in RI constant, you can script those angles directly instead of retyping tables from reference books.
Reading the active RI
ri always mirrors the most recent ri = command (including optimizable expressions and overrides). Because it behaves like a read-only variable, you can combine it with any of the math helpers in expressions, function parameters, or optimizer targets.
Example: pavilion cut at the computed critical angle
The snippet below calculates the material's critical angle, adds a one-degree safety margin, and then cuts a pavilion that tracks that calculation. Any change to ri = automatically recomputes the angles—perfect for trying new materials or letting the optimizer sweep the refractive index.
name = "Critical Pavilion"
gear = 96
ri = 1.76
critical_angle = Math.toDegrees(Math.asin(1 / ri))
pavilion_angle = critical_angle + 1.0 // 1° safety margin
P1 2 @ pavilion_angle : cp() x8
Try changing the ri to quartz (ri = 1.544) and re-run the design—the pavilion reorients itself instantly based on the new physics. You can extend the same approach to crowns, function defaults, or optimizer objectives by referencing ri anywhere a numeric expression is allowed.