@maplat/transform
Version:
A JavaScript library that performs coordinate transformation between two plane coordinate systems using transformation definitions generated by Maplat.
617 lines (616 loc) • 22.9 kB
JavaScript
var ot = Object.defineProperty;
var at = (e, t, s) => t in e ? ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var _ = (e, t, s) => at(e, typeof t != "symbol" ? t + "" : t, s);
const R = 11102230246251565e-32, I = 134217729, ft = (3 + 8 * R) * R;
function V(e, t, s, r, a) {
let n, c, d, g, l = t[0], y = r[0], o = 0, u = 0;
y > l == y > -l ? (n = l, l = t[++o]) : (n = y, y = r[++u]);
let b = 0;
if (o < e && u < s)
for (y > l == y > -l ? (c = l + n, d = n - (c - l), l = t[++o]) : (c = y + n, d = n - (c - y), y = r[++u]), n = c, d !== 0 && (a[b++] = d); o < e && u < s; )
y > l == y > -l ? (c = n + l, g = c - n, d = n - (c - g) + (l - g), l = t[++o]) : (c = n + y, g = c - n, d = n - (c - g) + (y - g), y = r[++u]), n = c, d !== 0 && (a[b++] = d);
for (; o < e; )
c = n + l, g = c - n, d = n - (c - g) + (l - g), l = t[++o], n = c, d !== 0 && (a[b++] = d);
for (; u < s; )
c = n + y, g = c - n, d = n - (c - g) + (y - g), y = r[++u], n = c, d !== 0 && (a[b++] = d);
return (n !== 0 || b === 0) && (a[b++] = n), b;
}
function ct(e, t) {
let s = t[0];
for (let r = 1; r < e; r++) s += t[r];
return s;
}
function $(e) {
return new Float64Array(e);
}
const ut = (3 + 16 * R) * R, ht = (2 + 12 * R) * R, gt = (9 + 64 * R) * R * R, F = $(4), q = $(8), L = $(12), G = $(16), P = $(4);
function dt(e, t, s, r, a, n, c) {
let d, g, l, y, o, u, b, x, h, f, i, w, A, v, E, m, M, T;
const S = e - a, p = s - a, k = t - n, N = r - n;
v = S * N, u = I * S, b = u - (u - S), x = S - b, u = I * N, h = u - (u - N), f = N - h, E = x * f - (v - b * h - x * h - b * f), m = k * p, u = I * k, b = u - (u - k), x = k - b, u = I * p, h = u - (u - p), f = p - h, M = x * f - (m - b * h - x * h - b * f), i = E - M, o = E - i, F[0] = E - (i + o) + (o - M), w = v + i, o = w - v, A = v - (w - o) + (i - o), i = A - m, o = A - i, F[1] = A - (i + o) + (o - m), T = w + i, o = T - w, F[2] = w - (T - o) + (i - o), F[3] = T;
let U = ct(4, F), X = ht * c;
if (U >= X || -U >= X || (o = e - S, d = e - (S + o) + (o - a), o = s - p, l = s - (p + o) + (o - a), o = t - k, g = t - (k + o) + (o - n), o = r - N, y = r - (N + o) + (o - n), d === 0 && g === 0 && l === 0 && y === 0) || (X = gt * c + ft * Math.abs(U), U += S * y + N * d - (k * l + p * g), U >= X || -U >= X)) return U;
v = d * N, u = I * d, b = u - (u - d), x = d - b, u = I * N, h = u - (u - N), f = N - h, E = x * f - (v - b * h - x * h - b * f), m = g * p, u = I * g, b = u - (u - g), x = g - b, u = I * p, h = u - (u - p), f = p - h, M = x * f - (m - b * h - x * h - b * f), i = E - M, o = E - i, P[0] = E - (i + o) + (o - M), w = v + i, o = w - v, A = v - (w - o) + (i - o), i = A - m, o = A - i, P[1] = A - (i + o) + (o - m), T = w + i, o = T - w, P[2] = w - (T - o) + (i - o), P[3] = T;
const st = V(4, F, 4, P, q);
v = S * y, u = I * S, b = u - (u - S), x = S - b, u = I * y, h = u - (u - y), f = y - h, E = x * f - (v - b * h - x * h - b * f), m = k * l, u = I * k, b = u - (u - k), x = k - b, u = I * l, h = u - (u - l), f = l - h, M = x * f - (m - b * h - x * h - b * f), i = E - M, o = E - i, P[0] = E - (i + o) + (o - M), w = v + i, o = w - v, A = v - (w - o) + (i - o), i = A - m, o = A - i, P[1] = A - (i + o) + (o - m), T = w + i, o = T - w, P[2] = w - (T - o) + (i - o), P[3] = T;
const nt = V(st, q, 4, P, L);
v = d * y, u = I * d, b = u - (u - d), x = d - b, u = I * y, h = u - (u - y), f = y - h, E = x * f - (v - b * h - x * h - b * f), m = g * l, u = I * g, b = u - (u - g), x = g - b, u = I * l, h = u - (u - l), f = l - h, M = x * f - (m - b * h - x * h - b * f), i = E - M, o = E - i, P[0] = E - (i + o) + (o - M), w = v + i, o = w - v, A = v - (w - o) + (i - o), i = A - m, o = A - i, P[1] = A - (i + o) + (o - m), T = w + i, o = T - w, P[2] = w - (T - o) + (i - o), P[3] = T;
const it = V(nt, L, 4, P, G);
return G[it - 1];
}
function lt(e, t, s, r, a, n) {
const c = (t - n) * (s - a), d = (e - a) * (r - n), g = c - d, l = Math.abs(c + d);
return Math.abs(g) >= ut * l ? g : -dt(e, t, s, r, a, n, l);
}
function yt(e, t) {
var s, r, a = 0, n, c, d, g, l, y, o, u = e[0], b = e[1], x = t.length;
for (s = 0; s < x; s++) {
r = 0;
var h = t[s], f = h.length - 1;
if (y = h[0], y[0] !== h[f][0] && y[1] !== h[f][1])
throw new Error("First and last coordinates in a ring must be the same");
for (c = y[0] - u, d = y[1] - b, r; r < f; r++) {
if (o = h[r + 1], g = o[0] - u, l = o[1] - b, d === 0 && l === 0) {
if (g <= 0 && c >= 0 || c <= 0 && g >= 0)
return 0;
} else if (l >= 0 && d <= 0 || l <= 0 && d >= 0) {
if (n = lt(c, g, d, l, 0, 0), n === 0)
return 0;
(n > 0 && l > 0 && d <= 0 || n < 0 && l <= 0 && d > 0) && a++;
}
y = o, d = l, c = g;
}
}
return a % 2 !== 0;
}
function Z(e, t, s = {}) {
const r = { type: "Feature" };
return (s.id === 0 || s.id) && (r.id = s.id), s.bbox && (r.bbox = s.bbox), r.properties = t || {}, r.geometry = e, r;
}
function Y(e, t, s = {}) {
if (!e)
throw new Error("coordinates is required");
if (!Array.isArray(e))
throw new Error("coordinates must be an Array");
if (e.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!j(e[0]) || !j(e[1]))
throw new Error("coordinates must contain numbers");
return Z({
type: "Point",
coordinates: e
}, t, s);
}
function tt(e, t, s = {}) {
for (const a of e) {
if (a.length < 4)
throw new Error(
"Each LinearRing of a Polygon must have 4 or more Positions."
);
if (a[a.length - 1].length !== a[0].length)
throw new Error("First and last Position are not equivalent.");
for (let n = 0; n < a[a.length - 1].length; n++)
if (a[a.length - 1][n] !== a[0][n])
throw new Error("First and last Position are not equivalent.");
}
return Z({
type: "Polygon",
coordinates: e
}, t, s);
}
function B(e, t = {}) {
const s = { type: "FeatureCollection" };
return t.id && (s.id = t.id), t.bbox && (s.bbox = t.bbox), s.features = e, s;
}
function j(e) {
return !isNaN(e) && e !== null && !Array.isArray(e);
}
function bt(e) {
if (!e)
throw new Error("coord is required");
if (!Array.isArray(e)) {
if (e.type === "Feature" && e.geometry !== null && e.geometry.type === "Point")
return [...e.geometry.coordinates];
if (e.type === "Point")
return [...e.coordinates];
}
if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1]))
return [...e];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function J(e) {
if (Array.isArray(e))
return e;
if (e.type === "Feature") {
if (e.geometry !== null)
return e.geometry.coordinates;
} else if (e.coordinates)
return e.coordinates;
throw new Error(
"coords must be GeoJSON Feature, Geometry Object or an Array"
);
}
function wt(e) {
return e.type === "Feature" ? e.geometry : e;
}
function mt(e, t, s = {}) {
if (!e)
throw new Error("point is required");
if (!t)
throw new Error("polygon is required");
const r = bt(e), a = wt(t), n = a.type, c = t.bbox;
let d = a.coordinates;
if (c && xt(r, c) === !1)
return !1;
n === "Polygon" && (d = [d]);
let g = !1;
for (var l = 0; l < d.length; ++l) {
const y = yt(r, d[l]);
if (y === 0) return !s.ignoreBoundary;
y && (g = !0);
}
return g;
}
function xt(e, t) {
return t[0] <= e[0] && t[1] <= e[1] && t[2] >= e[0] && t[3] >= e[1];
}
var D = mt;
function Tt(e) {
const t = e.features;
for (let s = 0; s < t.length; s++) {
const r = t[s];
`${r.properties.a.index}`.substring(0, 1) === "b" && `${r.properties.b.index}`.substring(0, 1) === "b" ? t[s] = {
geometry: {
type: "Polygon",
coordinates: [
[
r.geometry.coordinates[0][2],
r.geometry.coordinates[0][0],
r.geometry.coordinates[0][1],
r.geometry.coordinates[0][2]
]
]
},
properties: {
a: {
geom: r.properties.c.geom,
index: r.properties.c.index
},
b: {
geom: r.properties.a.geom,
index: r.properties.a.index
},
c: {
geom: r.properties.b.geom,
index: r.properties.b.index
}
},
type: "Feature"
} : `${r.properties.c.index}`.substring(0, 1) === "b" && `${r.properties.a.index}`.substring(0, 1) === "b" && (t[s] = {
geometry: {
type: "Polygon",
coordinates: [
[
r.geometry.coordinates[0][1],
r.geometry.coordinates[0][2],
r.geometry.coordinates[0][0],
r.geometry.coordinates[0][1]
]
]
},
properties: {
a: {
geom: r.properties.b.geom,
index: r.properties.b.index
},
b: {
geom: r.properties.c.geom,
index: r.properties.c.index
},
c: {
geom: r.properties.a.geom,
index: r.properties.a.index
}
},
type: "Feature"
});
}
return e;
}
function It(e) {
const t = ["a", "b", "c", "a"].map(
(n) => e.properties[n].geom
), s = e.geometry.coordinates[0], r = e.properties, a = {
a: { geom: s[0], index: r.a.index },
b: { geom: s[1], index: r.b.index },
c: { geom: s[2], index: r.c.index }
};
return tt([t], a);
}
function _t(e) {
const t = [0, 1, 2, 0].map((r) => e[r][0][0]), s = {
a: { geom: e[0][0][1], index: e[0][1] },
b: { geom: e[1][0][1], index: e[1][1] },
c: { geom: e[2][0][1], index: e[2][1] }
};
return tt([t], s);
}
function W(e, t, s, r, a, n = !1, c) {
const d = e.map(
(g) => {
(!c || c < 2.00703) && (g = et(g));
const l = isFinite(g) ? t[g] : g === "c" ? r : g === "b0" ? a[0] : g === "b1" ? a[1] : g === "b2" ? a[2] : g === "b3" ? a[3] : function() {
const y = g.match(/e(\d+)/);
if (y) {
const o = parseInt(y[1]);
return s[o];
}
throw "Bad index value for indexesToTri";
}();
return n ? [[l[1], l[0]], g] : [[l[0], l[1]], g];
}
);
return _t(d);
}
function et(e) {
return typeof e == "number" ? e : e.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/, "$1$2");
}
function At(e, t) {
return t && t >= 2.00703 || Array.isArray(e[0]) ? e : e.map((s) => [
s.illstNodes,
s.mercNodes,
s.startEnd
]);
}
function z(e, t) {
for (let s = 0; s < t.features.length; s++)
if (D(e, t.features[s]))
return t.features[s];
}
function rt(e, t, s) {
const r = t.geometry.coordinates[0][0], a = t.geometry.coordinates[0][1], n = t.geometry.coordinates[0][2], c = e.geometry.coordinates, d = t.properties.a.geom, g = t.properties.b.geom, l = t.properties.c.geom, y = [a[0] - r[0], a[1] - r[1]], o = [n[0] - r[0], n[1] - r[1]], u = [c[0] - r[0], c[1] - r[1]], b = [g[0] - d[0], g[1] - d[1]], x = [l[0] - d[0], l[1] - d[1]];
let h = (o[1] * u[0] - o[0] * u[1]) / (y[0] * o[1] - y[1] * o[0]), f = (y[0] * u[1] - y[1] * u[0]) / (y[0] * o[1] - y[1] * o[0]);
if (s) {
const i = s[t.properties.a.index], w = s[t.properties.b.index], A = s[t.properties.c.index];
let v;
if (h < 0 || f < 0 || 1 - h - f < 0) {
const E = h / (h + f), m = f / (h + f);
v = h / w / (E / w + m / A), f = f / A / (E / w + m / A);
} else
v = h / w / (h / w + f / A + (1 - h - f) / i), f = f / A / (h / w + f / A + (1 - h - f) / i);
h = v;
}
return [
h * b[0] + f * x[0] + d[0],
h * b[1] + f * x[1] + d[1]
];
}
function vt(e, t, s, r) {
const a = e.geometry.coordinates, n = s.geometry.coordinates, c = Math.atan2(a[0] - n[0], a[1] - n[1]), d = Et(c, t[0]);
if (d === void 0)
throw new Error("Unable to determine vertex index");
const g = t[1][d];
return rt(e, g.features[0], r);
}
function Mt(e, t, s, r, a, n, c, d) {
let g;
if (c && (g = z(e, B([c]))), !g) {
if (s) {
const l = e.geometry.coordinates, y = s.gridNum, o = s.xOrigin, u = s.yOrigin, b = s.xUnit, x = s.yUnit, h = s.gridCache, f = C(l[0], o, b, y), i = C(l[1], u, x, y), w = h[f] ? h[f][i] ? h[f][i] : [] : [];
t = B(w.map((A) => t.features[A]));
}
g = z(e, t);
}
return d && d(g), g ? rt(e, g, n) : vt(e, r, a, n);
}
function C(e, t, s, r) {
let a = Math.floor((e - t) / s);
return a >= r && (a = r - 1), a;
}
function Et(e, t) {
let s = K(e - t[0]), r = Math.PI * 2, a;
for (let n = 0; n < t.length; n++) {
const c = (n + 1) % t.length, d = K(e - t[c]), g = Math.min(Math.abs(s), Math.abs(d));
s * d <= 0 && g < r && (r = g, a = n), s = d;
}
return a;
}
function K(e, t = !1) {
const s = t ? function(r) {
return !(r >= 0 && r < Math.PI * 2);
} : function(r) {
return !(r > -1 * Math.PI && r <= Math.PI);
};
for (; s(e); )
e = e + 2 * Math.PI * (e > 0 ? -1 : 1);
return e;
}
const Q = 2.00703, O = class O {
constructor() {
_(this, "points", []);
_(this, "pointsWeightBuffer");
_(this, "strict_status");
_(this, "vertices_params");
_(this, "centroid");
_(this, "edgeNodes");
_(this, "edges");
_(this, "tins");
_(this, "kinks");
_(this, "yaxisMode", O.YAXIS_INVERT);
_(this, "strictMode", O.MODE_AUTO);
_(this, "vertexMode", O.VERTEX_PLAIN);
_(this, "bounds");
_(this, "boundsPolygon");
_(this, "wh");
_(this, "xy");
_(this, "indexedTins");
_(this, "stateFull", !1);
_(this, "stateTriangle");
_(this, "stateBackward");
}
/**
* コンパイルされた設定を適用します
*
* @param compiled - コンパイルされた設定オブジェクト
* @returns 変換に必要な主要なオブジェクトのセット
*
* 以下の処理を行います:
* 1. バージョンに応じた設定の解釈
* 2. 各種パラメータの復元
* 3. TINネットワークの再構築
* 4. インデックスの作成
*/
setCompiled(t) {
if (t.version || !t.tins && t.points && t.tins_points) {
this.points = t.points, this.pointsWeightBuffer = !t.version || t.version < 2.00703 ? ["forw", "bakw"].reduce((r, a) => {
const n = t.weight_buffer[a];
return n && (r[a] = Object.keys(n).reduce((c, d) => {
const g = et(d);
return c[g] = n[d], c;
}, {})), r;
}, {}) : t.weight_buffer, t.strict_status ? this.strict_status = t.strict_status : t.kinks_points ? this.strict_status = O.STATUS_ERROR : t.tins_points.length == 2 ? this.strict_status = O.STATUS_LOOSE : this.strict_status = O.STATUS_STRICT, this.vertices_params = {
forw: [t.vertices_params[0]],
bakw: [t.vertices_params[1]]
}, this.vertices_params.forw[1] = [0, 1, 2, 3].map((r) => {
const a = (r + 1) % 4, n = W(
["c", `b${r}`, `b${a}`],
t.points,
t.edgeNodes || [],
t.centroid_point,
t.vertices_points,
!1,
Q
);
return B([n]);
}), this.vertices_params.bakw[1] = [0, 1, 2, 3].map((r) => {
const a = (r + 1) % 4, n = W(
["c", `b${r}`, `b${a}`],
t.points,
t.edgeNodes || [],
t.centroid_point,
t.vertices_points,
!0,
Q
);
return B([n]);
}), this.centroid = {
forw: Y(t.centroid_point[0], {
target: {
geom: t.centroid_point[1],
index: "c"
}
}),
bakw: Y(t.centroid_point[1], {
target: {
geom: t.centroid_point[0],
index: "c"
}
})
}, this.edges = At(t.edges || []), this.edgeNodes = t.edgeNodes || [];
const s = t.tins_points.length == 1 ? 0 : 1;
this.tins = {
forw: B(
t.tins_points[0].map(
(r) => W(
r,
t.points,
t.edgeNodes || [],
t.centroid_point,
t.vertices_points,
!1,
t.version
)
)
),
bakw: B(
t.tins_points[s].map(
(r) => W(
r,
t.points,
t.edgeNodes || [],
t.centroid_point,
t.vertices_points,
!0,
t.version
)
)
)
}, this.addIndexedTin(), t.kinks_points && (this.kinks = {
bakw: B(
t.kinks_points.map((r) => Y(r))
)
}), t.yaxisMode ? this.yaxisMode = t.yaxisMode : this.yaxisMode = O.YAXIS_INVERT, t.vertexMode && (this.vertexMode = t.vertexMode), t.strictMode && (this.strictMode = t.strictMode), t.bounds ? (this.bounds = t.bounds, this.boundsPolygon = t.boundsPolygon, this.xy = t.xy, this.wh = t.wh) : (this.xy = [0, 0], t.wh && (this.wh = t.wh), this.bounds = void 0, this.boundsPolygon = void 0);
} else {
t = JSON.parse(
JSON.stringify(t).replace('"cent"', '"c"').replace(/"bbox(\d+)"/g, '"b$1"')
), this.tins = t.tins, this.addIndexedTin(), this.strict_status = t.strict_status, this.pointsWeightBuffer = t.weight_buffer, this.vertices_params = t.vertices_params, this.centroid = t.centroid, this.kinks = t.kinks;
const s = [];
for (let r = 0; r < this.tins.forw.features.length; r++) {
const a = this.tins.forw.features[r];
["a", "b", "c"].map((n, c) => {
const d = a.geometry.coordinates[0][c], g = a.properties[n].geom, l = a.properties[n].index;
typeof l == "number" && (s[l] = [d, g]);
});
}
this.points = s;
}
}
/**
* TINネットワークのインデックスを作成します
*
* インデックスは変換処理を高速化するために使用されます。
* グリッド形式のインデックスを作成し、各グリッドに
* 含まれる三角形を記録します。
*/
addIndexedTin() {
const t = this.tins, s = t.forw, r = t.bakw, a = Math.ceil(Math.sqrt(s.features.length));
if (a < 3) {
this.indexedTins = void 0;
return;
}
let n = [], c = [];
const d = s.features.map((h) => {
let f = [];
return J(h)[0].map((i) => {
n.length === 0 ? n = [Array.from(i), Array.from(i)] : (i[0] < n[0][0] && (n[0][0] = i[0]), i[0] > n[1][0] && (n[1][0] = i[0]), i[1] < n[0][1] && (n[0][1] = i[1]), i[1] > n[1][1] && (n[1][1] = i[1])), f.length === 0 ? f = [Array.from(i), Array.from(i)] : (i[0] < f[0][0] && (f[0][0] = i[0]), i[0] > f[1][0] && (f[1][0] = i[0]), i[1] < f[0][1] && (f[0][1] = i[1]), i[1] > f[1][1] && (f[1][1] = i[1]));
}), f;
}), g = (n[1][0] - n[0][0]) / a, l = (n[1][1] - n[0][1]) / a, y = d.reduce(
(h, f, i) => {
const w = C(
f[0][0],
n[0][0],
g,
a
), A = C(
f[1][0],
n[0][0],
g,
a
), v = C(
f[0][1],
n[0][1],
l,
a
), E = C(
f[1][1],
n[0][1],
l,
a
);
for (let m = w; m <= A; m++) {
h[m] || (h[m] = []);
for (let M = v; M <= E; M++)
h[m][M] || (h[m][M] = []), h[m][M].push(i);
}
return h;
},
[]
), o = r.features.map((h) => {
let f = [];
return J(h)[0].map((i) => {
c.length === 0 ? c = [Array.from(i), Array.from(i)] : (i[0] < c[0][0] && (c[0][0] = i[0]), i[0] > c[1][0] && (c[1][0] = i[0]), i[1] < c[0][1] && (c[0][1] = i[1]), i[1] > c[1][1] && (c[1][1] = i[1])), f.length === 0 ? f = [Array.from(i), Array.from(i)] : (i[0] < f[0][0] && (f[0][0] = i[0]), i[0] > f[1][0] && (f[1][0] = i[0]), i[1] < f[0][1] && (f[0][1] = i[1]), i[1] > f[1][1] && (f[1][1] = i[1]));
}), f;
}), u = (c[1][0] - c[0][0]) / a, b = (c[1][1] - c[0][1]) / a, x = o.reduce(
(h, f, i) => {
const w = C(
f[0][0],
c[0][0],
u,
a
), A = C(
f[1][0],
c[0][0],
u,
a
), v = C(
f[0][1],
c[0][1],
b,
a
), E = C(
f[1][1],
c[0][1],
b,
a
);
for (let m = w; m <= A; m++) {
h[m] || (h[m] = []);
for (let M = v; M <= E; M++)
h[m][M] || (h[m][M] = []), h[m][M].push(i);
}
return h;
},
[]
);
this.indexedTins = {
forw: {
gridNum: a,
xOrigin: n[0][0],
yOrigin: n[0][1],
xUnit: g,
yUnit: l,
gridCache: y
},
bakw: {
gridNum: a,
xOrigin: c[0][0],
yOrigin: c[0][1],
xUnit: u,
yUnit: b,
gridCache: x
}
};
}
/**
* 座標変換を実行します
*
* @param apoint - 変換する座標
* @param backward - 逆方向の変換かどうか
* @param ignoreBounds - 境界チェックを無視するかどうか
* @returns 変換後の座標、または境界外の場合はfalse
*
* @throws {Error} 逆方向変換が許可されていない状態での逆変換時
*/
transform(t, s, r) {
if (s && this.strict_status == O.STATUS_ERROR)
throw 'Backward transform is not allowed if strict_status == "strict_error"';
this.yaxisMode == O.YAXIS_FOLLOW && s && (t = [t[0], -1 * t[1]]);
const a = Y(t);
if (this.bounds && !s && !r && !D(a, this.boundsPolygon))
return !1;
const n = s ? this.tins.bakw : this.tins.forw, c = s ? this.indexedTins.bakw : this.indexedTins.forw, d = s ? this.vertices_params.bakw : this.vertices_params.forw, g = s ? this.centroid.bakw : this.centroid.forw, l = s ? this.pointsWeightBuffer.bakw : this.pointsWeightBuffer.forw;
let y, o;
this.stateFull && (this.stateBackward == s ? y = this.stateTriangle : (this.stateBackward = s, this.stateTriangle = void 0), o = (b) => {
this.stateTriangle = b;
});
let u = Mt(
a,
n,
c,
d,
g,
l,
y,
o
);
if (this.bounds && s && !r) {
const b = Y(u);
if (!D(b, this.boundsPolygon)) return !1;
} else this.yaxisMode == O.YAXIS_FOLLOW && !s && (u = [u[0], -1 * u[1]]);
return u;
}
};
/**
* 各種モードの定数定義
* すべてreadonlyで、型安全性を確保
*/
_(O, "VERTEX_PLAIN", "plain"), _(O, "VERTEX_BIRDEYE", "birdeye"), _(O, "MODE_STRICT", "strict"), _(O, "MODE_AUTO", "auto"), _(O, "MODE_LOOSE", "loose"), _(O, "STATUS_STRICT", "strict"), _(O, "STATUS_ERROR", "strict_error"), _(O, "STATUS_LOOSE", "loose"), _(O, "YAXIS_FOLLOW", "follow"), _(O, "YAXIS_INVERT", "invert");
let H = O;
export {
H as Transform,
It as counterTri,
Q as format_version,
At as normalizeEdges,
Tt as rotateVerticesTriangle,
Mt as transformArr
};