pub struct Eulumdat {Show 30 fields
pub identification: String,
pub type_indicator: TypeIndicator,
pub symmetry: Symmetry,
pub num_c_planes: usize,
pub c_plane_distance: f64,
pub num_g_planes: usize,
pub g_plane_distance: f64,
pub measurement_report_number: String,
pub luminaire_name: String,
pub luminaire_number: String,
pub file_name: String,
pub date_user: String,
pub length: f64,
pub width: f64,
pub height: f64,
pub luminous_area_length: f64,
pub luminous_area_width: f64,
pub height_c0: f64,
pub height_c90: f64,
pub height_c180: f64,
pub height_c270: f64,
pub downward_flux_fraction: f64,
pub light_output_ratio: f64,
pub conversion_factor: f64,
pub tilt_angle: f64,
pub lamp_sets: Vec<LampSet>,
pub direct_ratios: [f64; 10],
pub c_angles: Vec<f64>,
pub g_angles: Vec<f64>,
pub intensities: Vec<Vec<f64>>,
}Expand description
Main Eulumdat data structure.
This struct contains all data from an Eulumdat (LDT) file. The structure follows the official Eulumdat specification.
Fields§
§identification: StringIdentification string (line 1).
type_indicator: TypeIndicatorType indicator (1-3).
symmetry: SymmetrySymmetry indicator (0-4).
num_c_planes: usizeNumber of C-planes between 0° and 360° (Nc, 0-721).
c_plane_distance: f64Distance between C-planes in degrees (Dc).
num_g_planes: usizeNumber of gamma/G-planes between 0° and 180° (Ng, 0-361).
g_plane_distance: f64Distance between G-planes in degrees (Dg).
measurement_report_number: StringMeasurement report number.
luminaire_name: StringLuminaire name.
luminaire_number: StringLuminaire number.
file_name: StringFile name.
date_user: StringDate/user field.
length: f64Length/diameter of luminaire (L).
width: f64Width of luminaire (B), 0 for circular.
height: f64Height of luminaire (H).
luminous_area_length: f64Length/diameter of luminous area (La).
luminous_area_width: f64Width of luminous area (B1), 0 for circular.
height_c0: f64Height of luminous area at C0 plane (HC0).
height_c90: f64Height of luminous area at C90 plane (HC90).
height_c180: f64Height of luminous area at C180 plane (HC180).
height_c270: f64Height of luminous area at C270 plane (HC270).
downward_flux_fraction: f64Downward flux fraction (DFF) in percent.
light_output_ratio: f64Light output ratio of luminaire (LORL) in percent.
conversion_factor: f64Conversion factor for luminous intensities (CFLI).
tilt_angle: f64Tilt angle during measurement in degrees.
lamp_sets: Vec<LampSet>Lamp sets (1-20).
direct_ratios: [f64; 10]Direct ratios for room indices k = 0.60, 0.80, 1.00, 1.25, 1.50, 2.00, 2.50, 3.00, 4.00, 5.00
c_angles: Vec<f64>C-plane angles in degrees.
g_angles: Vec<f64>G-plane (gamma) angles in degrees.
intensities: Vec<Vec<f64>>Luminous intensity distribution in cd/klm.
Indexed as intensities[c_plane_index][g_plane_index].
Implementations§
Source§impl Eulumdat
impl Eulumdat
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
Load from a file path.
Automatically handles both UTF-8 and ISO-8859-1 (Latin-1) encoded files. This is necessary because many LDT files from Windows-based tools use ISO-8859-1 encoding.
Sourcepub fn validate(&self) -> Vec<ValidationWarning>
pub fn validate(&self) -> Vec<ValidationWarning>
Validate the data and return any warnings.
Sourcepub fn validate_strict(&self) -> Result<(), Vec<ValidationError>>
pub fn validate_strict(&self) -> Result<(), Vec<ValidationError>>
Validate strictly and return errors if validation fails.
Sourcepub fn actual_c_planes(&self) -> usize
pub fn actual_c_planes(&self) -> usize
Get the actual number of C-planes based on symmetry (Mc).
Sourcepub fn total_luminous_flux(&self) -> f64
pub fn total_luminous_flux(&self) -> f64
Get total luminous flux from all lamp sets.
Sourcepub fn total_wattage(&self) -> f64
pub fn total_wattage(&self) -> f64
Get total wattage from all lamp sets.
Sourcepub fn luminous_efficacy(&self) -> f64
pub fn luminous_efficacy(&self) -> f64
Get luminous efficacy in lm/W.
Sourcepub fn get_intensity(&self, c_index: usize, g_index: usize) -> Option<f64>
pub fn get_intensity(&self, c_index: usize, g_index: usize) -> Option<f64>
Get intensity at a specific C and G angle.
Returns None if the indices are out of bounds.
Sourcepub fn max_intensity(&self) -> f64
pub fn max_intensity(&self) -> f64
Get the maximum intensity value.
Sourcepub fn min_intensity(&self) -> f64
pub fn min_intensity(&self) -> f64
Get the minimum intensity value.
Sourcepub fn avg_intensity(&self) -> f64
pub fn avg_intensity(&self) -> f64
Get the average intensity value.
Sourcepub fn rotate_c_planes(&mut self, degrees: f64)
pub fn rotate_c_planes(&mut self, degrees: f64)
Rotate the C-plane data by the given number of degrees.
This is useful when different manufacturers mount luminaires differently on goniophotometers, so C0 may point along the length or width axis.
The method:
- Expands symmetric data to full 360°
- Resamples all intensities at shifted C-angles
- Sets symmetry to None (full data)
- For exact 90° multiples, rotates height_c0/c90/c180/c270 and swaps length/width
§Arguments
degrees- Rotation angle in degrees (positive = counter-clockwise when viewed from above)
Sourcepub fn sample(&self, c_angle: f64, g_angle: f64) -> f64
pub fn sample(&self, c_angle: f64, g_angle: f64) -> f64
Sample intensity at any C and G angle using bilinear interpolation.
This is the key method for generating beam meshes and smooth geometry. It handles symmetry automatically and interpolates between stored data points.
§Arguments
c_angle- C-plane angle in degrees (0-360, will be normalized)g_angle- Gamma angle in degrees (0-180, will be clamped)
§Returns
Interpolated intensity value in cd/klm
§Example
use eulumdat::Eulumdat;
let ldt = Eulumdat::from_file("luminaire.ldt")?;
// Sample at exact stored angles
let intensity = ldt.sample(0.0, 45.0);
// Sample at arbitrary angles (will interpolate)
let intensity = ldt.sample(22.5, 67.5);
// Generate smooth beam mesh at 5° intervals
for c in (0..360).step_by(5) {
for g in (0..=180).step_by(5) {
let intensity = ldt.sample(c as f64, g as f64);
// Use intensity for mesh generation...
}
}