From 6c7c936ead8abb4834e6fdab69e4f367c4433f06 Mon Sep 17 00:00:00 2001 From: numzero Date: Tue, 11 Jun 2024 13:50:02 +0300 Subject: [PATCH] Oops... I had that function already... --- src/bin/flat/main.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/bin/flat/main.rs b/src/bin/flat/main.rs index 8c40109..17ff4f2 100644 --- a/src/bin/flat/main.rs +++ b/src/bin/flat/main.rs @@ -223,12 +223,11 @@ impl Space { match self.which_subspace(loc.pos) { Outer => loc, Inner => { - let Vec2 { x, y } = loc.pos; // в основной СК - let y = self.tube.u(y) + y.signum() * (self.tube.external_halflength - self.tube.internal_halflength); - let m = Mat2::from_cols_array(&[1., 0., 0., self.tube.du(y)]); + let Vec2 { x: u, y } = loc.pos; // в основной СК + let v = self.tube.u(y) + y.signum() * (self.tube.external_halflength - self.tube.internal_halflength); Location { - pos: vec2(x, y), // в плоском продолжении СК Outer на область Inner - rot: m * loc.rot, + pos: vec2(u, v), // в плоском продолжении СК Outer на область Inner + rot: self.global_to_flat(loc.pos) * loc.rot, } } Boundary => panic!("Object at {} was destroyed by the space curvature", loc.pos), @@ -240,10 +239,9 @@ impl Space { match self.which_subspace(pos) { Inner | Outer => { // NB: не работает для частей Outer с |y| < external_halflength. Но они и не нужны. - let m = Mat2::from_cols_array(&[1., 0., 0., self.tube.du(pos.y)]); Location { pos: vec2(pos.x, self.tube.u(pos.y)), // в плоской СК для Inner или её продолжении на Outer - rot: m * rot, + rot: self.global_to_flat(pos) * rot, } } Boundary => panic!("Object at {} was destroyed by the space curvature", pos),