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) {
|
match self.which_subspace(loc.pos) {
|
||||||
Outer => loc,
|
Outer => loc,
|
||||||
Inner => {
|
Inner => {
|
||||||
let Vec2 { x, y } = loc.pos; // в основной СК
|
let Vec2 { x: u, y } = loc.pos; // в основной СК
|
||||||
let y = self.tube.u(y) + y.signum() * (self.tube.external_halflength - self.tube.internal_halflength);
|
let v = 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)]);
|
|
||||||
Location {
|
Location {
|
||||||
pos: vec2(x, y), // в плоском продолжении СК Outer на область Inner
|
pos: vec2(u, v), // в плоском продолжении СК Outer на область Inner
|
||||||
rot: m * loc.rot,
|
rot: self.global_to_flat(loc.pos) * loc.rot,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Boundary => panic!("Object at {} was destroyed by the space curvature", loc.pos),
|
Boundary => panic!("Object at {} was destroyed by the space curvature", loc.pos),
|
||||||
|
|
@ -240,10 +239,9 @@ impl Space {
|
||||||
match self.which_subspace(pos) {
|
match self.which_subspace(pos) {
|
||||||
Inner | Outer => {
|
Inner | Outer => {
|
||||||
// NB: не работает для частей Outer с |y| < external_halflength. Но они и не нужны.
|
// NB: не работает для частей Outer с |y| < external_halflength. Но они и не нужны.
|
||||||
let m = Mat2::from_cols_array(&[1., 0., 0., self.tube.du(pos.y)]);
|
|
||||||
Location {
|
Location {
|
||||||
pos: vec2(pos.x, self.tube.u(pos.y)), // в плоской СК для Inner или её продолжении на Outer
|
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),
|
Boundary => panic!("Object at {} was destroyed by the space curvature", pos),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user