eulumdat_goniosim/lib.rs
1//! eulumdat-goniosim — CPU Monte Carlo photon tracer for virtual goniophotometry.
2//!
3//! Pure Rust crate for tracing photons through luminaire geometry and collecting
4//! them on a virtual goniophotometer sphere. This is the **reference implementation**
5//! that produces numerically correct results. Any future GPU tracer must validate
6//! against it.
7//!
8//! # Two-Layer Material System
9//!
10//! Users work with [`MaterialParams`] using manufacturer datasheet values
11//! (reflectance %, IOR, transmittance %, thickness, diffusion %).
12//! The tracer converts them to internal physics representations automatically.
13//!
14//! # Example
15//!
16//! ```rust,no_run
17//! use eulumdat_goniosim::*;
18//!
19//! // Build a scene: LED + white housing + opal PMMA cover
20//! let scene = SceneBuilder::new()
21//! .source(Source::Led {
22//! position: nalgebra::Point3::origin(),
23//! direction: nalgebra::Unit::new_unchecked(
24//! nalgebra::Vector3::new(0.0, 0.0, -1.0),
25//! ),
26//! half_angle_deg: 60.0,
27//! flux_lm: 1000.0,
28//! })
29//! .reflector(catalog::white_paint(), ReflectorPlacement {
30//! distance_mm: 25.0,
31//! length_mm: 50.0,
32//! side: ReflectorSide::Surround,
33//! })
34//! .cover(catalog::opal_pmma_3mm(), CoverPlacement {
35//! distance_mm: 40.0,
36//! width_mm: 60.0,
37//! height_mm: 60.0,
38//! })
39//! .build();
40//!
41//! // Trace 1M photons
42//! let config = TracerConfig {
43//! num_photons: 1_000_000,
44//! ..TracerConfig::default()
45//! };
46//! let result = Tracer::trace(&scene, &config);
47//!
48//! // Export to EULUMDAT
49//! let ldt = detector_to_eulumdat(
50//! &result.detector,
51//! 1000.0,
52//! &ExportConfig::default(),
53//! );
54//! let ldt_string = ldt.to_ldt();
55//! ```
56
57pub mod catalog;
58pub mod detector;
59pub mod export;
60pub mod geometry;
61pub mod material;
62pub mod ray;
63pub mod scene;
64pub mod source;
65pub mod tracer;
66
67/// Material index type.
68pub type MaterialId = usize;
69
70// Re-export dependencies for downstream crates (e.g. eulumdat-wasm)
71pub use nalgebra;
72pub use rand;
73pub use rand_xoshiro;
74
75// Re-exports for convenience
76pub use catalog::material_catalog;
77pub use detector::Detector;
78pub use export::{
79 detector_to_eulumdat, detector_to_eulumdat_at_angles, detector_to_eulumdat_with_lamp_flux,
80 ExportConfig,
81};
82pub use geometry::{Primitive, SceneObject};
83pub use material::{Interaction, Material, MaterialParams};
84pub use ray::{HitRecord, Photon, Ray};
85pub use scene::{
86 bare_isotropic, bare_lambertian, led_housing_with_cover, led_with_housing,
87 roundtrip_validation, CoverPlacement, ReflectorPlacement, ReflectorSide, Scene, SceneBuilder,
88};
89pub use source::Source;
90pub use tracer::{
91 PhotonTrail, ProgressInfo, Tracer, TracerConfig, TracerResult, TracerStats, TrailEvent,
92 TrailPoint,
93};