More writing for the math and browser APIs

This commit is contained in:
2024-12-11 19:56:39 -05:00
parent 192286a86a
commit 538cc2eb47
9 changed files with 138 additions and 102 deletions

View File

@ -1,5 +1,4 @@
import {Transform} from "./transform";
import {applyCoefs, Coefs} from "./coefs";
import {Transform, Coefs, applyCoefs} from "./transform";
import {blend, VariationBlend} from "./blend";
export const applyTransform = (coefs: Coefs, variations: VariationBlend): Transform =>

View File

@ -1,11 +0,0 @@
export interface Coefs {
a: number, b: number, c: number,
d: number, e: number, f: number
}
export function applyCoefs(x: number, y: number, coefs: Coefs): [number, number] {
return [
(x * coefs.a + y * coefs.b + coefs.c),
(x * coefs.d + y * coefs.e + coefs.f)
]
}

View File

@ -1 +1,13 @@
export type Transform = (x: number, y: number) => [number, number];
export type Transform = (x: number, y: number) => [number, number];
export interface Coefs {
a: number, b: number, c: number,
d: number, e: number, f: number
}
export function applyCoefs(x: number, y: number, coefs: Coefs): [number, number] {
return [
(x * coefs.a + y * coefs.b + coefs.c),
(x * coefs.d + y * coefs.e + coefs.f)
]
}