eulumdat-photweb
Photometric web representation, sampling, and 3D mesh generation for EULUMDAT/IES lighting data.
This crate extends the eulumdat library with advanced sampling and 3D visualization capabilities for photometric data.
Features
- Bilinear Interpolation: Sample intensity at any C-plane/gamma angle with smooth interpolation
- Symmetry Handling: Automatic expansion based on symmetry type (C0-C180, C90-C270, both planes, vertical axis)
- Normalized Sampling: Get intensity values normalized to 0.0-1.0 range
- 3D Mesh Generation: Generate LDC (Luminous Distribution Curve) solid meshes for 3D visualization
- Graphics-Ready Output: Flat arrays for positions, normals, and indices
Quick Start
use Eulumdat;
use PhotometricWeb;
// Load photometric data
let ldt = from_file?;
// Create a photometric web
let web = from;
// Sample intensity at any angle (with bilinear interpolation)
let intensity = web.sample; // C=45°, γ=30°
println!;
// Sample normalized (0.0 to 1.0, relative to max intensity)
let normalized = web.sample_normalized;
println!;
// Check symmetry and bounds
println!;
println!;
3D Mesh Generation
Generate photometric solids (LDC - Luminous Distribution Curve) for 3D visualization:
use Eulumdat;
use ;
let ldt = from_file?;
let web = from;
// Generate mesh with 5° C-plane steps, 5° gamma steps, scale=1.0
let mesh = web.generate_ldc_mesh;
println!;
println!;
// Get data for graphics APIs (OpenGL, WebGPU, etc.)
let positions: = mesh.positions_flat; // [x0, y0, z0, x1, y1, z1, ...]
let normals: = mesh.normals_flat; // [nx0, ny0, nz0, ...]
let indices: & = &mesh.indices; // Triangle indices
Coordinate System
The generated mesh uses a Y-up coordinate system:
- Y axis: Up (nadir at -Y, zenith at +Y)
- X-Z plane: Horizontal
- C=0°: Along +Z axis
- C=90°: Along +X axis
- γ=0°: Nadir (straight down, -Y)
- γ=90°: Horizontal (X-Z plane)
- γ=180°: Zenith (straight up, +Y)
Symmetry Support
The PhotometricWeb automatically handles all EULUMDAT symmetry types:
| Symmetry | Description | Stored C-planes |
|---|---|---|
None |
Full 360° data | 0°-360° |
VerticalAxis |
Rotationally symmetric | Single plane |
PlaneC0C180 |
Mirror across C0-C180 | 0°-180° |
PlaneC90C270 |
Mirror across C90-C270 | 90°-270° |
BothPlanes |
Quarter data | 0°-90° |
You can query any angle regardless of stored symmetry:
// Even with BothPlanes symmetry (only 0-90° stored),
// you can sample the full 360° range
let i_c0 = web.sample;
let i_c180 = web.sample;
let i_c270 = web.sample;
// These are automatically mirrored from stored data
Use Cases
- 3D Visualization: Generate meshes for SceneKit, Three.js, Babylon.js, etc.
- Lighting Simulation: Sample intensity at arbitrary angles for ray tracing
- Analysis Tools: Compute custom metrics by sampling the photometric distribution
- Export: Generate mesh data for CAD/BIM software
Integration Examples
With wgpu/WebGPU
let mesh = web.generate_ldc_mesh;
// Create vertex buffer
let vertex_data: = mesh.vertices
.iter
.flat_map
.collect;
// Create index buffer
let index_data: & = &mesh.indices;
With Three.js (via WASM)
const mesh = photweb.;
const geometry = ;
geometry.;
geometry.;
geometry.;
Related Crates
eulumdat- Core EULUMDAT/IES parsing libraryeulumdat-cli- Command-line tooleulumdat-wasm- WebAssembly bindings
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.