Oops... I had that function already...
This commit is contained in:
parent
53075e0906
commit
6c7c936ead
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user