Skip to main content

Eulumdat

Struct Eulumdat 

Source
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: String

Identification string (line 1).

§type_indicator: TypeIndicator

Type indicator (1-3).

§symmetry: Symmetry

Symmetry indicator (0-4).

§num_c_planes: usize

Number of C-planes between 0° and 360° (Nc, 0-721).

§c_plane_distance: f64

Distance between C-planes in degrees (Dc).

§num_g_planes: usize

Number of gamma/G-planes between 0° and 180° (Ng, 0-361).

§g_plane_distance: f64

Distance between G-planes in degrees (Dg).

§measurement_report_number: String

Measurement report number.

§luminaire_name: String

Luminaire name.

§luminaire_number: String

Luminaire number.

§file_name: String

File name.

§date_user: String

Date/user field.

§length: f64

Length/diameter of luminaire (L).

§width: f64

Width of luminaire (B), 0 for circular.

§height: f64

Height of luminaire (H).

§luminous_area_length: f64

Length/diameter of luminous area (La).

§luminous_area_width: f64

Width of luminous area (B1), 0 for circular.

§height_c0: f64

Height of luminous area at C0 plane (HC0).

§height_c90: f64

Height of luminous area at C90 plane (HC90).

§height_c180: f64

Height of luminous area at C180 plane (HC180).

§height_c270: f64

Height of luminous area at C270 plane (HC270).

§downward_flux_fraction: f64

Downward flux fraction (DFF) in percent.

§light_output_ratio: f64

Light output ratio of luminaire (LORL) in percent.

§conversion_factor: f64

Conversion factor for luminous intensities (CFLI).

§tilt_angle: f64

Tilt 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

Source

pub fn new() -> Self

Create a new empty Eulumdat structure.

Source

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.

Source

pub fn parse(content: &str) -> Result<Self>

Parse from a string.

Source

pub fn save(&self, path: impl AsRef<Path>) -> Result<()>

Save to a file path.

Source

pub fn to_ldt(&self) -> String

Convert to LDT format string.

Source

pub fn validate(&self) -> Vec<ValidationWarning>

Validate the data and return any warnings.

Source

pub fn validate_strict(&self) -> Result<(), Vec<ValidationError>>

Validate strictly and return errors if validation fails.

Source

pub fn actual_c_planes(&self) -> usize

Get the actual number of C-planes based on symmetry (Mc).

Source

pub fn total_luminous_flux(&self) -> f64

Get total luminous flux from all lamp sets.

Source

pub fn total_wattage(&self) -> f64

Get total wattage from all lamp sets.

Source

pub fn luminous_efficacy(&self) -> f64

Get luminous efficacy in lm/W.

Source

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.

Source

pub fn max_intensity(&self) -> f64

Get the maximum intensity value.

Source

pub fn min_intensity(&self) -> f64

Get the minimum intensity value.

Source

pub fn avg_intensity(&self) -> f64

Get the average intensity value.

Source

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...
    }
}

Trait Implementations§

Source§

impl Clone for Eulumdat

Source§

fn clone(&self) -> Eulumdat

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Eulumdat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Eulumdat

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Eulumdat

Source§

fn eq(&self, other: &Eulumdat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Eulumdat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.