diff --git a/crates/coremem/src/stim.rs b/crates/coremem/src/stim.rs index 4b18cb8..8b41010 100644 --- a/crates/coremem/src/stim.rs +++ b/crates/coremem/src/stim.rs @@ -1,6 +1,6 @@ use crate::real::*; use crate::cross::vec::Vec3; -use crate::geom::{Meters, Region, Torus}; +use crate::geom::{HasCrossSection as _, Meters, Region, Torus}; use rand; /// field densities @@ -162,12 +162,8 @@ impl CurlStimulus { impl AbstractStimulus for CurlStimulus { fn at(&self, t_sec: f32, pos: Meters) -> Fields { if self.region.contains(pos) { - let center = self.region.center(); - let axis = self.region.axis(); let FieldMags { e, h } = self.stim.at(t_sec); - let from_center_to_point = *pos - *center; - // TODO: is this inverted? - let rotational = from_center_to_point.cross(*axis); + let rotational = self.region.cross_section_normal(pos).norm(); let impulse_e = rotational.with_mag(e.cast()).unwrap_or_default(); let impulse_h = rotational.with_mag(h.cast()).unwrap_or_default(); Fields {