From 090b1ca09af3c211f7175160c00ac77a24895094 Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 12 Aug 2022 00:37:39 -0700 Subject: [PATCH] BUGFIX: Torus: don't `norm`alize the cross section normal this would have led to incorrectly scaled current measurements (but not incorrect current generation). we were likely severely over-estimating the current. --- crates/coremem/src/geom/region/mod.rs | 2 +- crates/coremem/src/geom/region/primitives.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/coremem/src/geom/region/mod.rs b/crates/coremem/src/geom/region/mod.rs index 74b99b2..719de46 100644 --- a/crates/coremem/src/geom/region/mod.rs +++ b/crates/coremem/src/geom/region/mod.rs @@ -20,7 +20,7 @@ dyn_clone::clone_trait_object!(Region); /// some (volume) which has a tangent vector everywhere inside/on it. /// for example, a cylinder has tangents everywhere except its axis. -/// the return vector should be normalized, or zero. +/// the returned vector should represent the area of the cross section. pub trait HasCrossSection { fn cross_section_normal(&self, p: Meters) -> Vec3; } diff --git a/crates/coremem/src/geom/region/primitives.rs b/crates/coremem/src/geom/region/primitives.rs index ae79c0b..b1fe309 100644 --- a/crates/coremem/src/geom/region/primitives.rs +++ b/crates/coremem/src/geom/region/primitives.rs @@ -109,7 +109,7 @@ impl HasCrossSection for Torus { let axis = self.axis(); let to_coord = *coord - *self.center(); // this creates a normal which always points "counter-clockwise" along the shape - axis.cross(to_coord).norm() + axis.cross(to_coord) } }