30 lines
854 B
Rust
30 lines
854 B
Rust
use crate::support::Optional;
|
|
use coremem_types::mat::{Material, MBPgram, MHPgram};
|
|
use coremem_types::vec::Vec3;
|
|
|
|
|
|
#[derive(Copy, Clone, Default, PartialEq)]
|
|
pub struct FullyGenericMaterial {
|
|
pub conductivity: Vec3<f32>,
|
|
pub m_b_curve: Optional<MBPgram<f32>>,
|
|
pub m_h_curve: Optional<MHPgram<f32>>,
|
|
}
|
|
|
|
impl Material<f32> for FullyGenericMaterial {
|
|
fn conductivity(&self) -> Vec3<f32> {
|
|
self.conductivity
|
|
}
|
|
fn move_b_vec(&self, m: Vec3<f32>, target_b: Vec3<f32>) -> Vec3<f32> {
|
|
if self.m_b_curve.is_some() {
|
|
self.m_b_curve.unwrap().move_b_vec(m, target_b)
|
|
} else if self.m_h_curve.is_some() {
|
|
self.m_h_curve.unwrap().move_b_vec(m, target_b)
|
|
} else {
|
|
Default::default()
|
|
}
|
|
}
|
|
}
|
|
|
|
pub type IsoConductorOr<M> = coremem_types::mat::IsoConductorOr<f32, M>;
|
|
|