@@ -9,42 +9,114 @@ using Preferences
99
1010# --- Paraxial Invariants ---
1111const INVARIANT_THRESHOLD = @load_preference (" invariant_threshold" , 1e-6 )
12+ """
13+ get_invariant_threshold()
14+
15+ Returns the global configuration threshold for the paraxial optical invariant check.
16+ """
1217get_invariant_threshold () = INVARIANT_THRESHOLD
1318
19+
1420# --- SDF & Ray Marching ---
1521const SDF_SURFACE_THRESHOLD = @load_preference (" sdf_surface_threshold" , 1e-9 )
1622const SDF_RAYMARCH_EPS = @load_preference (" sdf_raymarch_eps" , 1e-10 )
1723const SDF_INSIDE_STEP = @load_preference (" sdf_inside_step" , 1.0 )
1824
25+ """
26+ get_sdf_surface_threshold()
27+
28+ Returns the global configuration threshold for the Signed Distance Field (SDF) surface detection.
29+ """
1930get_sdf_surface_threshold () = SDF_SURFACE_THRESHOLD
31+
32+ """
33+ get_sdf_raymarch_eps()
34+
35+ Returns the global configuration epsilon for the SDF ray marching algorithm.
36+ """
2037get_sdf_raymarch_eps () = SDF_RAYMARCH_EPS
38+
39+ """
40+ get_sdf_inside_step()
41+
42+ Returns the global configuration step size when inside an SDF volume.
43+ """
2144get_sdf_inside_step () = SDF_INSIDE_STEP
2245
46+
2347# --- Numerical Thresholds ---
2448const INTERNAL_REFLECTION_THRESHOLD = @load_preference (" internal_reflection_threshold" , 1e-6 )
2549const LINE_PLANE_INTERSECTION_THRESHOLD = @load_preference (" line_plane_intersection_threshold" , 1e-6 )
2650const ORTHOGONALITY_THRESHOLD = @load_preference (" orthogonality_threshold" , 1e-10 )
2751
52+ """
53+ get_internal_reflection_threshold()
54+
55+ Returns the global configuration threshold for total internal reflection detection.
56+ """
2857get_internal_reflection_threshold () = INTERNAL_REFLECTION_THRESHOLD
58+
59+ """
60+ get_line_plane_intersection_threshold()
61+
62+ Returns the global configuration threshold for line-plane intersection calculations.
63+ """
2964get_line_plane_intersection_threshold () = LINE_PLANE_INTERSECTION_THRESHOLD
65+
66+ """
67+ get_orthogonality_threshold()
68+
69+ Returns the global configuration threshold for orthogonality checks (e.g., beam support axes).
70+ """
3071get_orthogonality_threshold () = ORTHOGONALITY_THRESHOLD
3172
73+
3274# --- Tracing Defaults ---
3375const DEFAULT_R_MAX = @load_preference (" default_r_max" , 100 )
3476const DEFAULT_DEPTH_MAX = @load_preference (" default_depth_max" , typemax (Int))
3577
78+ """
79+ get_default_r_max()
80+
81+ Returns the default maximum number of segments for ray tracing.
82+ """
3683get_default_r_max () = DEFAULT_R_MAX
84+
85+ """
86+ get_default_depth_max()
87+
88+ Returns the default maximum depth for recursive ray tracing (e.g., reflections/refractions).
89+ """
3790get_default_depth_max () = DEFAULT_DEPTH_MAX
3891
92+
3993# --- Physical Defaults ---
4094const DEFAULT_WAVELENGTH = @load_preference (" default_wavelength" , 1e-6 )
4195const DEFAULT_WAIST = @load_preference (" default_waist" , 1e-3 )
4296const DEFAULT_POWER = @load_preference (" default_power" , 1e-3 )
4397
98+ """
99+ get_default_wavelength()
100+
101+ Returns the default wavelength in meters.
102+ """
44103get_default_wavelength () = DEFAULT_WAVELENGTH
104+
105+ """
106+ get_default_waist()
107+
108+ Returns the default beam waist radius in meters.
109+ """
45110get_default_waist () = DEFAULT_WAIST
111+
112+ """
113+ get_default_power()
114+
115+ Returns the default beam total power in Watts.
116+ """
46117get_default_power () = DEFAULT_POWER
47118
119+
48120"""
49121 set_preference!(key::String, val; persistent=true)
50122
@@ -56,6 +128,13 @@ function set_preference!(key::String, val)
56128end
57129
58130# Keep the old setter for compatibility
131+ """
132+ set_invariant_threshold!(val::Real)
133+
134+ Sets the global configuration threshold for the paraxial optical invariant check.
135+ This preference is persistent. Please restart Julia for this to take effect.
136+ """
59137set_invariant_threshold! (val:: Real ) = set_preference! (" invariant_threshold" , Float64 (val))
60138
139+
61140end # module
0 commit comments