30 lines
871 B
JavaScript
30 lines
871 B
JavaScript
// Metro module 378 (f379).
|
|
export function fromOrigamiTensionAndFriction(a0, a1) {
|
|
return {
|
|
stiffness: 3.62 * (a0 - 30) + 194,
|
|
damping: 3 * (a1 - 8) + 25
|
|
};
|
|
}
|
|
export function fromBouncinessAndSpeed(a0, a1) {
|
|
let r1, r17, r34;
|
|
L7: {
|
|
r1 = a0 / 1.7;
|
|
r17 = 0.5 + (a1 / 1.7 - 0) / 20 * 199.5;
|
|
if (r17 <= 18) {
|
|
r34 = 0.0007 * Math.pow(r17, 3) - 0.031 * Math.pow(r17, 2) + 0.64 * r17 + 1.28;
|
|
} else {
|
|
if (18 < r17 && r17 <= 44) {
|
|
r34 = 0.000044 * Math.pow(r17, 3) - 0.006 * Math.pow(r17, 2) + 0.36 * r17 + 2;
|
|
break L7;
|
|
}
|
|
r34 = 4.5e-7 * Math.pow(r17, 3) - 0.000332 * Math.pow(r17, 2) + 0.1078 * r17 + 5.84;
|
|
}
|
|
}
|
|
const r73 = 0 + (r1 - 0) / 20 * 0.8;
|
|
const r77 = 2 * r73 - r73 * r73;
|
|
return {
|
|
stiffness: 3.62 * (r17 - 30) + 194,
|
|
damping: 3 * (r77 * 0.01 + (1 - r77) * r34 - 8) + 25
|
|
};
|
|
}
|