Coatings implementation#57
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #57 +/- ##
==========================================
+ Coverage 73.46% 73.95% +0.49%
==========================================
Files 61 70 +9
Lines 3885 4891 +1006
==========================================
+ Hits 2854 3617 +763
- Misses 1031 1274 +243 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b50da79f50
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| λ, | ||
| from_front | ||
| ) where {T, R <: Ray{T}} | ||
| ndir_t, _ = refraction3d(direction(ray), normal, n_incident, n_transmitted) |
There was a problem hiding this comment.
Handle total internal reflection before splitting
When a splitting coating is hit from a higher-index medium above the critical angle, refraction3d returns the reflected direction with the TIR flag set, but this path discards the flag and still creates a transmitted child with n_transmitted and T_coeff. A coated glass-air boundary with behavior = Splitting() will therefore emit a bogus transmitted branch instead of reflecting all power, corrupting traced beam trees in TIR cases.
Useful? React with 👍 / 👎.
| zrotate3d!(coating, π) | ||
| return RectangularPlateBeamsplitter(substrate, coating) | ||
| M = typeof(coating.model) | ||
| return RectangularPlateBeamsplitter{typeof(width), M}(substrate, coating) |
There was a problem hiding this comment.
Use promoted dimension type for plate constructors
If callers pass integer dimensions for width while other dimensions or mesh construction promote to floating point, this explicitly instantiates RectangularPlateBeamsplitter{Int64,...} even though substrate and coating are Prism{Float64,...}/Coating{Float64,...}. For inputs like RectangularPlateBeamsplitter(10, 10, 0.2, n) the constructor will fail at runtime; let T be inferred or use promote_type(typeof(width), typeof(height), typeof(thickness)).
Useful? React with 👍 / 👎.
…em to improve intersection checking.
Abstract
This is a new attempt at coatings and is based on #55 as a prerequisite. It will also render #27 obsolete, as polarizing components can be handled using coatings which results in a much more flexible, modular and extensible API.
This should close #30.
Detailed description: Unified Coatings, Face Partitions, and Polarizing Optics
Overview
This PR implements a unified coatings and dynamic boundary physics pipeline in
BeamletOptics.jl. It standardizes boundary interactions (refraction, reflection, splitting) across rays and Gaussian/Astigmatic beamlets, modernizes polarizing components, and optimizes performance to achieve allocation-free tracing.Key Features
CoatingBehavior): Introduced traits (Transmissive,Reflective,Splitting) to cleanly dispatch boundary logic.Uncoated,SimpleARCoating,SimpleHRCoating,SimpleBeamsplitterCoating,JonesCoating, andThinFilmCoating(multi-layer characteristic matrix calculations).:front,:back,:hypotenuse), direction vectors, and spatial predicates to apply localized coatings.power_cutoffthreshold insolve_system!to prevent infinite loops.WaveplateandPolarizingBeamSplitter(plate & cube versions) to sit on top of the coating pipeline. Updated_calculate_global_E0to use correct 3D polarization projection mapping.