Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 4x | import { Point } from "./interfaces";
export default function getPointsOnQuadraticCurve(
t: number,
x1: number,
y1: number,
x2: number,
y2: number,
xi: number,
yi: number
): Point {
// http://stackoverflow.com/a/5634528
const x = (1 - t) ** 2 * x1 + 2 * (1 - t) * t * xi + t ** 2 * x2;
const y = (1 - t) ** 2 * y1 + 2 * (1 - t) * t * yi + t ** 2 * y2;
return { x, y };
}
|