UNPKG

@cearth/tools

Version:
755 lines (754 loc) 25.1 kB
import { WebGLConstants as R, Cartesian3 as d, HeadingPitchRoll as I, Quaternion as w, Matrix3 as g, Matrix4 as a, TranslationRotationScale as B, Plane as rt, BoundingSphere as N, JulianDate as h, Cartesian2 as T, ComponentDatatype as Z, Cartographic as V, Cartesian4 as C, Rectangle as P, Matrix2 as G, Transforms as K } from "cesium"; import { getMatrixOfQuantizedMeshTerrainData as at, Geometry as st, workerApi as ct, GeometricRelation as H, computeSignAreaOfPolygon3 as $, computeRelationAreaOfPolygon2Terrain as lt } from "@web-3d/tools"; function Jt(t) { return L(t) || k(t) || ut(t); } function L(t) { return "modelMatrix" in t; } function k(t) { return "position" in t; } function ut(t) { return "positions" in t; } const ft = { /** * 8-bit signed byte corresponding to <code>gl.BYTE</code> and the type * of an element in <code>Int8Array</code>. */ [R.BYTE]: Int8Array, /** * 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type * of an element in <code>Uint8Array</code>. */ [R.UNSIGNED_BYTE]: Uint8Array, /** * 16-bit signed short corresponding to <code>SHORT</code> and the type * of an element in <code>Int16Array</code>. */ [R.SHORT]: Int16Array, /** * 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type * of an element in <code>Uint16Array</code>. */ [R.UNSIGNED_SHORT]: Uint16Array, /** * 32-bit signed int corresponding to <code>INT</code> and the type * of an element in <code>Int32Array</code>. */ [R.INT]: Int32Array, /** * 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type * of an element in <code>Uint32Array</code>. */ [R.UNSIGNED_INT]: Uint32Array, /** * 32-bit floating-point corresponding to <code>FLOAT</code> and the type * of an element in <code>Float32Array</code>. */ [R.FLOAT]: Float32Array, /** * 64-bit floating-point corresponding to <code>gl.DOUBLE</code> (in Desktop OpenGL; * this is not supported in WebGL, and is emulated in Cesium via {@link GeometryPipeline.encodeAttribute}) * and the type of an element in <code>Float64Array</code>. */ [R.DOUBLE]: Float64Array }; var mt = /* @__PURE__ */ ((t) => (t[t.x = 0] = "x", t[t.y = 1] = "y", t[t.z = 2] = "z", t))(mt || {}), F = /* @__PURE__ */ ((t) => (t.x = "roll", t.y = "pitch", t.z = "heading", t))(F || {}); ((t) => { function n(i) { for (let [r, s] of Object.entries(t)) if (i === s) return r; } t.toKey = n; function e(i) { return new d(i.roll, -i.pitch, -i.heading); } t.toCartesian3 = e; function o(i) { return new I(-i[n("heading")], -i[n("pitch")], i[n("roll")]); } t.toHeadingPitchRoll = o; })(F || (F = {})); var dt = /* @__PURE__ */ ((t) => (t[t.heading = 0] = "heading", t[t.pitch = 1] = "pitch", t[t.roll = 2] = "roll", t))(dt || {}); function tt(t) { const n = t == null ? void 0 : t.world, { translation: e, rotation: o, scale: i } = n && typeof n == "object" ? n : { translation: n, rotation: n, scale: n }; return { ...t, worldTranslation: e, worldRotation: o, worldScale: i }; } function Q(t) { if (t.axis) { const { axis: e, angle: o } = t; return w.fromAxisAngle(e, o); } const n = F.toHeadingPitchRoll(t); return w.fromHeadingPitchRoll(n); } function qt(t, n, e) { const o = g.fromQuaternion(t), i = a.fromRotation(o), r = a.inverseTransformation(n, new a()), s = a.multiply(r, i, i); return nt(s); } function nt(t, n) { const e = a.getMatrix3(t, new g()), o = w.fromRotationMatrix(e); return I.fromQuaternion(o, n); } function Lt(t, n, e) { e = e ?? new a(); const o = a.inverse(n, new a()); return a.multiply(o, t, e); } function pt(t, n, e) { let o = w.computeAxis(t, new d()); if (o.equals(d.ZERO)) return null; const i = w.computeAngle(t); return o = a.multiplyByPointAsVector(n, o, o), w.fromAxisAngle(o, i); } function kt(t, n, e) { let o = w.computeAxis(t, new d()); if (o.equals(d.ZERO)) return null; const i = w.computeAngle(t), r = a.inverse(n, new a()); return o = a.multiplyByPointAsVector(r, o, o), w.fromAxisAngle(o, i); } function U(t, n) { let { translation: e, rotation: o, scale: i } = t; const { referFrame: r, worldTranslation: s, worldRotation: l, worldScale: f } = tt(n); let m = null; return e && (s || (e = a.multiplyByPointAsVector(r, e, new d()))), o && (m = Q(o), l || (m = pt(m, r))), i && (f || (i = a.multiplyByPointAsVector(r, i, new d()))), { translation: e, rotation: m, scale: i }; } function yt(t, n) { let { translation: e, rotation: o, scale: i } = t; const { referFrame: r, worldTranslation: s, worldRotation: l, worldScale: f } = tt(n), m = r ? a.inverse(r, new a()) : null; let u = null; if (e && s && (e = a.multiplyByPointAsVector(m, e, new d())), o && (u = Q(o), l)) { let c = w.computeAxis(u, new d()); if (!c.equals(d.ZERO)) { const p = w.computeAngle(u); c = a.multiplyByPointAsVector(m, c, c), u = w.fromAxisAngle(c, p); } } return i && f && (i = a.multiplyByPointAsVector(m, i, new d())), { translation: e, rotation: u, scale: i }; } function wt(t, n) { const e = n == null ? void 0 : n.defaultMatrix; let { translation: o, rotation: i, scale: r } = U(t, n); if (e) { if (o || (o = a.getTranslation(e, new d())), !i) { const l = a.getMatrix3(e, new g()); i = w.fromRotationMatrix(l); } r || (r = a.getScale(e, new d())); } const s = new B(o ?? void 0, i ?? void 0, r ?? void 0); return a.fromTranslationRotationScale(s); } function Ut(t) { const { translation: n, rotation: e, scale: o } = t, i = e ? Q(e) : void 0, r = new B(n ?? void 0, i, o ?? void 0); return a.fromTranslationRotationScale(r); } function gt(t, n, e) { const o = d.subtract(n, t, new d()), i = d.subtract(e, t, new d()), r = d.cross(o, i, o); return d.normalize(r, o); } function Yt(t, n, e) { const o = gt(t, n, e); return rt.fromPointNormal(o, t); } function* _t(t, n = !0, e, o) { const i = t.length, r = n ? i : i - 1, s = e || o ? d.prototype.equalsEpsilon : d.prototype.equals; for (let l = 0; l < r; l++) { const f = t[l]; let m = (l + 1) % i, u = t[m], c = l; for (; s.call(f, u, e, o); ) { if (m = (++c + 1) % i, m === l) return; u = t[m]; } l = c, yield [f, u]; } } function E(t, n, e) { e = e ?? new a(); const o = a.inverse(n, new a()), i = a.multiply(t, o, o); return a.multiply(n, i, e); } function jt(t, n, e, o) { o = o ?? new a(); const i = a.inverse(e, new a()); let r = a.multiply(i, t, i); return r = a.multiply(n, r, r), a.multiply(e, r, o); } function Wt(t, n, e) { const o = a.fromTranslation(t); return E(o, n, e); } function Xt(t, n, e, o) { const i = w.fromAxisAngle(t, n), r = g.fromQuaternion(i), s = a.fromRotation(r); return E(s, e, o); } function Zt(t, n, e) { const o = a.fromScale(t); return E(o, n, e); } function Kt(t, n, e) { const o = g.fromScale(n); if (e) for (const i of t) d.subtract(i, e, i), g.multiplyByVector(o, i, i), d.add(i, e, i); else { const i = g.fromScale(n); for (const r of t) g.multiplyByVector(i, r, r); } return t; } function $t(t, n) { const { translation: e, rotation: o, scale: i } = t; let r; if (o) { const { axis: l, angle: f } = o; r = w.fromAxisAngle(l, f); } const s = new B(e ?? void 0, r, i ?? void 0); return a.fromTranslationRotationScale(s, n ?? void 0); } function tn(t) { let n = t.boundingSphere; if (n) return n; let e = t.geometryInstances; if (e) { e = Array.isArray(e) ? e : [e]; const i = e.map((r) => r.geometry.boundingSphere); return N.fromBoundingSpheres(i); } const o = t.positions; return (o == null ? void 0 : o.length) > 0 ? N.fromPoints(o) : null; } function nn(t, n) { n = n ?? new d(); const e = t.position; if (e) return e instanceof d ? e : e.getValue(h.now(), n); const o = t.modelMatrix; if (o) return a.getTranslation(o, n); const i = t.positions; return (i == null ? void 0 : i.length) > 0 ? N.fromPoints(i).center : null; } function en(t, n, e) { let { translation: o, rotation: i, scale: r } = U(n, e); const s = new B(o ?? void 0, i ?? void 0, r ?? void 0), l = a.fromTranslationRotationScale(s); return ht(t, l); } function ht(t, n) { const e = t.modelMatrix; if (e) return a.multiply(n, e, e), t.modelMatrix = e, !0; const o = t.position; if (o) { if ("scale" in t) { const r = a.getTranslation(n, new d()); d.add(o, r, o); const s = t.scale ?? 1, l = a.getScale(n, new d()); t.scale = d.maximumComponent(l) * s; } else a.multiplyByPoint(n, o, o); return t.position = o, !0; } const i = t.positions; if ((i == null ? void 0 : i.length) > 0) { for (const r of i) a.multiplyByPoint(n, r, r); return t.positions = i, !0; } return !1; } function on(t, n, e) { const o = Tt(t), i = wt(n, { ...e, defaultMatrix: o }); return xt(t, i); } function xt(t, n) { if (L(t)) return t.modelMatrix = n, !0; const e = a.getTranslation(n, new d()); if (k(t)) { if (t.position = e, "scale" in t) { const i = a.getScale(n, new d()); t.scale = d.maximumComponent(i); } return !0; } const o = t.positions; if ((o == null ? void 0 : o.length) > 0) { const i = N.fromPoints(o); d.subtract(e, i.center, e); for (const r of o) d.add(r, e, r); return t.positions = o, !0; } return !1; } function Tt(t) { if (L(t)) return t.modelMatrix; if (k(t)) { const e = t.position, o = t.scale ?? 1, i = new B(e, void 0, new d(o, o, o)); return a.fromTranslationRotationScale(i); } const n = t.positions; if ((n == null ? void 0 : n.length) > 0) { const e = N.fromPoints(n); return a.fromTranslation(e.center); } return null; } function rn(t, n) { var z, O; let { translation: e, rotation: o, scale: i } = U(n, n); const { reset: r, referFrame: s } = n, l = h.now(), f = !r; if (o) { let A = o; if (f) { const x = (z = t.orientation) == null ? void 0 : z.getValue(l); x && (A = w.multiply(o, x, x)); } t.orientation = A; } if (e) { let A = e; if (f) { const x = (O = t.position) == null ? void 0 : O.getValue(l); x && (A = d.add(x, e, x)); } t.position = A; } if (!s) return; const { translation: m, rotation: u, scale: c } = yt(n, n), p = new B(m ?? void 0, u ?? void 0, c ?? void 0); let y = a.fromTranslationRotationScale(p); if (y = E(y, s, y), c) { const A = t.box; A && vt(A, c); const x = t.cylinder; x && At(x, c); const _ = t.ellipse; _ && Pt(_, c); const j = t.ellipsoid; j && Rt(j, c); const W = t.model; W && Mt(W, c, r); const X = t.plane; X && St(X, c); } const v = t.corridor; v && Dt(v, y, c); const M = t.polygon; M && Vt(M, y, c); const S = t.polyline; S && Bt(S, y, c); const D = t.polylineVolume; D && It(D, y, c); const b = t.wall; b && bt(b, y, c); } function vt(t, n) { var i; const e = h.now(), o = (i = t.dimensions) == null ? void 0 : i.getValue(e); o && (t.dimensions = d.multiplyComponents(o, n, o)); } function At(t, n) { var f, m, u; const e = h.now(), o = (f = t.length) == null ? void 0 : f.getValue(e); o != null && (t.length = o * n.z); const i = Math.max(n.x, n.y), r = (m = t.topRadius) == null ? void 0 : m.getValue(e); r != null && (t.topRadius = r * i); const s = n.z, l = (u = t.bottomRadius) == null ? void 0 : u.getValue(e); l != null && (t.bottomRadius = l * s); } function Pt(t, n) { var m, u, c, p; const e = h.now(), o = Math.max(n.x, n.y), i = n.z, r = (m = t.semiMajorAxis) == null ? void 0 : m.getValue(e); r != null && (t.semiMajorAxis = r * o); const s = (u = t.semiMinorAxis) == null ? void 0 : u.getValue(e); s != null && (t.semiMinorAxis = s * o); const l = (c = t.height) == null ? void 0 : c.getValue(e); l != null && (t.height = l * i); const f = (p = t.extrudedHeight) == null ? void 0 : p.getValue(e); f != null && (t.extrudedHeight = f * i); } function Rt(t, n) { var r, s; const e = h.now(), o = (r = t.radii) == null ? void 0 : r.getValue(e); o != null && (t.radii = d.multiplyComponents(o, n, o)); const i = (s = t.innerRadii) == null ? void 0 : s.getValue(e); i != null && (t.innerRadii = d.multiplyComponents(i, n, i)); } function Mt(t, n, e) { var i; let o = d.maximumComponent(n); if (!e) { const r = h.now(), s = ((i = t.scale) == null ? void 0 : i.getValue(r)) ?? 1; o *= s; } t.scale = o; } function St(t, n) { var r; const e = h.now(), o = T.fromCartesian3(n), i = (r = t.dimensions) == null ? void 0 : r.getValue(e); i && (t.dimensions = T.multiplyComponents(i, o, i)); } function Dt(t, n, e) { var c, p, y; const o = h.now(), i = new d(), r = (c = t.positions) == null ? void 0 : c.getValue(o); if ((r == null ? void 0 : r.length) > 0) { for (const v of r) a.multiplyByPoint(n, v, v); t.dimensions = r; } const s = e ?? a.getScale(n, i), l = Math.max(s.x, s.y); ((p = t.width) == null ? void 0 : p.getValue(o)) != null && (t.width = l * scale); const m = (y = t.height) == null ? void 0 : y.getValue(o), u = s.z; m != null && (t.height = m * u); } function Vt(t, n, e) { var u, c, p; const o = h.now(), i = new d(), r = (u = t.hierarchy) == null ? void 0 : u.getValue(o); r && (et(r, n), t.hierarchy = r); const l = (e ?? a.getScale(n, i)).z, f = (c = t.height) == null ? void 0 : c.getValue(o); f != null && (t.height = f * l); const m = (p = t.extrudedHeight) == null ? void 0 : p.getValue(o); m != null && (t.extrudedHeight = m * l); } function et(t, n) { const { positions: e, holes: o } = t; for (const i of e) a.multiplyByPoint(n, i, i); t.positions = e; for (const i of o) et(i, n); } function Bt(t, n, e) { var m, u; const o = h.now(), i = new d(), r = (m = t.positions) == null ? void 0 : m.getValue(o); if ((r == null ? void 0 : r.length) > 0) { for (const c of r) a.multiplyByPoint(n, c, c); t.positions = r; } const s = e ?? a.getScale(n, i), l = Math.max(s.x, s.y); ((u = t.width) == null ? void 0 : u.getValue(o)) != null && (t.width = l * scale); } function It(t, n, e) { var m, u; const o = h.now(), i = new d(), r = (m = t.positions) == null ? void 0 : m.getValue(o); if ((r == null ? void 0 : r.length) > 0) { for (const c of r) a.multiplyByPoint(n, c, c); t.positions = r; } const s = e ?? a.getScale(n, i), l = T.fromCartesian3(s), f = (u = t.shape) == null ? void 0 : u.getValue(o); if (f != null) { for (const c of f) T.multiplyComponents(c, l, c); t.shape = f; } } function bt(t, n, e) { var u, c, p; const o = h.now(), i = new d(), r = (u = t.positions) == null ? void 0 : u.getValue(o); if ((r == null ? void 0 : r.length) > 0) { for (const y of r) a.multiplyByPoint(n, y, y); t.positions = r; } const l = (e ?? a.getScale(n, i)).z, f = (c = t.minimumHeights) == null ? void 0 : c.getValue(o); f != null && (graphicsgraphics.minimumHeights = f.map((y) => y * l)); const m = (p = t.maximumHeights) == null ? void 0 : p.getValue(o); m != null && (graphicsgraphics.maximumHeights = m.map((y) => y * l)); } function an(t, n, e) { var M, S, D, b; const o = h.now(), i = (M = t.position) == null ? void 0 : M.getValue(o); if (!i) return null; const r = (S = t.orientation) == null ? void 0 : S.getValue(o), s = ((b = (D = t.model) == null ? void 0 : D.scale) == null ? void 0 : b.getValue(o)) ?? 1, l = new d(s, s, s), f = n(i, e), m = a.inverse(f, new a()), u = a.multiplyByPoint(m, i, new d()), c = { translation: u, position: i, scale: l, rotation: new d() }; let p; if (r) { const z = g.fromQuaternion(r), O = a.fromRotation(z), A = a.multiply(m, O, O), x = nt(A); p = F.toCartesian3(x), c.rotation = p; } const y = new B(u ?? void 0, p ? Q(p) : void 0, l ?? void 0); let v = a.fromTranslationRotationScale(y); return c.matrix = v, c; } function sn(t) { return t.values.length / t.componentsPerAttribute; } function cn(t) { return Z.getSizeInBytes(t.componentDatatype) * t.componentsPerAttribute; } function ln(t) { const { componentDatatype: n, vertexBuffer: e } = t, o = ft[n]; if (!o) throw new Error("不支持的数据类型"); const i = e.sizeInBytes, r = Z.getSizeInBytes(n), s = i / r; let l = new o(s); return e.getBufferData(l, 0, 0, i), l; } new T(), new d(), new C(); const q = [new T(), new T(), new T(), new T()], J = [new d(), new d(), new d(), new d()]; new C(), new C(), new C(), new C(); const Ot = [new V(), new V(), new V(), new V()]; new P(), new P(), new P(), new P(); new G(), new G(), new G(), new G(); new g(), new g(), new g(), new g(); new a(), new a(), new a(), new a(); new w(), new w(), new w(), new w(); new I(), new I(), new I(), new I(); function un(t, n = []) { const { stride: e, vertexArray: o } = t, i = o.length / e, r = J[0]; for (let s = 0; s < i; s++) t.encoding.decodePosition(o, s, r), d.pack(r, n, n.length); return n; } function fn(t, n, e) { return t.encoding.decodePosition(t.vertexArray, n, e); } function Ct(t) { const { stride: n, vertices: e, indices: o, encoding: i } = t, r = e.length / n, s = J[0], l = new Float32Array(r * 3), f = q[0], m = new Float32Array(r * 2), u = new Float32Array(r); for (let c = 0; c < r; c++) { i.decodePosition(e, c, s), d.pack(s, l, c * 3); const p = i.decodeHeight(e, c); u[c] = p, i.decodeTextureCoordinates(e, c, f), T.pack(f, m, c * 2); } return { attributes: { position: { array: l, vectorSize: 3 }, uv: { array: m, vectorSize: 2 }, height: { array: u, vectorSize: 1 } }, indices: o.slice(), count: r }; } function ot(t, n) { const e = t._surface._tilesToRender, o = [], i = new P(); for (const r of e) { const { rectangle: s } = r; P.intersection(n, s, i) && o.push(r); } return o; } function mn(t) { const n = t._surface._tilesToRender; return Nt(n); } function Nt(t) { const n = /* @__PURE__ */ new Set(); for (const r of t) n.add(r.level); const e = [...n], o = Math.min.apply(Math, e), i = Math.max.apply(Math, e); return { min: o, max: i }; } function it(t) { return t.map((n) => { const { mesh: e, terrainData: o } = n.data, i = Ct(e), { x: r, y: s, level: l } = n, f = [o._minimumHeight, o._maximumHeight]; return { data: i, encoding: e.encoding, rectangle: n.rectangle, heightRange: f, x: r, y: s, level: l }; }); } function dn(t) { const { x: n, y: e, level: o } = t; return t.data.terrainData.upsample(t.tilingScheme, n, e, o, n, e, o); } function Ft(t, n, e) { const { east: o, north: i, south: r, west: s } = n, l = Ot[0]; l.longitude = s, l.latitude = r; const f = t.positionToTileXY(l, e, q[0]); l.longitude = o, l.latitude = i; const m = t.positionToTileXY(l, e, q[1]), [u, c] = f.x < m.x ? [f.x, m.x] : [m.x, f.x], [p, y] = f.y < m.y ? [f.y, m.y] : [m.y, f.y]; return { min: [u, p], max: [c, y] }; } const zt = 32767; function pn(t, n = new d()) { return g.getScale(t.halfAxes, n), d.multiplyByScalar(n, 2 * zt, n), n; } function Y(t, n, e) { return e = t.getLocalCurvature(n, e), e.x = 1 / e.x, e.y = 1 / e.y, e; } function yn(t, n, e) { e = Y(t, n, e); const o = Math.PI / 180; return T.multiplyByScalar(e, o, e); } function Gt(t) { const { _quantizedVertices: n, _indices: e } = t, o = n.length / 3, i = { type: "Float32Array", start: 0, vectorSize: 1 }, r = { type: "Float32Array", start: o, vectorSize: 1 }, s = { type: "Float32Array", start: o * 2, vectorSize: 1 }; return { array: new Float32Array(n), attributes: { u: i, v: r, height: s }, count: o, indices: e }; } async function wn(t, n, e, o) { const i = await t.requestTileGeometry(n, e, o); if (!i) return null; const r = Gt(i), s = [data._minimumHeight, data._maximumHeight], l = t.tilingScheme.tileXYToRectangle(n, e, o), f = at(l, s), m = a.fromArray(f, void 0), u = ["u", "v", "height"], c = new st({ ...r, positionNames: u }), p = new d(); return c.mapForAggregate(u, (y, v) => (d.fromArray(y, 0, p), a.multiplyByPoint(m, p, p), new V(p.x, p.y, p.z))); } async function gn(t, n, e) { const { min: o, max: i } = Ft(t.tilingScheme, n, e), r = [], s = []; for (let f = o[0]; f <= i[0]; f++) for (let m = o[1]; m <= i[1]; m++) { const u = Ht(t, f, m, e); u && (r.push(u), s.push({ x: f, y: m })); } return (await Promise.all(r)).map(function(f, m) { const { x: u, y: c } = s[m]; return { x: u, y: c, level: e, data: f }; }); } async function Ht(t, n, e, o) { return t.getTileDataAvailable(n, e, o) ? (await t.loadTileDataAvailability(n, e, o), t.requestTileGeometry(n, e, o)) : Promise.reject("不可用"); } async function hn(t, n) { const e = P.fromCartesianArray(n), o = V.toCartesian(P.center(e)), i = Y(t.ellipsoid, o), r = [i.x, i.y, 1], s = ot(t, e), l = it(s), f = K.eastNorthUpToFixedFrame(o); a.inverseTransformation(f, f); const m = n.map((p) => { const y = a.multiplyByPoint(f, p, J[2]); return [y.x, y.y]; }); let u = 0; const c = l.map(async (p) => { const { data: y, ...v } = p, { position: M, uv: S, height: D } = y.attributes; u += await ct.computeRelationAreaOfPolygon2Terrain({ args: [{ ...y, ...v, positionNames: ["position"], region: m, // @ts-ignore matrix: a.pack(f, []), relation: H.Contain | H.Intersect, scale: r }], transfer: [M.array.buffer, S.array.buffer, D.array.buffer, y.indices.buffer] }); }); if (await Promise.all(c), u === 0 || isNaN(u)) { console.warn("贴地面积计算异常,已回退到椭球面投影面积", u); const p = n.map((y) => d.pack(y, [])); return u = $(p), Math.abs(u); } return u; } function xn(t, n) { const e = P.fromCartesianArray(n), o = V.toCartesian(P.center(e)), i = Y(t.ellipsoid, o), r = [i.x, i.y, 1], s = ot(t, e), l = it(s), f = K.eastNorthUpToFixedFrame(o); a.inverseTransformation(f, f); const m = n.map((c) => { const p = a.multiplyByPoint(f, c, J[2]); return [p.x, p.y]; }); let u = 0; for (const c of l) { const { data: p, ...y } = c; u += lt({ ...p, ...y, positionNames: ["position"], region: m, // @ts-ignore matrix: a.pack(f, []), relation: H.Contain | H.Intersect, scale: r }); } if (u === 0 || isNaN(u)) { console.warn("贴地面积计算异常,已回退到椭球面投影面积", u); const c = n.map((p) => d.pack(p, [])); return u = $(c), Math.abs(u); } return u; } export { mt as CartesianAxis, dt as HeadingPitchRollComponent, F as Xyz_Hpr, jt as applyMatrixReferFrame, ht as applyTransformInPrimitive, en as applyTransformInfoPrimitive, ft as componentDatatypeTypedArrayMap, cn as computeAttributeSizeInBytes, gt as computeNormalOfCoplanars, xn as computeTerrainAreaOfPolygon, hn as computeTerrainAreaOfPolygon_worker, sn as computeVertexNumOfAttribute, Yt as createPlaneOfCoplanars, tt as flatTransformInfoOptions, ln as getAttributeData, tn as getBoundingSphere, un as getDecodePositionsOfTerrainMesh, an as getEntityInfo, Gt as getGeometryDataOfQuantizedMeshTerrainData, Ct as getGeometryDataOfTerrainMesh, Nt as getLevelRangeOfQuadtreeTiles, Y as getLocalCurvatureRadius, yn as getLocalSizePerDegrees, yt as getLocalTransformInfo, $t as getMatrix4OfTransformInfo, _t as getNeighborPairs, nn as getPosition, fn as getPositionOfTerrainMesh, ot as getRenderedQuadtreeTilesOfIntersectRectangle, mn as getRenderedTileLevelRange, pn as getScaleOfTerrainDataByOrientedBoundingBox, Ht as getTerrainData, dn as getTerrainDataOfQuadtreeTile, gn as getTerrainDatasOfIntersectRectangle, it as getTerrainDatasOfQuadtreeTiles, Ft as getTileRangeOfIntersectRectangle, Tt as getTransform, wn as getWorldDataOfQuantizedMeshTerrainData, wt as getWorldMatrix, U as getWorldTransformInfo, L as isMatrixPrimitive, ut as isPositionListPrimitive, k as isPositionPrimitive, Jt as isPrimitiveObject, pt as localQuaternionToWorld, E as makeMatrixReferFrame, nt as matrix4ToHeadingPitchRoll, qt as quaternionToHeadingPitchRoll, xt as resetTransformInPrimitive, on as resetTransformInfoPrimitive, Xt as rotateMatrixReferFrame, Q as rotationInfoToQuaternion, vt as scaleBoxGraphics, At as scaleCylinderGraphics, Pt as scaleEllipseGraphics, Rt as scaleEllipsoidGraphics, Zt as scaleMatrixReferFrame, Mt as scaleModelGraphics, St as scalePlaneGraphics, Kt as scalePoints, Dt as transformCorridorGraphics, rn as transformEntity, Ut as transformInfoToMatrix, Vt as transformPolygonGraphics, et as transformPolygonHierarchy, Bt as transformPolylineGraphics, It as transformPolylineVolumeGraphics, bt as transformWallGraphics, Wt as translationMatrixReferFrame, Lt as worldMatrixToLocal, kt as worldQuaternionToLocal };