Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 set ri command (including optimizable expressions and overrides), and it is case-insensitive (RI, ri, Ri, etc.). Because it behaves like a read-only variable, you can combine it with any of the math helpers in expressions, macro 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 set ri automatically recomputes the angles—perfect for trying new materials or letting the optimizer sweep the refractive index.

set name "Critical Pavilion"
set gear 96
set ri 1.76

let critical_angle = rad2deg(asin(1 / RI))
let pavilion_angle = critical_angle + 1.0 // 1° safety margin


P1 2 @ pavilion_angle : cp x8

Try changing the RI to quartz (set 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, macro defaults, or optimizer objectives by referencing RI anywhere a numeric expression is allowed.