otherSystems = {
const data = [];
tArray.map((t) => {
system_vs.map((z) => {
const system = originSystem.find(
(d) => (d.name === z.name) & (d.t === t)
),
light = originSystem.find((d) => (d.name === "light") & (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
});
}
});
});
return data;
}