otherSystems = {
const data = [];
tArray.map((t) => {
const light = originSystem.find((d) => (d.name === "light") & (d.t === t)),
grids = originSystem.filter((d) => d.type === "grid");
system_vs.map((z) => {
const system = originSystem.find(
(d) => (d.name === z.name) & (d.t === t)
),
translate = (x, t) => {
const newT = system.length,
newX = 0,
diffT = newT - system.t2,
diffX = newX - system.x2;
return { x: x + diffX, t: t + diffT };
};
{
const d1 = translate(system.x2, system.t2),
d2 = translate(light.x2, light.t2),
{ name, ratio } = system;
data.push({
x1: 0,
t1: 0,
x2: d1.x,
t2: d1.t,
t,
name,
type: "system",
ratio
});
data.push({
x1: 0,
t1: 0,
x2: d2.x - (correctOffset ? t * speedOfLight : 0),
t2: d2.t,
t,
name,
type: "light",
ratio
});
if (z.name === "system-v") {
const d4 = translate(-light.x2, light.t2);
data.push({
x1: 0,
t1: 0,
x2: d4.x - (correctOffset ? t * speedOfLight : 0),
t2: d4.t,
t,
name,
type: "light",
ratio
});
}
}
if (z.name === "system-v") {
grids.map((grid) => {
const d2 = translate(grid.x2, grid.t2),
ruleLight = data.filter(
(d) =>
(d.type === "light") & (d.name === "system-v") & (d.t === t)
),
{ name, ratio } = grid;
data.push({
x1: 0,
t1: 0,
x2: d2.x - (correctOffset ? t * speedOfLight : 0),
t2: d2.t,
t,
name,
type: "grid",
ratio
});
});
}
});
});
return data;
}