#[repr(C)]pub struct Spd {
pub samples: [f32; 41],
}Expand description
Spectral Power Distribution: radiant power at 41 wavelength samples (380–780 nm, 10 nm steps). POD, zero-heap, stack-allocated.
Manual Pod/Zeroable: bytemuck only auto-implements [f32; N] for N ≤ 32.
Fields§
§samples: [f32; 41]Power values at 380, 390, …, 780 nm.
Implementations§
Source§impl Spd
impl Spd
Sourcepub fn from_samples(samples: [f32; 41]) -> Self
pub fn from_samples(samples: [f32; 41]) -> Self
Create an SPD from a raw sample array.
Sourcepub fn flat(value: f32) -> Self
pub fn flat(value: f32) -> Self
Create a flat (equal-energy) SPD with all samples set to value.
Sourcepub fn delta(lambda_nm: f32) -> Self
pub fn delta(lambda_nm: f32) -> Self
Create a single-wavelength delta SPD: all power at the sample
closest to lambda_nm, zero elsewhere.
Sourcepub fn gaussian_peak(lambda_nm: f32, width_nm: f32, amplitude: f32) -> Self
pub fn gaussian_peak(lambda_nm: f32, width_nm: f32, amplitude: f32) -> Self
Create a Gaussian-peaked SPD centred at lambda_nm with width width_nm,
scaled by amplitude.
Sourcepub fn lerp(&self, other: &Self, t: f32) -> Self
pub fn lerp(&self, other: &Self, t: f32) -> Self
Linear interpolation: self * (1-t) + other * t.
Sourcepub fn total_power(&self) -> f32
pub fn total_power(&self) -> f32
Total power (sum of all samples).
Trait Implementations§
impl Copy for Spd
impl Pod for Spd
impl StructuralPartialEq for Spd
Auto Trait Implementations§
impl Freeze for Spd
impl RefUnwindSafe for Spd
impl Send for Spd
impl Sync for Spd
impl Unpin for Spd
impl UnsafeUnpin for Spd
impl UnwindSafe for Spd
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.