@thi.ng/matrices
Version:
Matrix & quaternion operations for 2D/3D geometry processing
23 lines (22 loc) • 535 B
JavaScript
import { compile } from "@thi.ng/vectors/compile/emit";
import {
ARGS_VN,
ARGS_VV,
DEFAULT_OUT,
MATH,
MATH_N
} from "@thi.ng/vectors/compile/templates";
const DEFAULT_SIZES = [6, 9, 16];
const defMath = (fn, op, sizes = DEFAULT_SIZES) => sizes.map(
(n) => fn.add(
n,
compile(n, MATH(op), ARGS_VV, void 0, "o", "", DEFAULT_OUT)
)
);
const defMathN = (fn, op, sizes = DEFAULT_SIZES) => sizes.map(
(n) => fn.add(n, compile(n, MATH_N(op), ARGS_VN, "o,a", "o", "", DEFAULT_OUT))
);
export {
defMath,
defMathN
};