Skip to content

Commit 9cf1f14

Browse files
committed
Make sure all exported functions have docstrings
1 parent ffe985b commit 9cf1f14

4 files changed

Lines changed: 97 additions & 0 deletions

File tree

src/AbstractTypes/AbstractRay.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ abstract type AbstractRay{T <: Real} end
7979
Base.position(ray::AbstractRay) = ray.pos
8080
position!(ray::AbstractRay, pos) = (ray.pos = pos)
8181

82+
"""
83+
direction(ray::AbstractRay)
84+
85+
Returns the direction vector of the `ray`.
86+
"""
8287
direction(ray::AbstractRay) = ray.dir
88+
8389
function direction!(ray::AbstractRay, dir)
8490
ray.dir = normalize(dir)
8591
return nothing

src/Beam.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ mutable struct Beam{T, R <: AbstractRay{T}} <: AbstractBeam{T, R}
1616
children::Vector{Beam{T, R}}
1717
end
1818

19+
"""
20+
rays(beam::Beam)
21+
22+
Returns the vector of rays that make up the `beam`.
23+
"""
1924
rays(b::Beam) = b.rays
2025

26+
2127
Base.push!(b::Beam, ray::AbstractRay) = push!(b.rays, ray)
2228

2329
function Beam(ray::R) where {T, R <: AbstractRay{T}}

src/Config.jl

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,114 @@ using Preferences
99

1010
# --- Paraxial Invariants ---
1111
const 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+
"""
1217
get_invariant_threshold() = INVARIANT_THRESHOLD
1318

19+
1420
# --- SDF & Ray Marching ---
1521
const SDF_SURFACE_THRESHOLD = @load_preference("sdf_surface_threshold", 1e-9)
1622
const SDF_RAYMARCH_EPS = @load_preference("sdf_raymarch_eps", 1e-10)
1723
const 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+
"""
1930
get_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+
"""
2037
get_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+
"""
2144
get_sdf_inside_step() = SDF_INSIDE_STEP
2245

46+
2347
# --- Numerical Thresholds ---
2448
const INTERNAL_REFLECTION_THRESHOLD = @load_preference("internal_reflection_threshold", 1e-6)
2549
const LINE_PLANE_INTERSECTION_THRESHOLD = @load_preference("line_plane_intersection_threshold", 1e-6)
2650
const 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+
"""
2857
get_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+
"""
2964
get_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+
"""
3071
get_orthogonality_threshold() = ORTHOGONALITY_THRESHOLD
3172

73+
3274
# --- Tracing Defaults ---
3375
const DEFAULT_R_MAX = @load_preference("default_r_max", 100)
3476
const 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+
"""
3683
get_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+
"""
3790
get_default_depth_max() = DEFAULT_DEPTH_MAX
3891

92+
3993
# --- Physical Defaults ---
4094
const DEFAULT_WAVELENGTH = @load_preference("default_wavelength", 1e-6)
4195
const DEFAULT_WAIST = @load_preference("default_waist", 1e-3)
4296
const DEFAULT_POWER = @load_preference("default_power", 1e-3)
4397

98+
"""
99+
get_default_wavelength()
100+
101+
Returns the default wavelength in meters.
102+
"""
44103
get_default_wavelength() = DEFAULT_WAVELENGTH
104+
105+
"""
106+
get_default_waist()
107+
108+
Returns the default beam waist radius in meters.
109+
"""
45110
get_default_waist() = DEFAULT_WAIST
111+
112+
"""
113+
get_default_power()
114+
115+
Returns the default beam total power in Watts.
116+
"""
46117
get_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)
56128
end
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+
"""
59137
set_invariant_threshold!(val::Real) = set_preference!("invariant_threshold", Float64(val))
60138

139+
61140
end # module

src/OpticalComponents/NonInteractable.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ set_new_origin3d!(d::NonInteractableObject) = set_new_origin3d!(d.shape)
1919
intersect3d(::NonInteractableObject, ::AbstractRay) = nothing
2020
interact3d(::AbstractSystem, ::NonInteractableObject, ::AbstractBeam, ::AbstractRay) = nothing
2121

22+
"""
23+
MeshDummy(loadpath::String)
24+
25+
Creates a [`NonInteractableObject`](@ref) with a [`Mesh`](@ref) loaded from the specified file path.
26+
Useful for rendering background objects or geometry that does not interact with rays.
27+
"""
2228
MeshDummy(loadpath::String) = NonInteractableObject(Mesh(load(loadpath)))

0 commit comments

Comments
 (0)