ensuring everything does not magically resize

This commit is contained in:
ari committed 2021-12-21 22:51:07 -05:00
1 parent 24f7c3c3af
commit dd74c400d4
2 files changed
+28 -4

No files matched your search

+19 -2
View File
@@ -5,10 +5,27 @@ export const offsetPoint = (
[ox, oy]: Point = [0, 0],
): Point => [x + ox, y + oy];
export const avgPoints = (
export const applyPoints = (
[x1, y1]: Point,
[x2, y2]: Point,
): Point => [(x1 + x2)/2, (y1 + y2)/2];
fun: (a: number, b: number) => number,
): Point => [fun(x1, x2), fun(y1, y2)];
export const avgPoints = (
p1: Point,
p2: Point,
): Point => applyPoints(p1, p2, (a,b) => (a+b)/2);
export const minPoints = (
p1: Point,
p2: Point,
): Point => applyPoints(p1, p2, Math.min);
export const maxPoints = (
p1: Point,
p2: Point,
): Point => applyPoints(p1, p2, Math.max);
export const makeOffsetMaintainer = (startPoint: Point) => {
let offset: Point = [0, 0];