timing-object
Version:
An implementation of the timing object specification.
27 lines • 829 B
JavaScript
export const createCalculatePositiveRealSolution = (calculateRealSolutions) => {
return ({ acceleration, position, velocity }, x) => {
const results = calculateRealSolutions(position, velocity, acceleration, x);
if (results.length === 0) {
return null;
}
if (results.length === 1) {
if (results[0] > 0) {
return results[0];
}
return null;
}
if (results.length === 2) {
if (results[1] < 0) {
return null;
}
if (results[0] > 0) {
return results[0];
}
if (results[1] > 0) {
return results[1];
}
}
return null;
};
};
//# sourceMappingURL=calculate-positive-real-solution.js.map