Make dispiro results cachable

This commit is contained in:
be5invis 2021-07-11 18:30:29 -07:00
parent f892a56532
commit 7bf55f2682
6 changed files with 211 additions and 73 deletions

View file

@ -0,0 +1,29 @@
"use strict";
function struct(leader, ...items) {
return "" + leader + "(" + items.join(";") + ")";
}
function tuple(...items) {
return "(" + items.join(";") + ")";
}
function list(items) {
return "{" + items.join(";") + "}";
}
function n(x) {
return String(Math.round(x * 0x10000));
}
function typedPoint(z) {
return tuple(z.type, n(z.x), n(z.y));
}
function gizmo(g) {
return tuple(n(g.xx), n(g.xy), n(g.yx), n(g.yy), n(g.x), n(g.y));
}
exports.struct = struct;
exports.tuple = tuple;
exports.list = list;
exports.n = n;
exports.typedPoint = typedPoint;
exports.gizmo = gizmo;