SourceTermAnalysisSystem_vue/node_modules/.vite/deps/chunk-JFONEOYG.js
2026-05-15 10:22:44 +08:00

136 lines
3.6 KiB
JavaScript

import {
assert
} from "./chunk-QFCIXVZ3.js";
// node_modules/ol/transform.js
var tmp_ = new Array(6);
function create() {
return [1, 0, 0, 1, 0, 0];
}
function reset(transform) {
return set(transform, 1, 0, 0, 1, 0, 0);
}
function multiply(transform1, transform2) {
const a1 = transform1[0];
const b1 = transform1[1];
const c1 = transform1[2];
const d1 = transform1[3];
const e1 = transform1[4];
const f1 = transform1[5];
const a2 = transform2[0];
const b2 = transform2[1];
const c2 = transform2[2];
const d2 = transform2[3];
const e2 = transform2[4];
const f2 = transform2[5];
transform1[0] = a1 * a2 + c1 * b2;
transform1[1] = b1 * a2 + d1 * b2;
transform1[2] = a1 * c2 + c1 * d2;
transform1[3] = b1 * c2 + d1 * d2;
transform1[4] = a1 * e2 + c1 * f2 + e1;
transform1[5] = b1 * e2 + d1 * f2 + f1;
return transform1;
}
function set(transform, a, b, c, d, e, f) {
transform[0] = a;
transform[1] = b;
transform[2] = c;
transform[3] = d;
transform[4] = e;
transform[5] = f;
return transform;
}
function setFromArray(transform1, transform2) {
transform1[0] = transform2[0];
transform1[1] = transform2[1];
transform1[2] = transform2[2];
transform1[3] = transform2[3];
transform1[4] = transform2[4];
transform1[5] = transform2[5];
return transform1;
}
function apply(transform, coordinate) {
const x = coordinate[0];
const y = coordinate[1];
coordinate[0] = transform[0] * x + transform[2] * y + transform[4];
coordinate[1] = transform[1] * x + transform[3] * y + transform[5];
return coordinate;
}
function rotate(transform, angle) {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0));
}
function scale(transform, x, y) {
return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0));
}
function translate(transform, dx, dy) {
return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy));
}
function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) {
const sin = Math.sin(angle);
const cos = Math.cos(angle);
transform[0] = sx * cos;
transform[1] = sy * sin;
transform[2] = -sx * sin;
transform[3] = sy * cos;
transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1;
transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1;
return transform;
}
function makeInverse(target, source) {
const det = determinant(source);
assert(det !== 0, "Transformation matrix cannot be inverted");
const a = source[0];
const b = source[1];
const c = source[2];
const d = source[3];
const e = source[4];
const f = source[5];
target[0] = d / det;
target[1] = -b / det;
target[2] = -c / det;
target[3] = a / det;
target[4] = (c * f - d * e) / det;
target[5] = -(a * f - b * e) / det;
return target;
}
function determinant(mat) {
return mat[0] * mat[3] - mat[1] * mat[2];
}
var matrixPrecision = [1e5, 1e5, 1e5, 1e5, 2, 2];
function toString(mat) {
const transformString = "matrix(" + mat.join(", ") + ")";
return transformString;
}
function fromString(cssTransform) {
const values = cssTransform.substring(7, cssTransform.length - 1).split(",");
return values.map(parseFloat);
}
function equivalent(cssTransform1, cssTransform2) {
const mat1 = fromString(cssTransform1);
const mat2 = fromString(cssTransform2);
for (let i = 0; i < 6; ++i) {
if (Math.round((mat1[i] - mat2[i]) * matrixPrecision[i]) !== 0) {
return false;
}
}
return true;
}
export {
create,
reset,
multiply,
setFromArray,
apply,
rotate,
scale,
translate,
compose,
makeInverse,
toString,
equivalent
};
//# sourceMappingURL=chunk-JFONEOYG.js.map