Commit b60fc2e0 authored by Santhanavanich's avatar Santhanavanich
Browse files

upload application

parent 12535794
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Interval_default
} from "./chunk-KHZNBFOH.js";
import {
Cartesian3_default,
Cartographic_default,
Matrix3_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/QuadraticRealPolynomial.js
var QuadraticRealPolynomial = {};
QuadraticRealPolynomial.computeDiscriminant = function(a, b, c) {
if (typeof a !== "number") {
throw new DeveloperError_default("a is a required number.");
}
if (typeof b !== "number") {
throw new DeveloperError_default("b is a required number.");
}
if (typeof c !== "number") {
throw new DeveloperError_default("c is a required number.");
}
const discriminant = b * b - 4 * a * c;
return discriminant;
};
function addWithCancellationCheck(left, right, tolerance) {
const difference = left + right;
if (Math_default.sign(left) !== Math_default.sign(right) && Math.abs(difference / Math.max(Math.abs(left), Math.abs(right))) < tolerance) {
return 0;
}
return difference;
}
QuadraticRealPolynomial.computeRealRoots = function(a, b, c) {
if (typeof a !== "number") {
throw new DeveloperError_default("a is a required number.");
}
if (typeof b !== "number") {
throw new DeveloperError_default("b is a required number.");
}
if (typeof c !== "number") {
throw new DeveloperError_default("c is a required number.");
}
let ratio;
if (a === 0) {
if (b === 0) {
return [];
}
return [-c / b];
} else if (b === 0) {
if (c === 0) {
return [0, 0];
}
const cMagnitude = Math.abs(c);
const aMagnitude = Math.abs(a);
if (cMagnitude < aMagnitude && cMagnitude / aMagnitude < Math_default.EPSILON14) {
return [0, 0];
} else if (cMagnitude > aMagnitude && aMagnitude / cMagnitude < Math_default.EPSILON14) {
return [];
}
ratio = -c / a;
if (ratio < 0) {
return [];
}
const root = Math.sqrt(ratio);
return [-root, root];
} else if (c === 0) {
ratio = -b / a;
if (ratio < 0) {
return [ratio, 0];
}
return [0, ratio];
}
const b2 = b * b;
const four_ac = 4 * a * c;
const radicand = addWithCancellationCheck(b2, -four_ac, Math_default.EPSILON14);
if (radicand < 0) {
return [];
}
const q = -0.5 * addWithCancellationCheck(
b,
Math_default.sign(b) * Math.sqrt(radicand),
Math_default.EPSILON14
);
if (b > 0) {
return [q / a, c / q];
}
return [c / q, q / a];
};
var QuadraticRealPolynomial_default = QuadraticRealPolynomial;
// packages/engine/Source/Core/CubicRealPolynomial.js
var CubicRealPolynomial = {};
CubicRealPolynomial.computeDiscriminant = function(a, b, c, d) {
if (typeof a !== "number") {
throw new DeveloperError_default("a is a required number.");
}
if (typeof b !== "number") {
throw new DeveloperError_default("b is a required number.");
}
if (typeof c !== "number") {
throw new DeveloperError_default("c is a required number.");
}
if (typeof d !== "number") {
throw new DeveloperError_default("d is a required number.");
}
const a2 = a * a;
const b2 = b * b;
const c2 = c * c;
const d2 = d * d;
const discriminant = 18 * a * b * c * d + b2 * c2 - 27 * a2 * d2 - 4 * (a * c2 * c + b2 * b * d);
return discriminant;
};
function computeRealRoots(a, b, c, d) {
const A = a;
const B = b / 3;
const C = c / 3;
const D = d;
const AC = A * C;
const BD = B * D;
const B2 = B * B;
const C2 = C * C;
const delta1 = A * C - B2;
const delta2 = A * D - B * C;
const delta3 = B * D - C2;
const discriminant = 4 * delta1 * delta3 - delta2 * delta2;
let temp;
let temp1;
if (discriminant < 0) {
let ABar;
let CBar;
let DBar;
if (B2 * BD >= AC * C2) {
ABar = A;
CBar = delta1;
DBar = -2 * B * delta1 + A * delta2;
} else {
ABar = D;
CBar = delta3;
DBar = -D * delta2 + 2 * C * delta3;
}
const s = DBar < 0 ? -1 : 1;
const temp0 = -s * Math.abs(ABar) * Math.sqrt(-discriminant);
temp1 = -DBar + temp0;
const x = temp1 / 2;
const p = x < 0 ? -Math.pow(-x, 1 / 3) : Math.pow(x, 1 / 3);
const q = temp1 === temp0 ? -p : -CBar / p;
temp = CBar <= 0 ? p + q : -DBar / (p * p + q * q + CBar);
if (B2 * BD >= AC * C2) {
return [(temp - B) / A];
}
return [-D / (temp + C)];
}
const CBarA = delta1;
const DBarA = -2 * B * delta1 + A * delta2;
const CBarD = delta3;
const DBarD = -D * delta2 + 2 * C * delta3;
const squareRootOfDiscriminant = Math.sqrt(discriminant);
const halfSquareRootOf3 = Math.sqrt(3) / 2;
let theta = Math.abs(Math.atan2(A * squareRootOfDiscriminant, -DBarA) / 3);
temp = 2 * Math.sqrt(-CBarA);
let cosine = Math.cos(theta);
temp1 = temp * cosine;
let temp3 = temp * (-cosine / 2 - halfSquareRootOf3 * Math.sin(theta));
const numeratorLarge = temp1 + temp3 > 2 * B ? temp1 - B : temp3 - B;
const denominatorLarge = A;
const root1 = numeratorLarge / denominatorLarge;
theta = Math.abs(Math.atan2(D * squareRootOfDiscriminant, -DBarD) / 3);
temp = 2 * Math.sqrt(-CBarD);
cosine = Math.cos(theta);
temp1 = temp * cosine;
temp3 = temp * (-cosine / 2 - halfSquareRootOf3 * Math.sin(theta));
const numeratorSmall = -D;
const denominatorSmall = temp1 + temp3 < 2 * C ? temp1 + C : temp3 + C;
const root3 = numeratorSmall / denominatorSmall;
const E = denominatorLarge * denominatorSmall;
const F = -numeratorLarge * denominatorSmall - denominatorLarge * numeratorSmall;
const G = numeratorLarge * numeratorSmall;
const root2 = (C * F - B * G) / (-B * F + C * E);
if (root1 <= root2) {
if (root1 <= root3) {
if (root2 <= root3) {
return [root1, root2, root3];
}
return [root1, root3, root2];
}
return [root3, root1, root2];
}
if (root1 <= root3) {
return [root2, root1, root3];
}
if (root2 <= root3) {
return [root2, root3, root1];
}
return [root3, root2, root1];
}
CubicRealPolynomial.computeRealRoots = function(a, b, c, d) {
if (typeof a !== "number") {
throw new DeveloperError_default("a is a required number.");
}
if (typeof b !== "number") {
throw new DeveloperError_default("b is a required number.");
}
if (typeof c !== "number") {
throw new DeveloperError_default("c is a required number.");
}
if (typeof d !== "number") {
throw new DeveloperError_default("d is a required number.");
}
let roots;
let ratio;
if (a === 0) {
return QuadraticRealPolynomial_default.computeRealRoots(b, c, d);
} else if (b === 0) {
if (c === 0) {
if (d === 0) {
return [0, 0, 0];
}
ratio = -d / a;
const root = ratio < 0 ? -Math.pow(-ratio, 1 / 3) : Math.pow(ratio, 1 / 3);
return [root, root, root];
} else if (d === 0) {
roots = QuadraticRealPolynomial_default.computeRealRoots(a, 0, c);
if (roots.Length === 0) {
return [0];
}
return [roots[0], 0, roots[1]];
}
return computeRealRoots(a, 0, c, d);
} else if (c === 0) {
if (d === 0) {
ratio = -b / a;
if (ratio < 0) {
return [ratio, 0, 0];
}
return [0, 0, ratio];
}
return computeRealRoots(a, b, 0, d);
} else if (d === 0) {
roots = QuadraticRealPolynomial_default.computeRealRoots(a, b, c);
if (roots.length === 0) {
return [0];
} else if (roots[1] <= 0) {
return [roots[0], roots[1], 0];
} else if (roots[0] >= 0) {
return [0, roots[0], roots[1]];
}
return [roots[0], 0, roots[1]];
}
return computeRealRoots(a, b, c, d);
};
var CubicRealPolynomial_default = CubicRealPolynomial;
// packages/engine/Source/Core/QuarticRealPolynomial.js
var QuarticRealPolynomial = {};
QuarticRealPolynomial.computeDiscriminant = function(a, b, c, d, e) {
if (typeof a !== "number") {
throw new DeveloperError_default("a is a required number.");
}
if (typeof b !== "number") {
throw new DeveloperError_default("b is a required number.");
}
if (typeof c !== "number") {
throw new DeveloperError_default("c is a required number.");
}
if (typeof d !== "number") {
throw new DeveloperError_default("d is a required number.");
}
if (typeof e !== "number") {
throw new DeveloperError_default("e is a required number.");
}
const a2 = a * a;
const a3 = a2 * a;
const b2 = b * b;
const b3 = b2 * b;
const c2 = c * c;
const c3 = c2 * c;
const d2 = d * d;
const d3 = d2 * d;
const e2 = e * e;
const e3 = e2 * e;
const discriminant = b2 * c2 * d2 - 4 * b3 * d3 - 4 * a * c3 * d2 + 18 * a * b * c * d3 - 27 * a2 * d2 * d2 + 256 * a3 * e3 + e * (18 * b3 * c * d - 4 * b2 * c3 + 16 * a * c2 * c2 - 80 * a * b * c2 * d - 6 * a * b2 * d2 + 144 * a2 * c * d2) + e2 * (144 * a * b2 * c - 27 * b2 * b2 - 128 * a2 * c2 - 192 * a2 * b * d);
return discriminant;
};
function original(a3, a2, a1, a0) {
const a3Squared = a3 * a3;
const p = a2 - 3 * a3Squared / 8;
const q = a1 - a2 * a3 / 2 + a3Squared * a3 / 8;
const r = a0 - a1 * a3 / 4 + a2 * a3Squared / 16 - 3 * a3Squared * a3Squared / 256;
const cubicRoots = CubicRealPolynomial_default.computeRealRoots(
1,
2 * p,
p * p - 4 * r,
-q * q
);
if (cubicRoots.length > 0) {
const temp = -a3 / 4;
const hSquared = cubicRoots[cubicRoots.length - 1];
if (Math.abs(hSquared) < Math_default.EPSILON14) {
const roots = QuadraticRealPolynomial_default.computeRealRoots(1, p, r);
if (roots.length === 2) {
const root0 = roots[0];
const root1 = roots[1];
let y;
if (root0 >= 0 && root1 >= 0) {
const y0 = Math.sqrt(root0);
const y1 = Math.sqrt(root1);
return [temp - y1, temp - y0, temp + y0, temp + y1];
} else if (root0 >= 0 && root1 < 0) {
y = Math.sqrt(root0);
return [temp - y, temp + y];
} else if (root0 < 0 && root1 >= 0) {
y = Math.sqrt(root1);
return [temp - y, temp + y];
}
}
return [];
} else if (hSquared > 0) {
const h = Math.sqrt(hSquared);
const m = (p + hSquared - q / h) / 2;
const n = (p + hSquared + q / h) / 2;
const roots1 = QuadraticRealPolynomial_default.computeRealRoots(1, h, m);
const roots2 = QuadraticRealPolynomial_default.computeRealRoots(1, -h, n);
if (roots1.length !== 0) {
roots1[0] += temp;
roots1[1] += temp;
if (roots2.length !== 0) {
roots2[0] += temp;
roots2[1] += temp;
if (roots1[1] <= roots2[0]) {
return [roots1[0], roots1[1], roots2[0], roots2[1]];
} else if (roots2[1] <= roots1[0]) {
return [roots2[0], roots2[1], roots1[0], roots1[1]];
} else if (roots1[0] >= roots2[0] && roots1[1] <= roots2[1]) {
return [roots2[0], roots1[0], roots1[1], roots2[1]];
} else if (roots2[0] >= roots1[0] && roots2[1] <= roots1[1]) {
return [roots1[0], roots2[0], roots2[1], roots1[1]];
} else if (roots1[0] > roots2[0] && roots1[0] < roots2[1]) {
return [roots2[0], roots1[0], roots2[1], roots1[1]];
}
return [roots1[0], roots2[0], roots1[1], roots2[1]];
}
return roots1;
}
if (roots2.length !== 0) {
roots2[0] += temp;
roots2[1] += temp;
return roots2;
}
return [];
}
}
return [];
}
function neumark(a3, a2, a1, a0) {
const a1Squared = a1 * a1;
const a2Squared = a2 * a2;
const a3Squared = a3 * a3;
const p = -2 * a2;
const q = a1 * a3 + a2Squared - 4 * a0;
const r = a3Squared * a0 - a1 * a2 * a3 + a1Squared;
const cubicRoots = CubicRealPolynomial_default.computeRealRoots(1, p, q, r);
if (cubicRoots.length > 0) {
const y = cubicRoots[0];
const temp = a2 - y;
const tempSquared = temp * temp;
const g1 = a3 / 2;
const h1 = temp / 2;
const m = tempSquared - 4 * a0;
const mError = tempSquared + 4 * Math.abs(a0);
const n = a3Squared - 4 * y;
const nError = a3Squared + 4 * Math.abs(y);
let g2;
let h2;
if (y < 0 || m * nError < n * mError) {
const squareRootOfN = Math.sqrt(n);
g2 = squareRootOfN / 2;
h2 = squareRootOfN === 0 ? 0 : (a3 * h1 - a1) / squareRootOfN;
} else {
const squareRootOfM = Math.sqrt(m);
g2 = squareRootOfM === 0 ? 0 : (a3 * h1 - a1) / squareRootOfM;
h2 = squareRootOfM / 2;
}
let G;
let g;
if (g1 === 0 && g2 === 0) {
G = 0;
g = 0;
} else if (Math_default.sign(g1) === Math_default.sign(g2)) {
G = g1 + g2;
g = y / G;
} else {
g = g1 - g2;
G = y / g;
}
let H;
let h;
if (h1 === 0 && h2 === 0) {
H = 0;
h = 0;
} else if (Math_default.sign(h1) === Math_default.sign(h2)) {
H = h1 + h2;
h = a0 / H;
} else {
h = h1 - h2;
H = a0 / h;
}
const roots1 = QuadraticRealPolynomial_default.computeRealRoots(1, G, H);
const roots2 = QuadraticRealPolynomial_default.computeRealRoots(1, g, h);
if (roots1.length !== 0) {
if (roots2.length !== 0) {
if (roots1[1] <= roots2[0]) {
return [roots1[0], roots1[1], roots2[0], roots2[1]];
} else if (roots2[1] <= roots1[0]) {
return [roots2[0], roots2[1], roots1[0], roots1[1]];
} else if (roots1[0] >= roots2[0] && roots1[1] <= roots2[1]) {
return [roots2[0], roots1[0], roots1[1], roots2[1]];
} else if (roots2[0] >= roots1[0] && roots2[1] <= roots1[1]) {
return [roots1[0], roots2[0], roots2[1], roots1[1]];
} else if (roots1[0] > roots2[0] && roots1[0] < roots2[1]) {
return [roots2[0], roots1[0], roots2[1], roots1[1]];
}
return [roots1[0], roots2[0], roots1[1], roots2[1]];
}
return roots1;
}
if (roots2.length !== 0) {
return roots2;
}
}
return [];
}
QuarticRealPolynomial.computeRealRoots = function(a, b, c, d, e) {
if (typeof a !== "number") {
throw new DeveloperError_default("a is a required number.");
}
if (typeof b !== "number") {
throw new DeveloperError_default("b is a required number.");
}
if (typeof c !== "number") {
throw new DeveloperError_default("c is a required number.");
}
if (typeof d !== "number") {
throw new DeveloperError_default("d is a required number.");
}
if (typeof e !== "number") {
throw new DeveloperError_default("e is a required number.");
}
if (Math.abs(a) < Math_default.EPSILON15) {
return CubicRealPolynomial_default.computeRealRoots(b, c, d, e);
}
const a3 = b / a;
const a2 = c / a;
const a1 = d / a;
const a0 = e / a;
let k = a3 < 0 ? 1 : 0;
k += a2 < 0 ? k + 1 : k;
k += a1 < 0 ? k + 1 : k;
k += a0 < 0 ? k + 1 : k;
switch (k) {
case 0:
return original(a3, a2, a1, a0);
case 1:
return neumark(a3, a2, a1, a0);
case 2:
return neumark(a3, a2, a1, a0);
case 3:
return original(a3, a2, a1, a0);
case 4:
return original(a3, a2, a1, a0);
case 5:
return neumark(a3, a2, a1, a0);
case 6:
return original(a3, a2, a1, a0);
case 7:
return original(a3, a2, a1, a0);
case 8:
return neumark(a3, a2, a1, a0);
case 9:
return original(a3, a2, a1, a0);
case 10:
return original(a3, a2, a1, a0);
case 11:
return neumark(a3, a2, a1, a0);
case 12:
return original(a3, a2, a1, a0);
case 13:
return original(a3, a2, a1, a0);
case 14:
return original(a3, a2, a1, a0);
case 15:
return original(a3, a2, a1, a0);
default:
return void 0;
}
};
var QuarticRealPolynomial_default = QuarticRealPolynomial;
// packages/engine/Source/Core/Ray.js
function Ray(origin, direction) {
direction = Cartesian3_default.clone(defaultValue_default(direction, Cartesian3_default.ZERO));
if (!Cartesian3_default.equals(direction, Cartesian3_default.ZERO)) {
Cartesian3_default.normalize(direction, direction);
}
this.origin = Cartesian3_default.clone(defaultValue_default(origin, Cartesian3_default.ZERO));
this.direction = direction;
}
Ray.clone = function(ray, result) {
if (!defined_default(ray)) {
return void 0;
}
if (!defined_default(result)) {
return new Ray(ray.origin, ray.direction);
}
result.origin = Cartesian3_default.clone(ray.origin);
result.direction = Cartesian3_default.clone(ray.direction);
return result;
};
Ray.getPoint = function(ray, t, result) {
Check_default.typeOf.object("ray", ray);
Check_default.typeOf.number("t", t);
if (!defined_default(result)) {
result = new Cartesian3_default();
}
result = Cartesian3_default.multiplyByScalar(ray.direction, t, result);
return Cartesian3_default.add(ray.origin, result, result);
};
var Ray_default = Ray;
// packages/engine/Source/Core/IntersectionTests.js
var IntersectionTests = {};
IntersectionTests.rayPlane = function(ray, plane, result) {
if (!defined_default(ray)) {
throw new DeveloperError_default("ray is required.");
}
if (!defined_default(plane)) {
throw new DeveloperError_default("plane is required.");
}
if (!defined_default(result)) {
result = new Cartesian3_default();
}
const origin = ray.origin;
const direction = ray.direction;
const normal = plane.normal;
const denominator = Cartesian3_default.dot(normal, direction);
if (Math.abs(denominator) < Math_default.EPSILON15) {
return void 0;
}
const t = (-plane.distance - Cartesian3_default.dot(normal, origin)) / denominator;
if (t < 0) {
return void 0;
}
result = Cartesian3_default.multiplyByScalar(direction, t, result);
return Cartesian3_default.add(origin, result, result);
};
var scratchEdge0 = new Cartesian3_default();
var scratchEdge1 = new Cartesian3_default();
var scratchPVec = new Cartesian3_default();
var scratchTVec = new Cartesian3_default();
var scratchQVec = new Cartesian3_default();
IntersectionTests.rayTriangleParametric = function(ray, p0, p1, p2, cullBackFaces) {
if (!defined_default(ray)) {
throw new DeveloperError_default("ray is required.");
}
if (!defined_default(p0)) {
throw new DeveloperError_default("p0 is required.");
}
if (!defined_default(p1)) {
throw new DeveloperError_default("p1 is required.");
}
if (!defined_default(p2)) {
throw new DeveloperError_default("p2 is required.");
}
cullBackFaces = defaultValue_default(cullBackFaces, false);
const origin = ray.origin;
const direction = ray.direction;
const edge0 = Cartesian3_default.subtract(p1, p0, scratchEdge0);
const edge1 = Cartesian3_default.subtract(p2, p0, scratchEdge1);
const p = Cartesian3_default.cross(direction, edge1, scratchPVec);
const det = Cartesian3_default.dot(edge0, p);
let tvec;
let q;
let u;
let v;
let t;
if (cullBackFaces) {
if (det < Math_default.EPSILON6) {
return void 0;
}
tvec = Cartesian3_default.subtract(origin, p0, scratchTVec);
u = Cartesian3_default.dot(tvec, p);
if (u < 0 || u > det) {
return void 0;
}
q = Cartesian3_default.cross(tvec, edge0, scratchQVec);
v = Cartesian3_default.dot(direction, q);
if (v < 0 || u + v > det) {
return void 0;
}
t = Cartesian3_default.dot(edge1, q) / det;
} else {
if (Math.abs(det) < Math_default.EPSILON6) {
return void 0;
}
const invDet = 1 / det;
tvec = Cartesian3_default.subtract(origin, p0, scratchTVec);
u = Cartesian3_default.dot(tvec, p) * invDet;
if (u < 0 || u > 1) {
return void 0;
}
q = Cartesian3_default.cross(tvec, edge0, scratchQVec);
v = Cartesian3_default.dot(direction, q) * invDet;
if (v < 0 || u + v > 1) {
return void 0;
}
t = Cartesian3_default.dot(edge1, q) * invDet;
}
return t;
};
IntersectionTests.rayTriangle = function(ray, p0, p1, p2, cullBackFaces, result) {
const t = IntersectionTests.rayTriangleParametric(
ray,
p0,
p1,
p2,
cullBackFaces
);
if (!defined_default(t) || t < 0) {
return void 0;
}
if (!defined_default(result)) {
result = new Cartesian3_default();
}
Cartesian3_default.multiplyByScalar(ray.direction, t, result);
return Cartesian3_default.add(ray.origin, result, result);
};
var scratchLineSegmentTriangleRay = new Ray_default();
IntersectionTests.lineSegmentTriangle = function(v0, v1, p0, p1, p2, cullBackFaces, result) {
if (!defined_default(v0)) {
throw new DeveloperError_default("v0 is required.");
}
if (!defined_default(v1)) {
throw new DeveloperError_default("v1 is required.");
}
if (!defined_default(p0)) {
throw new DeveloperError_default("p0 is required.");
}
if (!defined_default(p1)) {
throw new DeveloperError_default("p1 is required.");
}
if (!defined_default(p2)) {
throw new DeveloperError_default("p2 is required.");
}
const ray = scratchLineSegmentTriangleRay;
Cartesian3_default.clone(v0, ray.origin);
Cartesian3_default.subtract(v1, v0, ray.direction);
Cartesian3_default.normalize(ray.direction, ray.direction);
const t = IntersectionTests.rayTriangleParametric(
ray,
p0,
p1,
p2,
cullBackFaces
);
if (!defined_default(t) || t < 0 || t > Cartesian3_default.distance(v0, v1)) {
return void 0;
}
if (!defined_default(result)) {
result = new Cartesian3_default();
}
Cartesian3_default.multiplyByScalar(ray.direction, t, result);
return Cartesian3_default.add(ray.origin, result, result);
};
function solveQuadratic(a, b, c, result) {
const det = b * b - 4 * a * c;
if (det < 0) {
return void 0;
} else if (det > 0) {
const denom = 1 / (2 * a);
const disc = Math.sqrt(det);
const root0 = (-b + disc) * denom;
const root1 = (-b - disc) * denom;
if (root0 < root1) {
result.root0 = root0;
result.root1 = root1;
} else {
result.root0 = root1;
result.root1 = root0;
}
return result;
}
const root = -b / (2 * a);
if (root === 0) {
return void 0;
}
result.root0 = result.root1 = root;
return result;
}
var raySphereRoots = {
root0: 0,
root1: 0
};
function raySphere(ray, sphere, result) {
if (!defined_default(result)) {
result = new Interval_default();
}
const origin = ray.origin;
const direction = ray.direction;
const center = sphere.center;
const radiusSquared = sphere.radius * sphere.radius;
const diff = Cartesian3_default.subtract(origin, center, scratchPVec);
const a = Cartesian3_default.dot(direction, direction);
const b = 2 * Cartesian3_default.dot(direction, diff);
const c = Cartesian3_default.magnitudeSquared(diff) - radiusSquared;
const roots = solveQuadratic(a, b, c, raySphereRoots);
if (!defined_default(roots)) {
return void 0;
}
result.start = roots.root0;
result.stop = roots.root1;
return result;
}
IntersectionTests.raySphere = function(ray, sphere, result) {
if (!defined_default(ray)) {
throw new DeveloperError_default("ray is required.");
}
if (!defined_default(sphere)) {
throw new DeveloperError_default("sphere is required.");
}
result = raySphere(ray, sphere, result);
if (!defined_default(result) || result.stop < 0) {
return void 0;
}
result.start = Math.max(result.start, 0);
return result;
};
var scratchLineSegmentRay = new Ray_default();
IntersectionTests.lineSegmentSphere = function(p0, p1, sphere, result) {
if (!defined_default(p0)) {
throw new DeveloperError_default("p0 is required.");
}
if (!defined_default(p1)) {
throw new DeveloperError_default("p1 is required.");
}
if (!defined_default(sphere)) {
throw new DeveloperError_default("sphere is required.");
}
const ray = scratchLineSegmentRay;
Cartesian3_default.clone(p0, ray.origin);
const direction = Cartesian3_default.subtract(p1, p0, ray.direction);
const maxT = Cartesian3_default.magnitude(direction);
Cartesian3_default.normalize(direction, direction);
result = raySphere(ray, sphere, result);
if (!defined_default(result) || result.stop < 0 || result.start > maxT) {
return void 0;
}
result.start = Math.max(result.start, 0);
result.stop = Math.min(result.stop, maxT);
return result;
};
var scratchQ = new Cartesian3_default();
var scratchW = new Cartesian3_default();
IntersectionTests.rayEllipsoid = function(ray, ellipsoid) {
if (!defined_default(ray)) {
throw new DeveloperError_default("ray is required.");
}
if (!defined_default(ellipsoid)) {
throw new DeveloperError_default("ellipsoid is required.");
}
const inverseRadii = ellipsoid.oneOverRadii;
const q = Cartesian3_default.multiplyComponents(inverseRadii, ray.origin, scratchQ);
const w = Cartesian3_default.multiplyComponents(
inverseRadii,
ray.direction,
scratchW
);
const q2 = Cartesian3_default.magnitudeSquared(q);
const qw = Cartesian3_default.dot(q, w);
let difference, w2, product, discriminant, temp;
if (q2 > 1) {
if (qw >= 0) {
return void 0;
}
const qw2 = qw * qw;
difference = q2 - 1;
w2 = Cartesian3_default.magnitudeSquared(w);
product = w2 * difference;
if (qw2 < product) {
return void 0;
} else if (qw2 > product) {
discriminant = qw * qw - product;
temp = -qw + Math.sqrt(discriminant);
const root0 = temp / w2;
const root1 = difference / temp;
if (root0 < root1) {
return new Interval_default(root0, root1);
}
return {
start: root1,
stop: root0
};
}
const root = Math.sqrt(difference / w2);
return new Interval_default(root, root);
} else if (q2 < 1) {
difference = q2 - 1;
w2 = Cartesian3_default.magnitudeSquared(w);
product = w2 * difference;
discriminant = qw * qw - product;
temp = -qw + Math.sqrt(discriminant);
return new Interval_default(0, temp / w2);
}
if (qw < 0) {
w2 = Cartesian3_default.magnitudeSquared(w);
return new Interval_default(0, -qw / w2);
}
return void 0;
};
function addWithCancellationCheck2(left, right, tolerance) {
const difference = left + right;
if (Math_default.sign(left) !== Math_default.sign(right) && Math.abs(difference / Math.max(Math.abs(left), Math.abs(right))) < tolerance) {
return 0;
}
return difference;
}
IntersectionTests.quadraticVectorExpression = function(A, b, c, x, w) {
const xSquared = x * x;
const wSquared = w * w;
const l2 = (A[Matrix3_default.COLUMN1ROW1] - A[Matrix3_default.COLUMN2ROW2]) * wSquared;
const l1 = w * (x * addWithCancellationCheck2(
A[Matrix3_default.COLUMN1ROW0],
A[Matrix3_default.COLUMN0ROW1],
Math_default.EPSILON15
) + b.y);
const l0 = A[Matrix3_default.COLUMN0ROW0] * xSquared + A[Matrix3_default.COLUMN2ROW2] * wSquared + x * b.x + c;
const r1 = wSquared * addWithCancellationCheck2(
A[Matrix3_default.COLUMN2ROW1],
A[Matrix3_default.COLUMN1ROW2],
Math_default.EPSILON15
);
const r0 = w * (x * addWithCancellationCheck2(A[Matrix3_default.COLUMN2ROW0], A[Matrix3_default.COLUMN0ROW2]) + b.z);
let cosines;
const solutions = [];
if (r0 === 0 && r1 === 0) {
cosines = QuadraticRealPolynomial_default.computeRealRoots(l2, l1, l0);
if (cosines.length === 0) {
return solutions;
}
const cosine0 = cosines[0];
const sine0 = Math.sqrt(Math.max(1 - cosine0 * cosine0, 0));
solutions.push(new Cartesian3_default(x, w * cosine0, w * -sine0));
solutions.push(new Cartesian3_default(x, w * cosine0, w * sine0));
if (cosines.length === 2) {
const cosine1 = cosines[1];
const sine1 = Math.sqrt(Math.max(1 - cosine1 * cosine1, 0));
solutions.push(new Cartesian3_default(x, w * cosine1, w * -sine1));
solutions.push(new Cartesian3_default(x, w * cosine1, w * sine1));
}
return solutions;
}
const r0Squared = r0 * r0;
const r1Squared = r1 * r1;
const l2Squared = l2 * l2;
const r0r1 = r0 * r1;
const c4 = l2Squared + r1Squared;
const c3 = 2 * (l1 * l2 + r0r1);
const c2 = 2 * l0 * l2 + l1 * l1 - r1Squared + r0Squared;
const c1 = 2 * (l0 * l1 - r0r1);
const c0 = l0 * l0 - r0Squared;
if (c4 === 0 && c3 === 0 && c2 === 0 && c1 === 0) {
return solutions;
}
cosines = QuarticRealPolynomial_default.computeRealRoots(c4, c3, c2, c1, c0);
const length = cosines.length;
if (length === 0) {
return solutions;
}
for (let i = 0; i < length; ++i) {
const cosine = cosines[i];
const cosineSquared = cosine * cosine;
const sineSquared = Math.max(1 - cosineSquared, 0);
const sine = Math.sqrt(sineSquared);
let left;
if (Math_default.sign(l2) === Math_default.sign(l0)) {
left = addWithCancellationCheck2(
l2 * cosineSquared + l0,
l1 * cosine,
Math_default.EPSILON12
);
} else if (Math_default.sign(l0) === Math_default.sign(l1 * cosine)) {
left = addWithCancellationCheck2(
l2 * cosineSquared,
l1 * cosine + l0,
Math_default.EPSILON12
);
} else {
left = addWithCancellationCheck2(
l2 * cosineSquared + l1 * cosine,
l0,
Math_default.EPSILON12
);
}
const right = addWithCancellationCheck2(
r1 * cosine,
r0,
Math_default.EPSILON15
);
const product = left * right;
if (product < 0) {
solutions.push(new Cartesian3_default(x, w * cosine, w * sine));
} else if (product > 0) {
solutions.push(new Cartesian3_default(x, w * cosine, w * -sine));
} else if (sine !== 0) {
solutions.push(new Cartesian3_default(x, w * cosine, w * -sine));
solutions.push(new Cartesian3_default(x, w * cosine, w * sine));
++i;
} else {
solutions.push(new Cartesian3_default(x, w * cosine, w * sine));
}
}
return solutions;
};
var firstAxisScratch = new Cartesian3_default();
var secondAxisScratch = new Cartesian3_default();
var thirdAxisScratch = new Cartesian3_default();
var referenceScratch = new Cartesian3_default();
var bCart = new Cartesian3_default();
var bScratch = new Matrix3_default();
var btScratch = new Matrix3_default();
var diScratch = new Matrix3_default();
var dScratch = new Matrix3_default();
var cScratch = new Matrix3_default();
var tempMatrix = new Matrix3_default();
var aScratch = new Matrix3_default();
var sScratch = new Cartesian3_default();
var closestScratch = new Cartesian3_default();
var surfPointScratch = new Cartographic_default();
IntersectionTests.grazingAltitudeLocation = function(ray, ellipsoid) {
if (!defined_default(ray)) {
throw new DeveloperError_default("ray is required.");
}
if (!defined_default(ellipsoid)) {
throw new DeveloperError_default("ellipsoid is required.");
}
const position = ray.origin;
const direction = ray.direction;
if (!Cartesian3_default.equals(position, Cartesian3_default.ZERO)) {
const normal = ellipsoid.geodeticSurfaceNormal(position, firstAxisScratch);
if (Cartesian3_default.dot(direction, normal) >= 0) {
return position;
}
}
const intersects = defined_default(this.rayEllipsoid(ray, ellipsoid));
const f = ellipsoid.transformPositionToScaledSpace(
direction,
firstAxisScratch
);
const firstAxis = Cartesian3_default.normalize(f, f);
const reference = Cartesian3_default.mostOrthogonalAxis(f, referenceScratch);
const secondAxis = Cartesian3_default.normalize(
Cartesian3_default.cross(reference, firstAxis, secondAxisScratch),
secondAxisScratch
);
const thirdAxis = Cartesian3_default.normalize(
Cartesian3_default.cross(firstAxis, secondAxis, thirdAxisScratch),
thirdAxisScratch
);
const B = bScratch;
B[0] = firstAxis.x;
B[1] = firstAxis.y;
B[2] = firstAxis.z;
B[3] = secondAxis.x;
B[4] = secondAxis.y;
B[5] = secondAxis.z;
B[6] = thirdAxis.x;
B[7] = thirdAxis.y;
B[8] = thirdAxis.z;
const B_T = Matrix3_default.transpose(B, btScratch);
const D_I = Matrix3_default.fromScale(ellipsoid.radii, diScratch);
const D = Matrix3_default.fromScale(ellipsoid.oneOverRadii, dScratch);
const C = cScratch;
C[0] = 0;
C[1] = -direction.z;
C[2] = direction.y;
C[3] = direction.z;
C[4] = 0;
C[5] = -direction.x;
C[6] = -direction.y;
C[7] = direction.x;
C[8] = 0;
const temp = Matrix3_default.multiply(
Matrix3_default.multiply(B_T, D, tempMatrix),
C,
tempMatrix
);
const A = Matrix3_default.multiply(
Matrix3_default.multiply(temp, D_I, aScratch),
B,
aScratch
);
const b = Matrix3_default.multiplyByVector(temp, position, bCart);
const solutions = IntersectionTests.quadraticVectorExpression(
A,
Cartesian3_default.negate(b, firstAxisScratch),
0,
0,
1
);
let s;
let altitude;
const length = solutions.length;
if (length > 0) {
let closest = Cartesian3_default.clone(Cartesian3_default.ZERO, closestScratch);
let maximumValue = Number.NEGATIVE_INFINITY;
for (let i = 0; i < length; ++i) {
s = Matrix3_default.multiplyByVector(
D_I,
Matrix3_default.multiplyByVector(B, solutions[i], sScratch),
sScratch
);
const v = Cartesian3_default.normalize(
Cartesian3_default.subtract(s, position, referenceScratch),
referenceScratch
);
const dotProduct = Cartesian3_default.dot(v, direction);
if (dotProduct > maximumValue) {
maximumValue = dotProduct;
closest = Cartesian3_default.clone(s, closest);
}
}
const surfacePoint = ellipsoid.cartesianToCartographic(
closest,
surfPointScratch
);
maximumValue = Math_default.clamp(maximumValue, 0, 1);
altitude = Cartesian3_default.magnitude(
Cartesian3_default.subtract(closest, position, referenceScratch)
) * Math.sqrt(1 - maximumValue * maximumValue);
altitude = intersects ? -altitude : altitude;
surfacePoint.height = altitude;
return ellipsoid.cartographicToCartesian(surfacePoint, new Cartesian3_default());
}
return void 0;
};
var lineSegmentPlaneDifference = new Cartesian3_default();
IntersectionTests.lineSegmentPlane = function(endPoint0, endPoint1, plane, result) {
if (!defined_default(endPoint0)) {
throw new DeveloperError_default("endPoint0 is required.");
}
if (!defined_default(endPoint1)) {
throw new DeveloperError_default("endPoint1 is required.");
}
if (!defined_default(plane)) {
throw new DeveloperError_default("plane is required.");
}
if (!defined_default(result)) {
result = new Cartesian3_default();
}
const difference = Cartesian3_default.subtract(
endPoint1,
endPoint0,
lineSegmentPlaneDifference
);
const normal = plane.normal;
const nDotDiff = Cartesian3_default.dot(normal, difference);
if (Math.abs(nDotDiff) < Math_default.EPSILON6) {
return void 0;
}
const nDotP0 = Cartesian3_default.dot(normal, endPoint0);
const t = -(plane.distance + nDotP0) / nDotDiff;
if (t < 0 || t > 1) {
return void 0;
}
Cartesian3_default.multiplyByScalar(difference, t, result);
Cartesian3_default.add(endPoint0, result, result);
return result;
};
IntersectionTests.trianglePlaneIntersection = function(p0, p1, p2, plane) {
if (!defined_default(p0) || !defined_default(p1) || !defined_default(p2) || !defined_default(plane)) {
throw new DeveloperError_default("p0, p1, p2, and plane are required.");
}
const planeNormal = plane.normal;
const planeD = plane.distance;
const p0Behind = Cartesian3_default.dot(planeNormal, p0) + planeD < 0;
const p1Behind = Cartesian3_default.dot(planeNormal, p1) + planeD < 0;
const p2Behind = Cartesian3_default.dot(planeNormal, p2) + planeD < 0;
let numBehind = 0;
numBehind += p0Behind ? 1 : 0;
numBehind += p1Behind ? 1 : 0;
numBehind += p2Behind ? 1 : 0;
let u1, u2;
if (numBehind === 1 || numBehind === 2) {
u1 = new Cartesian3_default();
u2 = new Cartesian3_default();
}
if (numBehind === 1) {
if (p0Behind) {
IntersectionTests.lineSegmentPlane(p0, p1, plane, u1);
IntersectionTests.lineSegmentPlane(p0, p2, plane, u2);
return {
positions: [p0, p1, p2, u1, u2],
indices: [
// Behind
0,
3,
4,
// In front
1,
2,
4,
1,
4,
3
]
};
} else if (p1Behind) {
IntersectionTests.lineSegmentPlane(p1, p2, plane, u1);
IntersectionTests.lineSegmentPlane(p1, p0, plane, u2);
return {
positions: [p0, p1, p2, u1, u2],
indices: [
// Behind
1,
3,
4,
// In front
2,
0,
4,
2,
4,
3
]
};
} else if (p2Behind) {
IntersectionTests.lineSegmentPlane(p2, p0, plane, u1);
IntersectionTests.lineSegmentPlane(p2, p1, plane, u2);
return {
positions: [p0, p1, p2, u1, u2],
indices: [
// Behind
2,
3,
4,
// In front
0,
1,
4,
0,
4,
3
]
};
}
} else if (numBehind === 2) {
if (!p0Behind) {
IntersectionTests.lineSegmentPlane(p1, p0, plane, u1);
IntersectionTests.lineSegmentPlane(p2, p0, plane, u2);
return {
positions: [p0, p1, p2, u1, u2],
indices: [
// Behind
1,
2,
4,
1,
4,
3,
// In front
0,
3,
4
]
};
} else if (!p1Behind) {
IntersectionTests.lineSegmentPlane(p2, p1, plane, u1);
IntersectionTests.lineSegmentPlane(p0, p1, plane, u2);
return {
positions: [p0, p1, p2, u1, u2],
indices: [
// Behind
2,
0,
4,
2,
4,
3,
// In front
1,
3,
4
]
};
} else if (!p2Behind) {
IntersectionTests.lineSegmentPlane(p0, p2, plane, u1);
IntersectionTests.lineSegmentPlane(p1, p2, plane, u2);
return {
positions: [p0, p1, p2, u1, u2],
indices: [
// Behind
0,
1,
4,
0,
4,
3,
// In front
2,
3,
4
]
};
}
}
return void 0;
};
var IntersectionTests_default = IntersectionTests;
export {
Ray_default,
IntersectionTests_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Cartesian3_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/WebMercatorProjection.js
function WebMercatorProjection(ellipsoid) {
this._ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
this._semimajorAxis = this._ellipsoid.maximumRadius;
this._oneOverSemimajorAxis = 1 / this._semimajorAxis;
}
Object.defineProperties(WebMercatorProjection.prototype, {
/**
* Gets the {@link Ellipsoid}.
*
* @memberof WebMercatorProjection.prototype
*
* @type {Ellipsoid}
* @readonly
*/
ellipsoid: {
get: function() {
return this._ellipsoid;
}
}
});
WebMercatorProjection.mercatorAngleToGeodeticLatitude = function(mercatorAngle) {
return Math_default.PI_OVER_TWO - 2 * Math.atan(Math.exp(-mercatorAngle));
};
WebMercatorProjection.geodeticLatitudeToMercatorAngle = function(latitude) {
if (latitude > WebMercatorProjection.MaximumLatitude) {
latitude = WebMercatorProjection.MaximumLatitude;
} else if (latitude < -WebMercatorProjection.MaximumLatitude) {
latitude = -WebMercatorProjection.MaximumLatitude;
}
const sinLatitude = Math.sin(latitude);
return 0.5 * Math.log((1 + sinLatitude) / (1 - sinLatitude));
};
WebMercatorProjection.MaximumLatitude = WebMercatorProjection.mercatorAngleToGeodeticLatitude(
Math.PI
);
WebMercatorProjection.prototype.project = function(cartographic, result) {
const semimajorAxis = this._semimajorAxis;
const x = cartographic.longitude * semimajorAxis;
const y = WebMercatorProjection.geodeticLatitudeToMercatorAngle(
cartographic.latitude
) * semimajorAxis;
const z = cartographic.height;
if (!defined_default(result)) {
return new Cartesian3_default(x, y, z);
}
result.x = x;
result.y = y;
result.z = z;
return result;
};
WebMercatorProjection.prototype.unproject = function(cartesian, result) {
if (!defined_default(cartesian)) {
throw new DeveloperError_default("cartesian is required");
}
const oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
const longitude = cartesian.x * oneOverEarthSemimajorAxis;
const latitude = WebMercatorProjection.mercatorAngleToGeodeticLatitude(
cartesian.y * oneOverEarthSemimajorAxis
);
const height = cartesian.z;
if (!defined_default(result)) {
return new Cartographic_default(longitude, latitude, height);
}
result.longitude = longitude;
result.latitude = latitude;
result.height = height;
return result;
};
var WebMercatorProjection_default = WebMercatorProjection;
export {
WebMercatorProjection_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
PolylinePipeline_default
} from "./chunk-QN6TBED4.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-57H6I3SV.js";
import {
Cartesian3_default,
Cartographic_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/WallGeometryLibrary.js
var WallGeometryLibrary = {};
function latLonEquals(c0, c1) {
return Math_default.equalsEpsilon(c0.latitude, c1.latitude, Math_default.EPSILON10) && Math_default.equalsEpsilon(c0.longitude, c1.longitude, Math_default.EPSILON10);
}
var scratchCartographic1 = new Cartographic_default();
var scratchCartographic2 = new Cartographic_default();
function removeDuplicates(ellipsoid, positions, topHeights, bottomHeights) {
positions = arrayRemoveDuplicates_default(positions, Cartesian3_default.equalsEpsilon);
const length = positions.length;
if (length < 2) {
return;
}
const hasBottomHeights = defined_default(bottomHeights);
const hasTopHeights = defined_default(topHeights);
const cleanedPositions = new Array(length);
const cleanedTopHeights = new Array(length);
const cleanedBottomHeights = new Array(length);
const v0 = positions[0];
cleanedPositions[0] = v0;
const c0 = ellipsoid.cartesianToCartographic(v0, scratchCartographic1);
if (hasTopHeights) {
c0.height = topHeights[0];
}
cleanedTopHeights[0] = c0.height;
if (hasBottomHeights) {
cleanedBottomHeights[0] = bottomHeights[0];
} else {
cleanedBottomHeights[0] = 0;
}
const startTopHeight = cleanedTopHeights[0];
const startBottomHeight = cleanedBottomHeights[0];
let hasAllSameHeights = startTopHeight === startBottomHeight;
let index = 1;
for (let i = 1; i < length; ++i) {
const v1 = positions[i];
const c1 = ellipsoid.cartesianToCartographic(v1, scratchCartographic2);
if (hasTopHeights) {
c1.height = topHeights[i];
}
hasAllSameHeights = hasAllSameHeights && c1.height === 0;
if (!latLonEquals(c0, c1)) {
cleanedPositions[index] = v1;
cleanedTopHeights[index] = c1.height;
if (hasBottomHeights) {
cleanedBottomHeights[index] = bottomHeights[i];
} else {
cleanedBottomHeights[index] = 0;
}
hasAllSameHeights = hasAllSameHeights && cleanedTopHeights[index] === cleanedBottomHeights[index];
Cartographic_default.clone(c1, c0);
++index;
} else if (c0.height < c1.height) {
cleanedTopHeights[index - 1] = c1.height;
}
}
if (hasAllSameHeights || index < 2) {
return;
}
cleanedPositions.length = index;
cleanedTopHeights.length = index;
cleanedBottomHeights.length = index;
return {
positions: cleanedPositions,
topHeights: cleanedTopHeights,
bottomHeights: cleanedBottomHeights
};
}
var positionsArrayScratch = new Array(2);
var heightsArrayScratch = new Array(2);
var generateArcOptionsScratch = {
positions: void 0,
height: void 0,
granularity: void 0,
ellipsoid: void 0
};
WallGeometryLibrary.computePositions = function(ellipsoid, wallPositions, maximumHeights, minimumHeights, granularity, duplicateCorners) {
const o = removeDuplicates(
ellipsoid,
wallPositions,
maximumHeights,
minimumHeights
);
if (!defined_default(o)) {
return;
}
wallPositions = o.positions;
maximumHeights = o.topHeights;
minimumHeights = o.bottomHeights;
const length = wallPositions.length;
const numCorners = length - 2;
let topPositions;
let bottomPositions;
const minDistance = Math_default.chordLength(
granularity,
ellipsoid.maximumRadius
);
const generateArcOptions = generateArcOptionsScratch;
generateArcOptions.minDistance = minDistance;
generateArcOptions.ellipsoid = ellipsoid;
if (duplicateCorners) {
let count = 0;
let i;
for (i = 0; i < length - 1; i++) {
count += PolylinePipeline_default.numberOfPoints(
wallPositions[i],
wallPositions[i + 1],
minDistance
) + 1;
}
topPositions = new Float64Array(count * 3);
bottomPositions = new Float64Array(count * 3);
const generateArcPositions = positionsArrayScratch;
const generateArcHeights = heightsArrayScratch;
generateArcOptions.positions = generateArcPositions;
generateArcOptions.height = generateArcHeights;
let offset = 0;
for (i = 0; i < length - 1; i++) {
generateArcPositions[0] = wallPositions[i];
generateArcPositions[1] = wallPositions[i + 1];
generateArcHeights[0] = maximumHeights[i];
generateArcHeights[1] = maximumHeights[i + 1];
const pos = PolylinePipeline_default.generateArc(generateArcOptions);
topPositions.set(pos, offset);
generateArcHeights[0] = minimumHeights[i];
generateArcHeights[1] = minimumHeights[i + 1];
bottomPositions.set(
PolylinePipeline_default.generateArc(generateArcOptions),
offset
);
offset += pos.length;
}
} else {
generateArcOptions.positions = wallPositions;
generateArcOptions.height = maximumHeights;
topPositions = new Float64Array(
PolylinePipeline_default.generateArc(generateArcOptions)
);
generateArcOptions.height = minimumHeights;
bottomPositions = new Float64Array(
PolylinePipeline_default.generateArc(generateArcOptions)
);
}
return {
bottomPositions,
topPositions,
numCorners
};
};
var WallGeometryLibrary_default = WallGeometryLibrary;
export {
WallGeometryLibrary_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
EllipsoidRhumbLine_default
} from "./chunk-JSQJDZI4.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-JXVLNVXC.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian2_default,
Cartesian3_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
WebGLConstants_default
} from "./chunk-3HQMMUPU.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/WindingOrder.js
var WindingOrder = {
/**
* Vertices are in clockwise order.
*
* @type {number}
* @constant
*/
CLOCKWISE: WebGLConstants_default.CW,
/**
* Vertices are in counter-clockwise order.
*
* @type {number}
* @constant
*/
COUNTER_CLOCKWISE: WebGLConstants_default.CCW
};
WindingOrder.validate = function(windingOrder) {
return windingOrder === WindingOrder.CLOCKWISE || windingOrder === WindingOrder.COUNTER_CLOCKWISE;
};
var WindingOrder_default = Object.freeze(WindingOrder);
// node_modules/earcut/src/earcut.js
function earcut(data, holeIndices, dim = 2) {
const hasHoles = holeIndices && holeIndices.length;
const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
let outerNode = linkedList(data, 0, outerLen, dim, true);
const triangles = [];
if (!outerNode || outerNode.next === outerNode.prev) return triangles;
let minX, minY, invSize;
if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
if (data.length > 80 * dim) {
minX = Infinity;
minY = Infinity;
let maxX = -Infinity;
let maxY = -Infinity;
for (let i = dim; i < outerLen; i += dim) {
const x = data[i];
const y = data[i + 1];
if (x < minX) minX = x;
if (y < minY) minY = y;
if (x > maxX) maxX = x;
if (y > maxY) maxY = y;
}
invSize = Math.max(maxX - minX, maxY - minY);
invSize = invSize !== 0 ? 32767 / invSize : 0;
}
earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
return triangles;
}
function linkedList(data, start, end, dim, clockwise) {
let last;
if (clockwise === signedArea(data, start, end, dim) > 0) {
for (let i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
} else {
for (let i = end - dim; i >= start; i -= dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
}
if (last && equals(last, last.next)) {
removeNode(last);
last = last.next;
}
return last;
}
function filterPoints(start, end) {
if (!start) return start;
if (!end) end = start;
let p = start, again;
do {
again = false;
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
removeNode(p);
p = end = p.prev;
if (p === p.next) break;
again = true;
} else {
p = p.next;
}
} while (again || p !== end);
return end;
}
function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
if (!ear) return;
if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
let stop = ear;
while (ear.prev !== ear.next) {
const prev = ear.prev;
const next = ear.next;
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
triangles.push(prev.i, ear.i, next.i);
removeNode(ear);
ear = next.next;
stop = next.next;
continue;
}
ear = next;
if (ear === stop) {
if (!pass) {
earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
} else if (pass === 1) {
ear = cureLocalIntersections(filterPoints(ear), triangles);
earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
} else if (pass === 2) {
splitEarcut(ear, triangles, dim, minX, minY, invSize);
}
break;
}
}
}
function isEar(ear) {
const a = ear.prev, b = ear, c = ear.next;
if (area(a, b, c) >= 0) return false;
const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
let p = c.next;
while (p !== a) {
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
p = p.next;
}
return true;
}
function isEarHashed(ear, minX, minY, invSize) {
const a = ear.prev, b = ear, c = ear.next;
if (area(a, b, c) >= 0) return false;
const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
const minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);
let p = ear.prevZ, n = ear.nextZ;
while (p && p.z >= minZ && n && n.z <= maxZ) {
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
p = p.prevZ;
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
n = n.nextZ;
}
while (p && p.z >= minZ) {
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
p = p.prevZ;
}
while (n && n.z <= maxZ) {
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
n = n.nextZ;
}
return true;
}
function cureLocalIntersections(start, triangles) {
let p = start;
do {
const a = p.prev, b = p.next.next;
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
triangles.push(a.i, p.i, b.i);
removeNode(p);
removeNode(p.next);
p = start = b;
}
p = p.next;
} while (p !== start);
return filterPoints(p);
}
function splitEarcut(start, triangles, dim, minX, minY, invSize) {
let a = start;
do {
let b = a.next.next;
while (b !== a.prev) {
if (a.i !== b.i && isValidDiagonal(a, b)) {
let c = splitPolygon(a, b);
a = filterPoints(a, a.next);
c = filterPoints(c, c.next);
earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
return;
}
b = b.next;
}
a = a.next;
} while (a !== start);
}
function eliminateHoles(data, holeIndices, outerNode, dim) {
const queue = [];
for (let i = 0, len = holeIndices.length; i < len; i++) {
const start = holeIndices[i] * dim;
const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
const list = linkedList(data, start, end, dim, false);
if (list === list.next) list.steiner = true;
queue.push(getLeftmost(list));
}
queue.sort(compareX);
for (let i = 0; i < queue.length; i++) {
outerNode = eliminateHole(queue[i], outerNode);
}
return outerNode;
}
function compareX(a, b) {
return a.x - b.x;
}
function eliminateHole(hole, outerNode) {
const bridge = findHoleBridge(hole, outerNode);
if (!bridge) {
return outerNode;
}
const bridgeReverse = splitPolygon(bridge, hole);
filterPoints(bridgeReverse, bridgeReverse.next);
return filterPoints(bridge, bridge.next);
}
function findHoleBridge(hole, outerNode) {
let p = outerNode;
const hx = hole.x;
const hy = hole.y;
let qx = -Infinity;
let m;
do {
if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
if (x <= hx && x > qx) {
qx = x;
m = p.x < p.next.x ? p : p.next;
if (x === hx) return m;
}
}
p = p.next;
} while (p !== outerNode);
if (!m) return null;
const stop = m;
const mx = m.x;
const my = m.y;
let tanMin = Infinity;
p = m;
do {
if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
const tan = Math.abs(hy - p.y) / (hx - p.x);
if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
m = p;
tanMin = tan;
}
}
p = p.next;
} while (p !== stop);
return m;
}
function sectorContainsSector(m, p) {
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
}
function indexCurve(start, minX, minY, invSize) {
let p = start;
do {
if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
p.prevZ = p.prev;
p.nextZ = p.next;
p = p.next;
} while (p !== start);
p.prevZ.nextZ = null;
p.prevZ = null;
sortLinked(p);
}
function sortLinked(list) {
let numMerges;
let inSize = 1;
do {
let p = list;
let e;
list = null;
let tail = null;
numMerges = 0;
while (p) {
numMerges++;
let q = p;
let pSize = 0;
for (let i = 0; i < inSize; i++) {
pSize++;
q = q.nextZ;
if (!q) break;
}
let qSize = inSize;
while (pSize > 0 || qSize > 0 && q) {
if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
e = p;
p = p.nextZ;
pSize--;
} else {
e = q;
q = q.nextZ;
qSize--;
}
if (tail) tail.nextZ = e;
else list = e;
e.prevZ = tail;
tail = e;
}
p = q;
}
tail.nextZ = null;
inSize *= 2;
} while (numMerges > 1);
return list;
}
function zOrder(x, y, minX, minY, invSize) {
x = (x - minX) * invSize | 0;
y = (y - minY) * invSize | 0;
x = (x | x << 8) & 16711935;
x = (x | x << 4) & 252645135;
x = (x | x << 2) & 858993459;
x = (x | x << 1) & 1431655765;
y = (y | y << 8) & 16711935;
y = (y | y << 4) & 252645135;
y = (y | y << 2) & 858993459;
y = (y | y << 1) & 1431655765;
return x | y << 1;
}
function getLeftmost(start) {
let p = start, leftmost = start;
do {
if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;
p = p.next;
} while (p !== start);
return leftmost;
}
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
}
function isValidDiagonal(a, b) {
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
}
function area(p, q, r) {
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
}
function equals(p1, p2) {
return p1.x === p2.x && p1.y === p2.y;
}
function intersects(p1, q1, p2, q2) {
const o1 = sign(area(p1, q1, p2));
const o2 = sign(area(p1, q1, q2));
const o3 = sign(area(p2, q2, p1));
const o4 = sign(area(p2, q2, q1));
if (o1 !== o2 && o3 !== o4) return true;
if (o1 === 0 && onSegment(p1, p2, q1)) return true;
if (o2 === 0 && onSegment(p1, q2, q1)) return true;
if (o3 === 0 && onSegment(p2, p1, q2)) return true;
if (o4 === 0 && onSegment(p2, q1, q2)) return true;
return false;
}
function onSegment(p, q, r) {
return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
}
function sign(num) {
return num > 0 ? 1 : num < 0 ? -1 : 0;
}
function intersectsPolygon(a, b) {
let p = a;
do {
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
p = p.next;
} while (p !== a);
return false;
}
function locallyInside(a, b) {
return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
}
function middleInside(a, b) {
let p = a;
let inside = false;
const px = (a.x + b.x) / 2;
const py = (a.y + b.y) / 2;
do {
if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
inside = !inside;
p = p.next;
} while (p !== a);
return inside;
}
function splitPolygon(a, b) {
const a2 = createNode(a.i, a.x, a.y), b2 = createNode(b.i, b.x, b.y), an = a.next, bp = b.prev;
a.next = b;
b.prev = a;
a2.next = an;
an.prev = a2;
b2.next = a2;
a2.prev = b2;
bp.next = b2;
b2.prev = bp;
return b2;
}
function insertNode(i, x, y, last) {
const p = createNode(i, x, y);
if (!last) {
p.prev = p;
p.next = p;
} else {
p.next = last.next;
p.prev = last;
last.next.prev = p;
last.next = p;
}
return p;
}
function removeNode(p) {
p.next.prev = p.prev;
p.prev.next = p.next;
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
}
function createNode(i, x, y) {
return {
i,
// vertex index in coordinates array
x,
y,
// vertex coordinates
prev: null,
// previous and next vertex nodes in a polygon ring
next: null,
z: 0,
// z-order curve value
prevZ: null,
// previous and next nodes in z-order
nextZ: null,
steiner: false
// indicates whether this is a steiner point
};
}
function signedArea(data, start, end, dim) {
let sum = 0;
for (let i = start, j = end - dim; i < end; i += dim) {
sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
j = i;
}
return sum;
}
// packages/engine/Source/Core/PolygonPipeline.js
var scaleToGeodeticHeightN = new Cartesian3_default();
var scaleToGeodeticHeightP = new Cartesian3_default();
var PolygonPipeline = {};
PolygonPipeline.computeArea2D = function(positions) {
Check_default.defined("positions", positions);
Check_default.typeOf.number.greaterThanOrEquals(
"positions.length",
positions.length,
3
);
const length = positions.length;
let area2 = 0;
for (let i0 = length - 1, i1 = 0; i1 < length; i0 = i1++) {
const v0 = positions[i0];
const v1 = positions[i1];
area2 += v0.x * v1.y - v1.x * v0.y;
}
return area2 * 0.5;
};
PolygonPipeline.computeWindingOrder2D = function(positions) {
const area2 = PolygonPipeline.computeArea2D(positions);
return area2 > 0 ? WindingOrder_default.COUNTER_CLOCKWISE : WindingOrder_default.CLOCKWISE;
};
PolygonPipeline.triangulate = function(positions, holes) {
Check_default.defined("positions", positions);
const flattenedPositions = Cartesian2_default.packArray(positions);
return earcut(flattenedPositions, holes, 2);
};
var subdivisionV0Scratch = new Cartesian3_default();
var subdivisionV1Scratch = new Cartesian3_default();
var subdivisionV2Scratch = new Cartesian3_default();
var subdivisionS0Scratch = new Cartesian3_default();
var subdivisionS1Scratch = new Cartesian3_default();
var subdivisionS2Scratch = new Cartesian3_default();
var subdivisionMidScratch = new Cartesian3_default();
var subdivisionT0Scratch = new Cartesian2_default();
var subdivisionT1Scratch = new Cartesian2_default();
var subdivisionT2Scratch = new Cartesian2_default();
var subdivisionTexcoordMidScratch = new Cartesian2_default();
PolygonPipeline.computeSubdivision = function(ellipsoid, positions, indices, texcoords, granularity) {
granularity = defaultValue_default(granularity, Math_default.RADIANS_PER_DEGREE);
const hasTexcoords = defined_default(texcoords);
Check_default.typeOf.object("ellipsoid", ellipsoid);
Check_default.defined("positions", positions);
Check_default.defined("indices", indices);
Check_default.typeOf.number.greaterThanOrEquals("indices.length", indices.length, 3);
Check_default.typeOf.number.equals("indices.length % 3", "0", indices.length % 3, 0);
Check_default.typeOf.number.greaterThan("granularity", granularity, 0);
const triangles = indices.slice(0);
let i;
const length = positions.length;
const subdividedPositions = new Array(length * 3);
const subdividedTexcoords = new Array(length * 2);
let q = 0;
let p = 0;
for (i = 0; i < length; i++) {
const item = positions[i];
subdividedPositions[q++] = item.x;
subdividedPositions[q++] = item.y;
subdividedPositions[q++] = item.z;
if (hasTexcoords) {
const texcoordItem = texcoords[i];
subdividedTexcoords[p++] = texcoordItem.x;
subdividedTexcoords[p++] = texcoordItem.y;
}
}
const subdividedIndices = [];
const edges = {};
const radius = ellipsoid.maximumRadius;
const minDistance = Math_default.chordLength(granularity, radius);
const minDistanceSqrd = minDistance * minDistance;
while (triangles.length > 0) {
const i2 = triangles.pop();
const i1 = triangles.pop();
const i0 = triangles.pop();
const v0 = Cartesian3_default.fromArray(
subdividedPositions,
i0 * 3,
subdivisionV0Scratch
);
const v1 = Cartesian3_default.fromArray(
subdividedPositions,
i1 * 3,
subdivisionV1Scratch
);
const v2 = Cartesian3_default.fromArray(
subdividedPositions,
i2 * 3,
subdivisionV2Scratch
);
let t0, t1, t2;
if (hasTexcoords) {
t0 = Cartesian2_default.fromArray(
subdividedTexcoords,
i0 * 2,
subdivisionT0Scratch
);
t1 = Cartesian2_default.fromArray(
subdividedTexcoords,
i1 * 2,
subdivisionT1Scratch
);
t2 = Cartesian2_default.fromArray(
subdividedTexcoords,
i2 * 2,
subdivisionT2Scratch
);
}
const s0 = Cartesian3_default.multiplyByScalar(
Cartesian3_default.normalize(v0, subdivisionS0Scratch),
radius,
subdivisionS0Scratch
);
const s1 = Cartesian3_default.multiplyByScalar(
Cartesian3_default.normalize(v1, subdivisionS1Scratch),
radius,
subdivisionS1Scratch
);
const s2 = Cartesian3_default.multiplyByScalar(
Cartesian3_default.normalize(v2, subdivisionS2Scratch),
radius,
subdivisionS2Scratch
);
const g0 = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(s0, s1, subdivisionMidScratch)
);
const g1 = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(s1, s2, subdivisionMidScratch)
);
const g2 = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(s2, s0, subdivisionMidScratch)
);
const max = Math.max(g0, g1, g2);
let edge;
let mid;
let midTexcoord;
if (max > minDistanceSqrd) {
if (g0 === max) {
edge = `${Math.min(i0, i1)} ${Math.max(i0, i1)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = Cartesian3_default.add(v0, v1, subdivisionMidScratch);
Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
subdividedPositions.push(mid.x, mid.y, mid.z);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t0, t1, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i0, i, i2);
triangles.push(i, i1, i2);
} else if (g1 === max) {
edge = `${Math.min(i1, i2)} ${Math.max(i1, i2)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = Cartesian3_default.add(v1, v2, subdivisionMidScratch);
Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
subdividedPositions.push(mid.x, mid.y, mid.z);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t1, t2, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i1, i, i0);
triangles.push(i, i2, i0);
} else if (g2 === max) {
edge = `${Math.min(i2, i0)} ${Math.max(i2, i0)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = Cartesian3_default.add(v2, v0, subdivisionMidScratch);
Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
subdividedPositions.push(mid.x, mid.y, mid.z);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t2, t0, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i2, i, i1);
triangles.push(i, i0, i1);
}
} else {
subdividedIndices.push(i0);
subdividedIndices.push(i1);
subdividedIndices.push(i2);
}
}
const geometryOptions = {
attributes: {
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: subdividedPositions
})
},
indices: subdividedIndices,
primitiveType: PrimitiveType_default.TRIANGLES
};
if (hasTexcoords) {
geometryOptions.attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: subdividedTexcoords
});
}
return new Geometry_default(geometryOptions);
};
var subdivisionC0Scratch = new Cartographic_default();
var subdivisionC1Scratch = new Cartographic_default();
var subdivisionC2Scratch = new Cartographic_default();
var subdivisionCartographicScratch = new Cartographic_default();
PolygonPipeline.computeRhumbLineSubdivision = function(ellipsoid, positions, indices, texcoords, granularity) {
granularity = defaultValue_default(granularity, Math_default.RADIANS_PER_DEGREE);
const hasTexcoords = defined_default(texcoords);
Check_default.typeOf.object("ellipsoid", ellipsoid);
Check_default.defined("positions", positions);
Check_default.defined("indices", indices);
Check_default.typeOf.number.greaterThanOrEquals("indices.length", indices.length, 3);
Check_default.typeOf.number.equals("indices.length % 3", "0", indices.length % 3, 0);
Check_default.typeOf.number.greaterThan("granularity", granularity, 0);
const triangles = indices.slice(0);
let i;
const length = positions.length;
const subdividedPositions = new Array(length * 3);
const subdividedTexcoords = new Array(length * 2);
let q = 0;
let p = 0;
for (i = 0; i < length; i++) {
const item = positions[i];
subdividedPositions[q++] = item.x;
subdividedPositions[q++] = item.y;
subdividedPositions[q++] = item.z;
if (hasTexcoords) {
const texcoordItem = texcoords[i];
subdividedTexcoords[p++] = texcoordItem.x;
subdividedTexcoords[p++] = texcoordItem.y;
}
}
const subdividedIndices = [];
const edges = {};
const radius = ellipsoid.maximumRadius;
const minDistance = Math_default.chordLength(granularity, radius);
const rhumb0 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
const rhumb1 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
const rhumb2 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
while (triangles.length > 0) {
const i2 = triangles.pop();
const i1 = triangles.pop();
const i0 = triangles.pop();
const v0 = Cartesian3_default.fromArray(
subdividedPositions,
i0 * 3,
subdivisionV0Scratch
);
const v1 = Cartesian3_default.fromArray(
subdividedPositions,
i1 * 3,
subdivisionV1Scratch
);
const v2 = Cartesian3_default.fromArray(
subdividedPositions,
i2 * 3,
subdivisionV2Scratch
);
let t0, t1, t2;
if (hasTexcoords) {
t0 = Cartesian2_default.fromArray(
subdividedTexcoords,
i0 * 2,
subdivisionT0Scratch
);
t1 = Cartesian2_default.fromArray(
subdividedTexcoords,
i1 * 2,
subdivisionT1Scratch
);
t2 = Cartesian2_default.fromArray(
subdividedTexcoords,
i2 * 2,
subdivisionT2Scratch
);
}
const c0 = ellipsoid.cartesianToCartographic(v0, subdivisionC0Scratch);
const c1 = ellipsoid.cartesianToCartographic(v1, subdivisionC1Scratch);
const c2 = ellipsoid.cartesianToCartographic(v2, subdivisionC2Scratch);
rhumb0.setEndPoints(c0, c1);
const g0 = rhumb0.surfaceDistance;
rhumb1.setEndPoints(c1, c2);
const g1 = rhumb1.surfaceDistance;
rhumb2.setEndPoints(c2, c0);
const g2 = rhumb2.surfaceDistance;
const max = Math.max(g0, g1, g2);
let edge;
let mid;
let midHeight;
let midCartesian3;
let midTexcoord;
if (max > minDistance) {
if (g0 === max) {
edge = `${Math.min(i0, i1)} ${Math.max(i0, i1)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = rhumb0.interpolateUsingFraction(
0.5,
subdivisionCartographicScratch
);
midHeight = (c0.height + c1.height) * 0.5;
midCartesian3 = Cartesian3_default.fromRadians(
mid.longitude,
mid.latitude,
midHeight,
ellipsoid,
subdivisionMidScratch
);
subdividedPositions.push(
midCartesian3.x,
midCartesian3.y,
midCartesian3.z
);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t0, t1, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i0, i, i2);
triangles.push(i, i1, i2);
} else if (g1 === max) {
edge = `${Math.min(i1, i2)} ${Math.max(i1, i2)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = rhumb1.interpolateUsingFraction(
0.5,
subdivisionCartographicScratch
);
midHeight = (c1.height + c2.height) * 0.5;
midCartesian3 = Cartesian3_default.fromRadians(
mid.longitude,
mid.latitude,
midHeight,
ellipsoid,
subdivisionMidScratch
);
subdividedPositions.push(
midCartesian3.x,
midCartesian3.y,
midCartesian3.z
);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t1, t2, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i1, i, i0);
triangles.push(i, i2, i0);
} else if (g2 === max) {
edge = `${Math.min(i2, i0)} ${Math.max(i2, i0)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = rhumb2.interpolateUsingFraction(
0.5,
subdivisionCartographicScratch
);
midHeight = (c2.height + c0.height) * 0.5;
midCartesian3 = Cartesian3_default.fromRadians(
mid.longitude,
mid.latitude,
midHeight,
ellipsoid,
subdivisionMidScratch
);
subdividedPositions.push(
midCartesian3.x,
midCartesian3.y,
midCartesian3.z
);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t2, t0, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i2, i, i1);
triangles.push(i, i0, i1);
}
} else {
subdividedIndices.push(i0);
subdividedIndices.push(i1);
subdividedIndices.push(i2);
}
}
const geometryOptions = {
attributes: {
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: subdividedPositions
})
},
indices: subdividedIndices,
primitiveType: PrimitiveType_default.TRIANGLES
};
if (hasTexcoords) {
geometryOptions.attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: subdividedTexcoords
});
}
return new Geometry_default(geometryOptions);
};
PolygonPipeline.scaleToGeodeticHeight = function(positions, height, ellipsoid, scaleToSurface) {
ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
let n = scaleToGeodeticHeightN;
let p = scaleToGeodeticHeightP;
height = defaultValue_default(height, 0);
scaleToSurface = defaultValue_default(scaleToSurface, true);
if (defined_default(positions)) {
const length = positions.length;
for (let i = 0; i < length; i += 3) {
Cartesian3_default.fromArray(positions, i, p);
if (scaleToSurface) {
p = ellipsoid.scaleToGeodeticSurface(p, p);
}
if (height !== 0) {
n = ellipsoid.geodeticSurfaceNormal(p, n);
Cartesian3_default.multiplyByScalar(n, height, n);
Cartesian3_default.add(p, n, p);
}
positions[i] = p.x;
positions[i + 1] = p.y;
positions[i + 2] = p.z;
}
}
return positions;
};
var PolygonPipeline_default = PolygonPipeline;
export {
WindingOrder_default,
PolygonPipeline_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
OrientedBoundingBox_default
} from "./chunk-2PTKXHJB.js";
import {
Cartesian2_default,
Cartesian3_default,
Matrix3_default
} from "./chunk-FFLMY4TE.js";
import {
Check_default
} from "./chunk-P6TRGU3S.js";
// packages/engine/Source/Core/CoplanarPolygonGeometryLibrary.js
var CoplanarPolygonGeometryLibrary = {};
var scratchIntersectionPoint = new Cartesian3_default();
var scratchXAxis = new Cartesian3_default();
var scratchYAxis = new Cartesian3_default();
var scratchZAxis = new Cartesian3_default();
var obbScratch = new OrientedBoundingBox_default();
CoplanarPolygonGeometryLibrary.validOutline = function(positions) {
Check_default.defined("positions", positions);
const orientedBoundingBox = OrientedBoundingBox_default.fromPoints(
positions,
obbScratch
);
const halfAxes = orientedBoundingBox.halfAxes;
const xAxis = Matrix3_default.getColumn(halfAxes, 0, scratchXAxis);
const yAxis = Matrix3_default.getColumn(halfAxes, 1, scratchYAxis);
const zAxis = Matrix3_default.getColumn(halfAxes, 2, scratchZAxis);
const xMag = Cartesian3_default.magnitude(xAxis);
const yMag = Cartesian3_default.magnitude(yAxis);
const zMag = Cartesian3_default.magnitude(zAxis);
return !(xMag === 0 && (yMag === 0 || zMag === 0) || yMag === 0 && zMag === 0);
};
CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments = function(positions, centerResult, planeAxis1Result, planeAxis2Result) {
Check_default.defined("positions", positions);
Check_default.defined("centerResult", centerResult);
Check_default.defined("planeAxis1Result", planeAxis1Result);
Check_default.defined("planeAxis2Result", planeAxis2Result);
const orientedBoundingBox = OrientedBoundingBox_default.fromPoints(
positions,
obbScratch
);
const halfAxes = orientedBoundingBox.halfAxes;
const xAxis = Matrix3_default.getColumn(halfAxes, 0, scratchXAxis);
const yAxis = Matrix3_default.getColumn(halfAxes, 1, scratchYAxis);
const zAxis = Matrix3_default.getColumn(halfAxes, 2, scratchZAxis);
const xMag = Cartesian3_default.magnitude(xAxis);
const yMag = Cartesian3_default.magnitude(yAxis);
const zMag = Cartesian3_default.magnitude(zAxis);
const min = Math.min(xMag, yMag, zMag);
if (xMag === 0 && (yMag === 0 || zMag === 0) || yMag === 0 && zMag === 0) {
return false;
}
let planeAxis1;
let planeAxis2;
if (min === yMag || min === zMag) {
planeAxis1 = xAxis;
}
if (min === xMag) {
planeAxis1 = yAxis;
} else if (min === zMag) {
planeAxis2 = yAxis;
}
if (min === xMag || min === yMag) {
planeAxis2 = zAxis;
}
Cartesian3_default.normalize(planeAxis1, planeAxis1Result);
Cartesian3_default.normalize(planeAxis2, planeAxis2Result);
Cartesian3_default.clone(orientedBoundingBox.center, centerResult);
return true;
};
function projectTo2D(position, center, axis1, axis2, result) {
const v = Cartesian3_default.subtract(position, center, scratchIntersectionPoint);
const x = Cartesian3_default.dot(axis1, v);
const y = Cartesian3_default.dot(axis2, v);
return Cartesian2_default.fromElements(x, y, result);
}
CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction = function(center, axis1, axis2) {
return function(positions) {
const positionResults = new Array(positions.length);
for (let i = 0; i < positions.length; i++) {
positionResults[i] = projectTo2D(positions[i], center, axis1, axis2);
}
return positionResults;
};
};
CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction = function(center, axis1, axis2) {
return function(position, result) {
return projectTo2D(position, center, axis1, axis2, result);
};
};
var CoplanarPolygonGeometryLibrary_default = CoplanarPolygonGeometryLibrary;
export {
CoplanarPolygonGeometryLibrary_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
// packages/engine/Source/Core/defaultValue.js
function defaultValue(a, b) {
if (a !== void 0 && a !== null) {
return a;
}
return b;
}
defaultValue.EMPTY_OBJECT = Object.freeze({});
var defaultValue_default = defaultValue;
export {
defaultValue_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
__commonJS,
__toESM,
defined_default
} from "./chunk-YCDZX5LS.js";
// node_modules/mersenne-twister/src/mersenne-twister.js
var require_mersenne_twister = __commonJS({
"node_modules/mersenne-twister/src/mersenne-twister.js"(exports, module) {
var MersenneTwister2 = function(seed) {
if (seed == void 0) {
seed = (/* @__PURE__ */ new Date()).getTime();
}
this.N = 624;
this.M = 397;
this.MATRIX_A = 2567483615;
this.UPPER_MASK = 2147483648;
this.LOWER_MASK = 2147483647;
this.mt = new Array(this.N);
this.mti = this.N + 1;
if (seed.constructor == Array) {
this.init_by_array(seed, seed.length);
} else {
this.init_seed(seed);
}
};
MersenneTwister2.prototype.init_seed = function(s) {
this.mt[0] = s >>> 0;
for (this.mti = 1; this.mti < this.N; this.mti++) {
var s = this.mt[this.mti - 1] ^ this.mt[this.mti - 1] >>> 30;
this.mt[this.mti] = (((s & 4294901760) >>> 16) * 1812433253 << 16) + (s & 65535) * 1812433253 + this.mti;
this.mt[this.mti] >>>= 0;
}
};
MersenneTwister2.prototype.init_by_array = function(init_key, key_length) {
var i, j, k;
this.init_seed(19650218);
i = 1;
j = 0;
k = this.N > key_length ? this.N : key_length;
for (; k; k--) {
var s = this.mt[i - 1] ^ this.mt[i - 1] >>> 30;
this.mt[i] = (this.mt[i] ^ (((s & 4294901760) >>> 16) * 1664525 << 16) + (s & 65535) * 1664525) + init_key[j] + j;
this.mt[i] >>>= 0;
i++;
j++;
if (i >= this.N) {
this.mt[0] = this.mt[this.N - 1];
i = 1;
}
if (j >= key_length) j = 0;
}
for (k = this.N - 1; k; k--) {
var s = this.mt[i - 1] ^ this.mt[i - 1] >>> 30;
this.mt[i] = (this.mt[i] ^ (((s & 4294901760) >>> 16) * 1566083941 << 16) + (s & 65535) * 1566083941) - i;
this.mt[i] >>>= 0;
i++;
if (i >= this.N) {
this.mt[0] = this.mt[this.N - 1];
i = 1;
}
}
this.mt[0] = 2147483648;
};
MersenneTwister2.prototype.random_int = function() {
var y;
var mag01 = new Array(0, this.MATRIX_A);
if (this.mti >= this.N) {
var kk;
if (this.mti == this.N + 1)
this.init_seed(5489);
for (kk = 0; kk < this.N - this.M; kk++) {
y = this.mt[kk] & this.UPPER_MASK | this.mt[kk + 1] & this.LOWER_MASK;
this.mt[kk] = this.mt[kk + this.M] ^ y >>> 1 ^ mag01[y & 1];
}
for (; kk < this.N - 1; kk++) {
y = this.mt[kk] & this.UPPER_MASK | this.mt[kk + 1] & this.LOWER_MASK;
this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ y >>> 1 ^ mag01[y & 1];
}
y = this.mt[this.N - 1] & this.UPPER_MASK | this.mt[0] & this.LOWER_MASK;
this.mt[this.N - 1] = this.mt[this.M - 1] ^ y >>> 1 ^ mag01[y & 1];
this.mti = 0;
}
y = this.mt[this.mti++];
y ^= y >>> 11;
y ^= y << 7 & 2636928640;
y ^= y << 15 & 4022730752;
y ^= y >>> 18;
return y >>> 0;
};
MersenneTwister2.prototype.random_int31 = function() {
return this.random_int() >>> 1;
};
MersenneTwister2.prototype.random_incl = function() {
return this.random_int() * (1 / 4294967295);
};
MersenneTwister2.prototype.random = function() {
return this.random_int() * (1 / 4294967296);
};
MersenneTwister2.prototype.random_excl = function() {
return (this.random_int() + 0.5) * (1 / 4294967296);
};
MersenneTwister2.prototype.random_long = function() {
var a = this.random_int() >>> 5, b = this.random_int() >>> 6;
return (a * 67108864 + b) * (1 / 9007199254740992);
};
module.exports = MersenneTwister2;
}
});
// packages/engine/Source/Core/Math.js
var import_mersenne_twister = __toESM(require_mersenne_twister(), 1);
var CesiumMath = {};
CesiumMath.EPSILON1 = 0.1;
CesiumMath.EPSILON2 = 0.01;
CesiumMath.EPSILON3 = 1e-3;
CesiumMath.EPSILON4 = 1e-4;
CesiumMath.EPSILON5 = 1e-5;
CesiumMath.EPSILON6 = 1e-6;
CesiumMath.EPSILON7 = 1e-7;
CesiumMath.EPSILON8 = 1e-8;
CesiumMath.EPSILON9 = 1e-9;
CesiumMath.EPSILON10 = 1e-10;
CesiumMath.EPSILON11 = 1e-11;
CesiumMath.EPSILON12 = 1e-12;
CesiumMath.EPSILON13 = 1e-13;
CesiumMath.EPSILON14 = 1e-14;
CesiumMath.EPSILON15 = 1e-15;
CesiumMath.EPSILON16 = 1e-16;
CesiumMath.EPSILON17 = 1e-17;
CesiumMath.EPSILON18 = 1e-18;
CesiumMath.EPSILON19 = 1e-19;
CesiumMath.EPSILON20 = 1e-20;
CesiumMath.EPSILON21 = 1e-21;
CesiumMath.GRAVITATIONALPARAMETER = 3986004418e5;
CesiumMath.SOLAR_RADIUS = 6955e5;
CesiumMath.LUNAR_RADIUS = 1737400;
CesiumMath.SIXTY_FOUR_KILOBYTES = 64 * 1024;
CesiumMath.FOUR_GIGABYTES = 4 * 1024 * 1024 * 1024;
CesiumMath.sign = defaultValue_default(Math.sign, function sign(value) {
value = +value;
if (value === 0 || value !== value) {
return value;
}
return value > 0 ? 1 : -1;
});
CesiumMath.signNotZero = function(value) {
return value < 0 ? -1 : 1;
};
CesiumMath.toSNorm = function(value, rangeMaximum) {
rangeMaximum = defaultValue_default(rangeMaximum, 255);
return Math.round(
(CesiumMath.clamp(value, -1, 1) * 0.5 + 0.5) * rangeMaximum
);
};
CesiumMath.fromSNorm = function(value, rangeMaximum) {
rangeMaximum = defaultValue_default(rangeMaximum, 255);
return CesiumMath.clamp(value, 0, rangeMaximum) / rangeMaximum * 2 - 1;
};
CesiumMath.normalize = function(value, rangeMinimum, rangeMaximum) {
rangeMaximum = Math.max(rangeMaximum - rangeMinimum, 0);
return rangeMaximum === 0 ? 0 : CesiumMath.clamp((value - rangeMinimum) / rangeMaximum, 0, 1);
};
CesiumMath.sinh = defaultValue_default(Math.sinh, function sinh(value) {
return (Math.exp(value) - Math.exp(-value)) / 2;
});
CesiumMath.cosh = defaultValue_default(Math.cosh, function cosh(value) {
return (Math.exp(value) + Math.exp(-value)) / 2;
});
CesiumMath.lerp = function(p, q, time) {
return (1 - time) * p + time * q;
};
CesiumMath.PI = Math.PI;
CesiumMath.ONE_OVER_PI = 1 / Math.PI;
CesiumMath.PI_OVER_TWO = Math.PI / 2;
CesiumMath.PI_OVER_THREE = Math.PI / 3;
CesiumMath.PI_OVER_FOUR = Math.PI / 4;
CesiumMath.PI_OVER_SIX = Math.PI / 6;
CesiumMath.THREE_PI_OVER_TWO = 3 * Math.PI / 2;
CesiumMath.TWO_PI = 2 * Math.PI;
CesiumMath.ONE_OVER_TWO_PI = 1 / (2 * Math.PI);
CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180;
CesiumMath.DEGREES_PER_RADIAN = 180 / Math.PI;
CesiumMath.RADIANS_PER_ARCSECOND = CesiumMath.RADIANS_PER_DEGREE / 3600;
CesiumMath.toRadians = function(degrees) {
if (!defined_default(degrees)) {
throw new DeveloperError_default("degrees is required.");
}
return degrees * CesiumMath.RADIANS_PER_DEGREE;
};
CesiumMath.toDegrees = function(radians) {
if (!defined_default(radians)) {
throw new DeveloperError_default("radians is required.");
}
return radians * CesiumMath.DEGREES_PER_RADIAN;
};
CesiumMath.convertLongitudeRange = function(angle) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
const twoPi = CesiumMath.TWO_PI;
const simplified = angle - Math.floor(angle / twoPi) * twoPi;
if (simplified < -Math.PI) {
return simplified + twoPi;
}
if (simplified >= Math.PI) {
return simplified - twoPi;
}
return simplified;
};
CesiumMath.clampToLatitudeRange = function(angle) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
return CesiumMath.clamp(
angle,
-1 * CesiumMath.PI_OVER_TWO,
CesiumMath.PI_OVER_TWO
);
};
CesiumMath.negativePiToPi = function(angle) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
if (angle >= -CesiumMath.PI && angle <= CesiumMath.PI) {
return angle;
}
return CesiumMath.zeroToTwoPi(angle + CesiumMath.PI) - CesiumMath.PI;
};
CesiumMath.zeroToTwoPi = function(angle) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
if (angle >= 0 && angle <= CesiumMath.TWO_PI) {
return angle;
}
const mod = CesiumMath.mod(angle, CesiumMath.TWO_PI);
if (Math.abs(mod) < CesiumMath.EPSILON14 && Math.abs(angle) > CesiumMath.EPSILON14) {
return CesiumMath.TWO_PI;
}
return mod;
};
CesiumMath.mod = function(m, n) {
if (!defined_default(m)) {
throw new DeveloperError_default("m is required.");
}
if (!defined_default(n)) {
throw new DeveloperError_default("n is required.");
}
if (n === 0) {
throw new DeveloperError_default("divisor cannot be 0.");
}
if (CesiumMath.sign(m) === CesiumMath.sign(n) && Math.abs(m) < Math.abs(n)) {
return m;
}
return (m % n + n) % n;
};
CesiumMath.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("left is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("right is required.");
}
relativeEpsilon = defaultValue_default(relativeEpsilon, 0);
absoluteEpsilon = defaultValue_default(absoluteEpsilon, relativeEpsilon);
const absDiff = Math.abs(left - right);
return absDiff <= absoluteEpsilon || absDiff <= relativeEpsilon * Math.max(Math.abs(left), Math.abs(right));
};
CesiumMath.lessThan = function(left, right, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("first is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("second is required.");
}
if (!defined_default(absoluteEpsilon)) {
throw new DeveloperError_default("absoluteEpsilon is required.");
}
return left - right < -absoluteEpsilon;
};
CesiumMath.lessThanOrEquals = function(left, right, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("first is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("second is required.");
}
if (!defined_default(absoluteEpsilon)) {
throw new DeveloperError_default("absoluteEpsilon is required.");
}
return left - right < absoluteEpsilon;
};
CesiumMath.greaterThan = function(left, right, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("first is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("second is required.");
}
if (!defined_default(absoluteEpsilon)) {
throw new DeveloperError_default("absoluteEpsilon is required.");
}
return left - right > absoluteEpsilon;
};
CesiumMath.greaterThanOrEquals = function(left, right, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("first is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("second is required.");
}
if (!defined_default(absoluteEpsilon)) {
throw new DeveloperError_default("absoluteEpsilon is required.");
}
return left - right > -absoluteEpsilon;
};
var factorials = [1];
CesiumMath.factorial = function(n) {
if (typeof n !== "number" || n < 0) {
throw new DeveloperError_default(
"A number greater than or equal to 0 is required."
);
}
const length = factorials.length;
if (n >= length) {
let sum = factorials[length - 1];
for (let i = length; i <= n; i++) {
const next = sum * i;
factorials.push(next);
sum = next;
}
}
return factorials[n];
};
CesiumMath.incrementWrap = function(n, maximumValue, minimumValue) {
minimumValue = defaultValue_default(minimumValue, 0);
if (!defined_default(n)) {
throw new DeveloperError_default("n is required.");
}
if (maximumValue <= minimumValue) {
throw new DeveloperError_default("maximumValue must be greater than minimumValue.");
}
++n;
if (n > maximumValue) {
n = minimumValue;
}
return n;
};
CesiumMath.isPowerOfTwo = function(n) {
if (typeof n !== "number" || n < 0 || n > 4294967295) {
throw new DeveloperError_default("A number between 0 and (2^32)-1 is required.");
}
return n !== 0 && (n & n - 1) === 0;
};
CesiumMath.nextPowerOfTwo = function(n) {
if (typeof n !== "number" || n < 0 || n > 2147483648) {
throw new DeveloperError_default("A number between 0 and 2^31 is required.");
}
--n;
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
++n;
return n;
};
CesiumMath.previousPowerOfTwo = function(n) {
if (typeof n !== "number" || n < 0 || n > 4294967295) {
throw new DeveloperError_default("A number between 0 and (2^32)-1 is required.");
}
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
n |= n >> 32;
n = (n >>> 0) - (n >>> 1);
return n;
};
CesiumMath.clamp = function(value, min, max) {
Check_default.typeOf.number("value", value);
Check_default.typeOf.number("min", min);
Check_default.typeOf.number("max", max);
return value < min ? min : value > max ? max : value;
};
var randomNumberGenerator = new import_mersenne_twister.default();
CesiumMath.setRandomNumberSeed = function(seed) {
if (!defined_default(seed)) {
throw new DeveloperError_default("seed is required.");
}
randomNumberGenerator = new import_mersenne_twister.default(seed);
};
CesiumMath.nextRandomNumber = function() {
return randomNumberGenerator.random();
};
CesiumMath.randomBetween = function(min, max) {
return CesiumMath.nextRandomNumber() * (max - min) + min;
};
CesiumMath.acosClamped = function(value) {
if (!defined_default(value)) {
throw new DeveloperError_default("value is required.");
}
return Math.acos(CesiumMath.clamp(value, -1, 1));
};
CesiumMath.asinClamped = function(value) {
if (!defined_default(value)) {
throw new DeveloperError_default("value is required.");
}
return Math.asin(CesiumMath.clamp(value, -1, 1));
};
CesiumMath.chordLength = function(angle, radius) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
if (!defined_default(radius)) {
throw new DeveloperError_default("radius is required.");
}
return 2 * radius * Math.sin(angle * 0.5);
};
CesiumMath.logBase = function(number, base) {
if (!defined_default(number)) {
throw new DeveloperError_default("number is required.");
}
if (!defined_default(base)) {
throw new DeveloperError_default("base is required.");
}
return Math.log(number) / Math.log(base);
};
CesiumMath.cbrt = defaultValue_default(Math.cbrt, function cbrt(number) {
const result = Math.pow(Math.abs(number), 1 / 3);
return number < 0 ? -result : result;
});
CesiumMath.log2 = defaultValue_default(Math.log2, function log2(number) {
return Math.log(number) * Math.LOG2E;
});
CesiumMath.fog = function(distanceToCamera, density) {
const scalar = distanceToCamera * density;
return 1 - Math.exp(-(scalar * scalar));
};
CesiumMath.fastApproximateAtan = function(x) {
Check_default.typeOf.number("x", x);
return x * (-0.1784 * Math.abs(x) - 0.0663 * x * x + 1.0301);
};
CesiumMath.fastApproximateAtan2 = function(x, y) {
Check_default.typeOf.number("x", x);
Check_default.typeOf.number("y", y);
let opposite;
let t = Math.abs(x);
opposite = Math.abs(y);
const adjacent = Math.max(t, opposite);
opposite = Math.min(t, opposite);
const oppositeOverAdjacent = opposite / adjacent;
if (isNaN(oppositeOverAdjacent)) {
throw new DeveloperError_default("either x or y must be nonzero");
}
t = CesiumMath.fastApproximateAtan(oppositeOverAdjacent);
t = Math.abs(y) > Math.abs(x) ? CesiumMath.PI_OVER_TWO - t : t;
t = x < 0 ? CesiumMath.PI - t : t;
t = y < 0 ? -t : t;
return t;
};
var Math_default = CesiumMath;
export {
Math_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
// packages/engine/Source/Core/GeometryAttributes.js
function GeometryAttributes(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
this.position = options.position;
this.normal = options.normal;
this.st = options.st;
this.bitangent = options.bitangent;
this.tangent = options.tangent;
this.color = options.color;
}
var GeometryAttributes_default = GeometryAttributes;
export {
GeometryAttributes_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
WebGLConstants_default
} from "./chunk-3HQMMUPU.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/ComponentDatatype.js
var ComponentDatatype = {
/**
* 8-bit signed byte corresponding to <code>gl.BYTE</code> and the type
* of an element in <code>Int8Array</code>.
*
* @type {number}
* @constant
*/
BYTE: WebGLConstants_default.BYTE,
/**
* 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
* of an element in <code>Uint8Array</code>.
*
* @type {number}
* @constant
*/
UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
/**
* 16-bit signed short corresponding to <code>SHORT</code> and the type
* of an element in <code>Int16Array</code>.
*
* @type {number}
* @constant
*/
SHORT: WebGLConstants_default.SHORT,
/**
* 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
* of an element in <code>Uint16Array</code>.
*
* @type {number}
* @constant
*/
UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
/**
* 32-bit signed int corresponding to <code>INT</code> and the type
* of an element in <code>Int32Array</code>.
*
* @memberOf ComponentDatatype
*
* @type {number}
* @constant
*/
INT: WebGLConstants_default.INT,
/**
* 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
* of an element in <code>Uint32Array</code>.
*
* @memberOf ComponentDatatype
*
* @type {number}
* @constant
*/
UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT,
/**
* 32-bit floating-point corresponding to <code>FLOAT</code> and the type
* of an element in <code>Float32Array</code>.
*
* @type {number}
* @constant
*/
FLOAT: WebGLConstants_default.FLOAT,
/**
* 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>.
*
* @memberOf ComponentDatatype
*
* @type {number}
* @constant
* @default 0x140A
*/
DOUBLE: WebGLConstants_default.DOUBLE
};
ComponentDatatype.getSizeInBytes = function(componentDatatype) {
if (!defined_default(componentDatatype)) {
throw new DeveloperError_default("value is required.");
}
switch (componentDatatype) {
case ComponentDatatype.BYTE:
return Int8Array.BYTES_PER_ELEMENT;
case ComponentDatatype.UNSIGNED_BYTE:
return Uint8Array.BYTES_PER_ELEMENT;
case ComponentDatatype.SHORT:
return Int16Array.BYTES_PER_ELEMENT;
case ComponentDatatype.UNSIGNED_SHORT:
return Uint16Array.BYTES_PER_ELEMENT;
case ComponentDatatype.INT:
return Int32Array.BYTES_PER_ELEMENT;
case ComponentDatatype.UNSIGNED_INT:
return Uint32Array.BYTES_PER_ELEMENT;
case ComponentDatatype.FLOAT:
return Float32Array.BYTES_PER_ELEMENT;
case ComponentDatatype.DOUBLE:
return Float64Array.BYTES_PER_ELEMENT;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("componentDatatype is not a valid value.");
}
};
ComponentDatatype.fromTypedArray = function(array) {
if (array instanceof Int8Array) {
return ComponentDatatype.BYTE;
}
if (array instanceof Uint8Array) {
return ComponentDatatype.UNSIGNED_BYTE;
}
if (array instanceof Int16Array) {
return ComponentDatatype.SHORT;
}
if (array instanceof Uint16Array) {
return ComponentDatatype.UNSIGNED_SHORT;
}
if (array instanceof Int32Array) {
return ComponentDatatype.INT;
}
if (array instanceof Uint32Array) {
return ComponentDatatype.UNSIGNED_INT;
}
if (array instanceof Float32Array) {
return ComponentDatatype.FLOAT;
}
if (array instanceof Float64Array) {
return ComponentDatatype.DOUBLE;
}
throw new DeveloperError_default(
"array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array."
);
};
ComponentDatatype.validate = function(componentDatatype) {
return defined_default(componentDatatype) && (componentDatatype === ComponentDatatype.BYTE || componentDatatype === ComponentDatatype.UNSIGNED_BYTE || componentDatatype === ComponentDatatype.SHORT || componentDatatype === ComponentDatatype.UNSIGNED_SHORT || componentDatatype === ComponentDatatype.INT || componentDatatype === ComponentDatatype.UNSIGNED_INT || componentDatatype === ComponentDatatype.FLOAT || componentDatatype === ComponentDatatype.DOUBLE);
};
ComponentDatatype.createTypedArray = function(componentDatatype, valuesOrLength) {
if (!defined_default(componentDatatype)) {
throw new DeveloperError_default("componentDatatype is required.");
}
if (!defined_default(valuesOrLength)) {
throw new DeveloperError_default("valuesOrLength is required.");
}
switch (componentDatatype) {
case ComponentDatatype.BYTE:
return new Int8Array(valuesOrLength);
case ComponentDatatype.UNSIGNED_BYTE:
return new Uint8Array(valuesOrLength);
case ComponentDatatype.SHORT:
return new Int16Array(valuesOrLength);
case ComponentDatatype.UNSIGNED_SHORT:
return new Uint16Array(valuesOrLength);
case ComponentDatatype.INT:
return new Int32Array(valuesOrLength);
case ComponentDatatype.UNSIGNED_INT:
return new Uint32Array(valuesOrLength);
case ComponentDatatype.FLOAT:
return new Float32Array(valuesOrLength);
case ComponentDatatype.DOUBLE:
return new Float64Array(valuesOrLength);
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("componentDatatype is not a valid value.");
}
};
ComponentDatatype.createArrayBufferView = function(componentDatatype, buffer, byteOffset, length) {
if (!defined_default(componentDatatype)) {
throw new DeveloperError_default("componentDatatype is required.");
}
if (!defined_default(buffer)) {
throw new DeveloperError_default("buffer is required.");
}
byteOffset = defaultValue_default(byteOffset, 0);
length = defaultValue_default(
length,
(buffer.byteLength - byteOffset) / ComponentDatatype.getSizeInBytes(componentDatatype)
);
switch (componentDatatype) {
case ComponentDatatype.BYTE:
return new Int8Array(buffer, byteOffset, length);
case ComponentDatatype.UNSIGNED_BYTE:
return new Uint8Array(buffer, byteOffset, length);
case ComponentDatatype.SHORT:
return new Int16Array(buffer, byteOffset, length);
case ComponentDatatype.UNSIGNED_SHORT:
return new Uint16Array(buffer, byteOffset, length);
case ComponentDatatype.INT:
return new Int32Array(buffer, byteOffset, length);
case ComponentDatatype.UNSIGNED_INT:
return new Uint32Array(buffer, byteOffset, length);
case ComponentDatatype.FLOAT:
return new Float32Array(buffer, byteOffset, length);
case ComponentDatatype.DOUBLE:
return new Float64Array(buffer, byteOffset, length);
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("componentDatatype is not a valid value.");
}
};
ComponentDatatype.fromName = function(name) {
switch (name) {
case "BYTE":
return ComponentDatatype.BYTE;
case "UNSIGNED_BYTE":
return ComponentDatatype.UNSIGNED_BYTE;
case "SHORT":
return ComponentDatatype.SHORT;
case "UNSIGNED_SHORT":
return ComponentDatatype.UNSIGNED_SHORT;
case "INT":
return ComponentDatatype.INT;
case "UNSIGNED_INT":
return ComponentDatatype.UNSIGNED_INT;
case "FLOAT":
return ComponentDatatype.FLOAT;
case "DOUBLE":
return ComponentDatatype.DOUBLE;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("name is not a valid value.");
}
};
var ComponentDatatype_default = Object.freeze(ComponentDatatype);
export {
ComponentDatatype_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
// packages/engine/Source/Core/ArcType.js
var ArcType = {
/**
* Straight line that does not conform to the surface of the ellipsoid.
*
* @type {number}
* @constant
*/
NONE: 0,
/**
* Follow geodesic path.
*
* @type {number}
* @constant
*/
GEODESIC: 1,
/**
* Follow rhumb or loxodrome path.
*
* @type {number}
* @constant
*/
RHUMB: 2
};
var ArcType_default = Object.freeze(ArcType);
export {
ArcType_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __glob = (map) => (path) => {
var fn = map[path];
if (fn) return fn();
throw new Error("Module not found in bundle: " + path);
};
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// packages/engine/Source/Core/defined.js
function defined(value) {
return value !== void 0 && value !== null;
}
var defined_default = defined;
export {
__require,
__glob,
__commonJS,
__toESM,
defined_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
AxisAlignedBoundingBox_default
} from "./chunk-NDDI2LWR.js";
import {
IntersectionTests_default,
Ray_default
} from "./chunk-QQOZO7KO.js";
import {
Plane_default
} from "./chunk-EDLRS3AW.js";
import {
Cartesian4_default,
Matrix4_default,
Transforms_default
} from "./chunk-6SQMLVGV.js";
import {
Cartesian2_default,
Cartesian3_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/EllipsoidTangentPlane.js
var scratchCart4 = new Cartesian4_default();
function EllipsoidTangentPlane(origin, ellipsoid) {
Check_default.defined("origin", origin);
ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
origin = ellipsoid.scaleToGeodeticSurface(origin);
if (!defined_default(origin)) {
throw new DeveloperError_default(
"origin must not be at the center of the ellipsoid."
);
}
const eastNorthUp = Transforms_default.eastNorthUpToFixedFrame(origin, ellipsoid);
this._ellipsoid = ellipsoid;
this._origin = origin;
this._xAxis = Cartesian3_default.fromCartesian4(
Matrix4_default.getColumn(eastNorthUp, 0, scratchCart4)
);
this._yAxis = Cartesian3_default.fromCartesian4(
Matrix4_default.getColumn(eastNorthUp, 1, scratchCart4)
);
const normal = Cartesian3_default.fromCartesian4(
Matrix4_default.getColumn(eastNorthUp, 2, scratchCart4)
);
this._plane = Plane_default.fromPointNormal(origin, normal);
}
Object.defineProperties(EllipsoidTangentPlane.prototype, {
/**
* Gets the ellipsoid.
* @memberof EllipsoidTangentPlane.prototype
* @type {Ellipsoid}
*/
ellipsoid: {
get: function() {
return this._ellipsoid;
}
},
/**
* Gets the origin.
* @memberof EllipsoidTangentPlane.prototype
* @type {Cartesian3}
*/
origin: {
get: function() {
return this._origin;
}
},
/**
* Gets the plane which is tangent to the ellipsoid.
* @memberof EllipsoidTangentPlane.prototype
* @readonly
* @type {Plane}
*/
plane: {
get: function() {
return this._plane;
}
},
/**
* Gets the local X-axis (east) of the tangent plane.
* @memberof EllipsoidTangentPlane.prototype
* @readonly
* @type {Cartesian3}
*/
xAxis: {
get: function() {
return this._xAxis;
}
},
/**
* Gets the local Y-axis (north) of the tangent plane.
* @memberof EllipsoidTangentPlane.prototype
* @readonly
* @type {Cartesian3}
*/
yAxis: {
get: function() {
return this._yAxis;
}
},
/**
* Gets the local Z-axis (up) of the tangent plane.
* @memberof EllipsoidTangentPlane.prototype
* @readonly
* @type {Cartesian3}
*/
zAxis: {
get: function() {
return this._plane.normal;
}
}
});
var tmp = new AxisAlignedBoundingBox_default();
EllipsoidTangentPlane.fromPoints = function(cartesians, ellipsoid) {
Check_default.defined("cartesians", cartesians);
const box = AxisAlignedBoundingBox_default.fromPoints(cartesians, tmp);
return new EllipsoidTangentPlane(box.center, ellipsoid);
};
var scratchProjectPointOntoPlaneRay = new Ray_default();
var scratchProjectPointOntoPlaneCartesian3 = new Cartesian3_default();
EllipsoidTangentPlane.prototype.projectPointOntoPlane = function(cartesian, result) {
Check_default.defined("cartesian", cartesian);
const ray = scratchProjectPointOntoPlaneRay;
ray.origin = cartesian;
Cartesian3_default.normalize(cartesian, ray.direction);
let intersectionPoint = IntersectionTests_default.rayPlane(
ray,
this._plane,
scratchProjectPointOntoPlaneCartesian3
);
if (!defined_default(intersectionPoint)) {
Cartesian3_default.negate(ray.direction, ray.direction);
intersectionPoint = IntersectionTests_default.rayPlane(
ray,
this._plane,
scratchProjectPointOntoPlaneCartesian3
);
}
if (defined_default(intersectionPoint)) {
const v = Cartesian3_default.subtract(
intersectionPoint,
this._origin,
intersectionPoint
);
const x = Cartesian3_default.dot(this._xAxis, v);
const y = Cartesian3_default.dot(this._yAxis, v);
if (!defined_default(result)) {
return new Cartesian2_default(x, y);
}
result.x = x;
result.y = y;
return result;
}
return void 0;
};
EllipsoidTangentPlane.prototype.projectPointsOntoPlane = function(cartesians, result) {
Check_default.defined("cartesians", cartesians);
if (!defined_default(result)) {
result = [];
}
let count = 0;
const length = cartesians.length;
for (let i = 0; i < length; i++) {
const p = this.projectPointOntoPlane(cartesians[i], result[count]);
if (defined_default(p)) {
result[count] = p;
count++;
}
}
result.length = count;
return result;
};
EllipsoidTangentPlane.prototype.projectPointToNearestOnPlane = function(cartesian, result) {
Check_default.defined("cartesian", cartesian);
if (!defined_default(result)) {
result = new Cartesian2_default();
}
const ray = scratchProjectPointOntoPlaneRay;
ray.origin = cartesian;
Cartesian3_default.clone(this._plane.normal, ray.direction);
let intersectionPoint = IntersectionTests_default.rayPlane(
ray,
this._plane,
scratchProjectPointOntoPlaneCartesian3
);
if (!defined_default(intersectionPoint)) {
Cartesian3_default.negate(ray.direction, ray.direction);
intersectionPoint = IntersectionTests_default.rayPlane(
ray,
this._plane,
scratchProjectPointOntoPlaneCartesian3
);
}
const v = Cartesian3_default.subtract(
intersectionPoint,
this._origin,
intersectionPoint
);
const x = Cartesian3_default.dot(this._xAxis, v);
const y = Cartesian3_default.dot(this._yAxis, v);
result.x = x;
result.y = y;
return result;
};
EllipsoidTangentPlane.prototype.projectPointsToNearestOnPlane = function(cartesians, result) {
Check_default.defined("cartesians", cartesians);
if (!defined_default(result)) {
result = [];
}
const length = cartesians.length;
result.length = length;
for (let i = 0; i < length; i++) {
result[i] = this.projectPointToNearestOnPlane(cartesians[i], result[i]);
}
return result;
};
var projectPointsOntoEllipsoidScratch = new Cartesian3_default();
EllipsoidTangentPlane.prototype.projectPointOntoEllipsoid = function(cartesian, result) {
Check_default.defined("cartesian", cartesian);
if (!defined_default(result)) {
result = new Cartesian3_default();
}
const ellipsoid = this._ellipsoid;
const origin = this._origin;
const xAxis = this._xAxis;
const yAxis = this._yAxis;
const tmp2 = projectPointsOntoEllipsoidScratch;
Cartesian3_default.multiplyByScalar(xAxis, cartesian.x, tmp2);
result = Cartesian3_default.add(origin, tmp2, result);
Cartesian3_default.multiplyByScalar(yAxis, cartesian.y, tmp2);
Cartesian3_default.add(result, tmp2, result);
ellipsoid.scaleToGeocentricSurface(result, result);
return result;
};
EllipsoidTangentPlane.prototype.projectPointsOntoEllipsoid = function(cartesians, result) {
Check_default.defined("cartesians", cartesians);
const length = cartesians.length;
if (!defined_default(result)) {
result = new Array(length);
} else {
result.length = length;
}
for (let i = 0; i < length; ++i) {
result[i] = this.projectPointOntoEllipsoid(cartesians[i], result[i]);
}
return result;
};
var EllipsoidTangentPlane_default = EllipsoidTangentPlane;
export {
EllipsoidTangentPlane_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Matrix4_default
} from "./chunk-6SQMLVGV.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/GeometryInstance.js
function GeometryInstance(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
if (!defined_default(options.geometry)) {
throw new DeveloperError_default("options.geometry is required.");
}
this.geometry = options.geometry;
this.modelMatrix = Matrix4_default.clone(
defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
);
this.id = options.id;
this.pickPrimitive = options.pickPrimitive;
this.attributes = defaultValue_default(options.attributes, {});
this.westHemisphereGeometry = void 0;
this.eastHemisphereGeometry = void 0;
}
var GeometryInstance_default = GeometryInstance;
export {
GeometryInstance_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/formatError.js
function formatError(object) {
let result;
const name = object.name;
const message = object.message;
if (defined_default(name) && defined_default(message)) {
result = `${name}: ${message}`;
} else {
result = object.toString();
}
const stack = object.stack;
if (defined_default(stack)) {
result += `
${stack}`;
}
return result;
}
var formatError_default = formatError;
// packages/engine/Source/Workers/createTaskProcessorWorker.js
function createTaskProcessorWorker(workerFunction) {
async function onMessageHandler({ data }) {
const transferableObjects = [];
const responseMessage = {
id: data.id,
result: void 0,
error: void 0
};
self.CESIUM_BASE_URL = data.baseUrl;
try {
const result = await workerFunction(data.parameters, transferableObjects);
responseMessage.result = result;
} catch (error) {
if (error instanceof Error) {
responseMessage.error = {
name: error.name,
message: error.message,
stack: error.stack
};
} else {
responseMessage.error = error;
}
}
if (!data.canTransferArrayBuffer) {
transferableObjects.length = 0;
}
try {
postMessage(responseMessage, transferableObjects);
} catch (error) {
responseMessage.result = void 0;
responseMessage.error = `postMessage failed with error: ${formatError_default(
error
)}
with responseMessage: ${JSON.stringify(responseMessage)}`;
postMessage(responseMessage);
}
}
function onMessageErrorHandler(event) {
postMessage({
id: event.data?.id,
error: `postMessage failed with error: ${JSON.stringify(event)}`
});
}
self.onmessage = onMessageHandler;
self.onmessageerror = onMessageErrorHandler;
return self;
}
var createTaskProcessorWorker_default = createTaskProcessorWorker;
export {
createTaskProcessorWorker_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
EllipseGeometryLibrary_default
} from "./chunk-JISPSEF3.js";
import {
GeometryInstance_default
} from "./chunk-YSIJTJ7N.js";
import {
GeometryPipeline_default
} from "./chunk-7ZZ5LMZY.js";
import {
GeometryOffsetAttribute_default
} from "./chunk-GBT7MJ6X.js";
import {
VertexFormat_default
} from "./chunk-JBSKHTNX.js";
import {
IndexDatatype_default
} from "./chunk-C4WPMOKT.js";
import {
GeometryAttributes_default
} from "./chunk-X7IQYYHF.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-JXVLNVXC.js";
import {
BoundingSphere_default,
GeographicProjection_default
} from "./chunk-KHZNBFOH.js";
import {
Quaternion_default,
Rectangle_default
} from "./chunk-6SQMLVGV.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian2_default,
Cartesian3_default,
Cartographic_default,
Ellipsoid_default,
Matrix3_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/EllipseGeometry.js
var scratchCartesian1 = new Cartesian3_default();
var scratchCartesian2 = new Cartesian3_default();
var scratchCartesian3 = new Cartesian3_default();
var scratchCartesian4 = new Cartesian3_default();
var texCoordScratch = new Cartesian2_default();
var textureMatrixScratch = new Matrix3_default();
var tangentMatrixScratch = new Matrix3_default();
var quaternionScratch = new Quaternion_default();
var scratchNormal = new Cartesian3_default();
var scratchTangent = new Cartesian3_default();
var scratchBitangent = new Cartesian3_default();
var scratchCartographic = new Cartographic_default();
var projectedCenterScratch = new Cartesian3_default();
var scratchMinTexCoord = new Cartesian2_default();
var scratchMaxTexCoord = new Cartesian2_default();
function computeTopBottomAttributes(positions, options, extrude) {
const vertexFormat = options.vertexFormat;
const center = options.center;
const semiMajorAxis = options.semiMajorAxis;
const semiMinorAxis = options.semiMinorAxis;
const ellipsoid = options.ellipsoid;
const stRotation = options.stRotation;
const size = extrude ? positions.length / 3 * 2 : positions.length / 3;
const shadowVolume = options.shadowVolume;
const textureCoordinates = vertexFormat.st ? new Float32Array(size * 2) : void 0;
const normals = vertexFormat.normal ? new Float32Array(size * 3) : void 0;
const tangents = vertexFormat.tangent ? new Float32Array(size * 3) : void 0;
const bitangents = vertexFormat.bitangent ? new Float32Array(size * 3) : void 0;
const extrudeNormals = shadowVolume ? new Float32Array(size * 3) : void 0;
let textureCoordIndex = 0;
let normal = scratchNormal;
let tangent = scratchTangent;
let bitangent = scratchBitangent;
const projection = new GeographicProjection_default(ellipsoid);
const projectedCenter = projection.project(
ellipsoid.cartesianToCartographic(center, scratchCartographic),
projectedCenterScratch
);
const geodeticNormal = ellipsoid.scaleToGeodeticSurface(
center,
scratchCartesian1
);
ellipsoid.geodeticSurfaceNormal(geodeticNormal, geodeticNormal);
let textureMatrix = textureMatrixScratch;
let tangentMatrix = tangentMatrixScratch;
if (stRotation !== 0) {
let rotation = Quaternion_default.fromAxisAngle(
geodeticNormal,
stRotation,
quaternionScratch
);
textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
rotation = Quaternion_default.fromAxisAngle(
geodeticNormal,
-stRotation,
quaternionScratch
);
tangentMatrix = Matrix3_default.fromQuaternion(rotation, tangentMatrix);
} else {
textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
tangentMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, tangentMatrix);
}
const minTexCoord = Cartesian2_default.fromElements(
Number.POSITIVE_INFINITY,
Number.POSITIVE_INFINITY,
scratchMinTexCoord
);
const maxTexCoord = Cartesian2_default.fromElements(
Number.NEGATIVE_INFINITY,
Number.NEGATIVE_INFINITY,
scratchMaxTexCoord
);
let length = positions.length;
const bottomOffset = extrude ? length : 0;
const stOffset = bottomOffset / 3 * 2;
for (let i = 0; i < length; i += 3) {
const i1 = i + 1;
const i2 = i + 2;
const position = Cartesian3_default.fromArray(positions, i, scratchCartesian1);
if (vertexFormat.st) {
const rotatedPoint = Matrix3_default.multiplyByVector(
textureMatrix,
position,
scratchCartesian2
);
const projectedPoint = projection.project(
ellipsoid.cartesianToCartographic(rotatedPoint, scratchCartographic),
scratchCartesian3
);
Cartesian3_default.subtract(projectedPoint, projectedCenter, projectedPoint);
texCoordScratch.x = (projectedPoint.x + semiMajorAxis) / (2 * semiMajorAxis);
texCoordScratch.y = (projectedPoint.y + semiMinorAxis) / (2 * semiMinorAxis);
minTexCoord.x = Math.min(texCoordScratch.x, minTexCoord.x);
minTexCoord.y = Math.min(texCoordScratch.y, minTexCoord.y);
maxTexCoord.x = Math.max(texCoordScratch.x, maxTexCoord.x);
maxTexCoord.y = Math.max(texCoordScratch.y, maxTexCoord.y);
if (extrude) {
textureCoordinates[textureCoordIndex + stOffset] = texCoordScratch.x;
textureCoordinates[textureCoordIndex + 1 + stOffset] = texCoordScratch.y;
}
textureCoordinates[textureCoordIndex++] = texCoordScratch.x;
textureCoordinates[textureCoordIndex++] = texCoordScratch.y;
}
if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
normal = ellipsoid.geodeticSurfaceNormal(position, normal);
if (shadowVolume) {
extrudeNormals[i + bottomOffset] = -normal.x;
extrudeNormals[i1 + bottomOffset] = -normal.y;
extrudeNormals[i2 + bottomOffset] = -normal.z;
}
if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
if (vertexFormat.tangent || vertexFormat.bitangent) {
tangent = Cartesian3_default.normalize(
Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal, tangent),
tangent
);
Matrix3_default.multiplyByVector(tangentMatrix, tangent, tangent);
}
if (vertexFormat.normal) {
normals[i] = normal.x;
normals[i1] = normal.y;
normals[i2] = normal.z;
if (extrude) {
normals[i + bottomOffset] = -normal.x;
normals[i1 + bottomOffset] = -normal.y;
normals[i2 + bottomOffset] = -normal.z;
}
}
if (vertexFormat.tangent) {
tangents[i] = tangent.x;
tangents[i1] = tangent.y;
tangents[i2] = tangent.z;
if (extrude) {
tangents[i + bottomOffset] = -tangent.x;
tangents[i1 + bottomOffset] = -tangent.y;
tangents[i2 + bottomOffset] = -tangent.z;
}
}
if (vertexFormat.bitangent) {
bitangent = Cartesian3_default.normalize(
Cartesian3_default.cross(normal, tangent, bitangent),
bitangent
);
bitangents[i] = bitangent.x;
bitangents[i1] = bitangent.y;
bitangents[i2] = bitangent.z;
if (extrude) {
bitangents[i + bottomOffset] = bitangent.x;
bitangents[i1 + bottomOffset] = bitangent.y;
bitangents[i2 + bottomOffset] = bitangent.z;
}
}
}
}
}
if (vertexFormat.st) {
length = textureCoordinates.length;
for (let k = 0; k < length; k += 2) {
textureCoordinates[k] = (textureCoordinates[k] - minTexCoord.x) / (maxTexCoord.x - minTexCoord.x);
textureCoordinates[k + 1] = (textureCoordinates[k + 1] - minTexCoord.y) / (maxTexCoord.y - minTexCoord.y);
}
}
const attributes = new GeometryAttributes_default();
if (vertexFormat.position) {
const finalPositions = EllipseGeometryLibrary_default.raisePositionsToHeight(
positions,
options,
extrude
);
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: finalPositions
});
}
if (vertexFormat.st) {
attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: textureCoordinates
});
}
if (vertexFormat.normal) {
attributes.normal = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: normals
});
}
if (vertexFormat.tangent) {
attributes.tangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: tangents
});
}
if (vertexFormat.bitangent) {
attributes.bitangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: bitangents
});
}
if (shadowVolume) {
attributes.extrudeDirection = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: extrudeNormals
});
}
if (extrude && defined_default(options.offsetAttribute)) {
let offsetAttribute = new Uint8Array(size);
if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
} else {
const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
offsetAttribute = offsetAttribute.fill(offsetValue);
}
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: offsetAttribute
});
}
return attributes;
}
function topIndices(numPts) {
const indices = new Array(12 * (numPts * (numPts + 1)) - 6);
let indicesIndex = 0;
let prevIndex;
let numInterior;
let positionIndex;
let i;
let j;
prevIndex = 0;
positionIndex = 1;
for (i = 0; i < 3; i++) {
indices[indicesIndex++] = positionIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex;
}
for (i = 2; i < numPts + 1; ++i) {
positionIndex = i * (i + 1) - 1;
prevIndex = (i - 1) * i - 1;
indices[indicesIndex++] = positionIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex;
numInterior = 2 * i;
for (j = 0; j < numInterior - 1; ++j) {
indices[indicesIndex++] = positionIndex;
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex;
}
indices[indicesIndex++] = positionIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex;
}
numInterior = numPts * 2;
++positionIndex;
++prevIndex;
for (i = 0; i < numInterior - 1; ++i) {
indices[indicesIndex++] = positionIndex;
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex;
}
indices[indicesIndex++] = positionIndex;
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex++;
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = prevIndex;
++prevIndex;
for (i = numPts - 1; i > 1; --i) {
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex;
numInterior = 2 * i;
for (j = 0; j < numInterior - 1; ++j) {
indices[indicesIndex++] = positionIndex;
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex;
}
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = positionIndex++;
}
for (i = 0; i < 3; i++) {
indices[indicesIndex++] = prevIndex++;
indices[indicesIndex++] = prevIndex;
indices[indicesIndex++] = positionIndex;
}
return indices;
}
var boundingSphereCenter = new Cartesian3_default();
function computeEllipse(options) {
const center = options.center;
boundingSphereCenter = Cartesian3_default.multiplyByScalar(
options.ellipsoid.geodeticSurfaceNormal(center, boundingSphereCenter),
options.height,
boundingSphereCenter
);
boundingSphereCenter = Cartesian3_default.add(
center,
boundingSphereCenter,
boundingSphereCenter
);
const boundingSphere = new BoundingSphere_default(
boundingSphereCenter,
options.semiMajorAxis
);
const cep = EllipseGeometryLibrary_default.computeEllipsePositions(
options,
true,
false
);
const positions = cep.positions;
const numPts = cep.numPts;
const attributes = computeTopBottomAttributes(positions, options, false);
let indices = topIndices(numPts);
indices = IndexDatatype_default.createTypedArray(positions.length / 3, indices);
return {
boundingSphere,
attributes,
indices
};
}
function computeWallAttributes(positions, options) {
const vertexFormat = options.vertexFormat;
const center = options.center;
const semiMajorAxis = options.semiMajorAxis;
const semiMinorAxis = options.semiMinorAxis;
const ellipsoid = options.ellipsoid;
const height = options.height;
const extrudedHeight = options.extrudedHeight;
const stRotation = options.stRotation;
const size = positions.length / 3 * 2;
const finalPositions = new Float64Array(size * 3);
const textureCoordinates = vertexFormat.st ? new Float32Array(size * 2) : void 0;
const normals = vertexFormat.normal ? new Float32Array(size * 3) : void 0;
const tangents = vertexFormat.tangent ? new Float32Array(size * 3) : void 0;
const bitangents = vertexFormat.bitangent ? new Float32Array(size * 3) : void 0;
const shadowVolume = options.shadowVolume;
const extrudeNormals = shadowVolume ? new Float32Array(size * 3) : void 0;
let textureCoordIndex = 0;
let normal = scratchNormal;
let tangent = scratchTangent;
let bitangent = scratchBitangent;
const projection = new GeographicProjection_default(ellipsoid);
const projectedCenter = projection.project(
ellipsoid.cartesianToCartographic(center, scratchCartographic),
projectedCenterScratch
);
const geodeticNormal = ellipsoid.scaleToGeodeticSurface(
center,
scratchCartesian1
);
ellipsoid.geodeticSurfaceNormal(geodeticNormal, geodeticNormal);
const rotation = Quaternion_default.fromAxisAngle(
geodeticNormal,
stRotation,
quaternionScratch
);
const textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrixScratch);
const minTexCoord = Cartesian2_default.fromElements(
Number.POSITIVE_INFINITY,
Number.POSITIVE_INFINITY,
scratchMinTexCoord
);
const maxTexCoord = Cartesian2_default.fromElements(
Number.NEGATIVE_INFINITY,
Number.NEGATIVE_INFINITY,
scratchMaxTexCoord
);
let length = positions.length;
const stOffset = length / 3 * 2;
for (let i = 0; i < length; i += 3) {
const i1 = i + 1;
const i2 = i + 2;
let position = Cartesian3_default.fromArray(positions, i, scratchCartesian1);
let extrudedPosition;
if (vertexFormat.st) {
const rotatedPoint = Matrix3_default.multiplyByVector(
textureMatrix,
position,
scratchCartesian2
);
const projectedPoint = projection.project(
ellipsoid.cartesianToCartographic(rotatedPoint, scratchCartographic),
scratchCartesian3
);
Cartesian3_default.subtract(projectedPoint, projectedCenter, projectedPoint);
texCoordScratch.x = (projectedPoint.x + semiMajorAxis) / (2 * semiMajorAxis);
texCoordScratch.y = (projectedPoint.y + semiMinorAxis) / (2 * semiMinorAxis);
minTexCoord.x = Math.min(texCoordScratch.x, minTexCoord.x);
minTexCoord.y = Math.min(texCoordScratch.y, minTexCoord.y);
maxTexCoord.x = Math.max(texCoordScratch.x, maxTexCoord.x);
maxTexCoord.y = Math.max(texCoordScratch.y, maxTexCoord.y);
textureCoordinates[textureCoordIndex + stOffset] = texCoordScratch.x;
textureCoordinates[textureCoordIndex + 1 + stOffset] = texCoordScratch.y;
textureCoordinates[textureCoordIndex++] = texCoordScratch.x;
textureCoordinates[textureCoordIndex++] = texCoordScratch.y;
}
position = ellipsoid.scaleToGeodeticSurface(position, position);
extrudedPosition = Cartesian3_default.clone(position, scratchCartesian2);
normal = ellipsoid.geodeticSurfaceNormal(position, normal);
if (shadowVolume) {
extrudeNormals[i + length] = -normal.x;
extrudeNormals[i1 + length] = -normal.y;
extrudeNormals[i2 + length] = -normal.z;
}
let scaledNormal = Cartesian3_default.multiplyByScalar(
normal,
height,
scratchCartesian4
);
position = Cartesian3_default.add(position, scaledNormal, position);
scaledNormal = Cartesian3_default.multiplyByScalar(
normal,
extrudedHeight,
scaledNormal
);
extrudedPosition = Cartesian3_default.add(
extrudedPosition,
scaledNormal,
extrudedPosition
);
if (vertexFormat.position) {
finalPositions[i + length] = extrudedPosition.x;
finalPositions[i1 + length] = extrudedPosition.y;
finalPositions[i2 + length] = extrudedPosition.z;
finalPositions[i] = position.x;
finalPositions[i1] = position.y;
finalPositions[i2] = position.z;
}
if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
bitangent = Cartesian3_default.clone(normal, bitangent);
const next = Cartesian3_default.fromArray(
positions,
(i + 3) % length,
scratchCartesian4
);
Cartesian3_default.subtract(next, position, next);
const bottom = Cartesian3_default.subtract(
extrudedPosition,
position,
scratchCartesian3
);
normal = Cartesian3_default.normalize(
Cartesian3_default.cross(bottom, next, normal),
normal
);
if (vertexFormat.normal) {
normals[i] = normal.x;
normals[i1] = normal.y;
normals[i2] = normal.z;
normals[i + length] = normal.x;
normals[i1 + length] = normal.y;
normals[i2 + length] = normal.z;
}
if (vertexFormat.tangent) {
tangent = Cartesian3_default.normalize(
Cartesian3_default.cross(bitangent, normal, tangent),
tangent
);
tangents[i] = tangent.x;
tangents[i1] = tangent.y;
tangents[i2] = tangent.z;
tangents[i + length] = tangent.x;
tangents[i + 1 + length] = tangent.y;
tangents[i + 2 + length] = tangent.z;
}
if (vertexFormat.bitangent) {
bitangents[i] = bitangent.x;
bitangents[i1] = bitangent.y;
bitangents[i2] = bitangent.z;
bitangents[i + length] = bitangent.x;
bitangents[i1 + length] = bitangent.y;
bitangents[i2 + length] = bitangent.z;
}
}
}
if (vertexFormat.st) {
length = textureCoordinates.length;
for (let k = 0; k < length; k += 2) {
textureCoordinates[k] = (textureCoordinates[k] - minTexCoord.x) / (maxTexCoord.x - minTexCoord.x);
textureCoordinates[k + 1] = (textureCoordinates[k + 1] - minTexCoord.y) / (maxTexCoord.y - minTexCoord.y);
}
}
const attributes = new GeometryAttributes_default();
if (vertexFormat.position) {
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: finalPositions
});
}
if (vertexFormat.st) {
attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: textureCoordinates
});
}
if (vertexFormat.normal) {
attributes.normal = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: normals
});
}
if (vertexFormat.tangent) {
attributes.tangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: tangents
});
}
if (vertexFormat.bitangent) {
attributes.bitangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: bitangents
});
}
if (shadowVolume) {
attributes.extrudeDirection = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: extrudeNormals
});
}
if (defined_default(options.offsetAttribute)) {
let offsetAttribute = new Uint8Array(size);
if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
} else {
const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
offsetAttribute = offsetAttribute.fill(offsetValue);
}
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: offsetAttribute
});
}
return attributes;
}
function computeWallIndices(positions) {
const length = positions.length / 3;
const indices = IndexDatatype_default.createTypedArray(length, length * 6);
let index = 0;
for (let i = 0; i < length; i++) {
const UL = i;
const LL = i + length;
const UR = (UL + 1) % length;
const LR = UR + length;
indices[index++] = UL;
indices[index++] = LL;
indices[index++] = UR;
indices[index++] = UR;
indices[index++] = LL;
indices[index++] = LR;
}
return indices;
}
var topBoundingSphere = new BoundingSphere_default();
var bottomBoundingSphere = new BoundingSphere_default();
function computeExtrudedEllipse(options) {
const center = options.center;
const ellipsoid = options.ellipsoid;
const semiMajorAxis = options.semiMajorAxis;
let scaledNormal = Cartesian3_default.multiplyByScalar(
ellipsoid.geodeticSurfaceNormal(center, scratchCartesian1),
options.height,
scratchCartesian1
);
topBoundingSphere.center = Cartesian3_default.add(
center,
scaledNormal,
topBoundingSphere.center
);
topBoundingSphere.radius = semiMajorAxis;
scaledNormal = Cartesian3_default.multiplyByScalar(
ellipsoid.geodeticSurfaceNormal(center, scaledNormal),
options.extrudedHeight,
scaledNormal
);
bottomBoundingSphere.center = Cartesian3_default.add(
center,
scaledNormal,
bottomBoundingSphere.center
);
bottomBoundingSphere.radius = semiMajorAxis;
const cep = EllipseGeometryLibrary_default.computeEllipsePositions(
options,
true,
true
);
const positions = cep.positions;
const numPts = cep.numPts;
const outerPositions = cep.outerPositions;
const boundingSphere = BoundingSphere_default.union(
topBoundingSphere,
bottomBoundingSphere
);
const topBottomAttributes = computeTopBottomAttributes(
positions,
options,
true
);
let indices = topIndices(numPts);
const length = indices.length;
indices.length = length * 2;
const posLength = positions.length / 3;
for (let i = 0; i < length; i += 3) {
indices[i + length] = indices[i + 2] + posLength;
indices[i + 1 + length] = indices[i + 1] + posLength;
indices[i + 2 + length] = indices[i] + posLength;
}
const topBottomIndices = IndexDatatype_default.createTypedArray(
posLength * 2 / 3,
indices
);
const topBottomGeo = new Geometry_default({
attributes: topBottomAttributes,
indices: topBottomIndices,
primitiveType: PrimitiveType_default.TRIANGLES
});
const wallAttributes = computeWallAttributes(outerPositions, options);
indices = computeWallIndices(outerPositions);
const wallIndices = IndexDatatype_default.createTypedArray(
outerPositions.length * 2 / 3,
indices
);
const wallGeo = new Geometry_default({
attributes: wallAttributes,
indices: wallIndices,
primitiveType: PrimitiveType_default.TRIANGLES
});
const geo = GeometryPipeline_default.combineInstances([
new GeometryInstance_default({
geometry: topBottomGeo
}),
new GeometryInstance_default({
geometry: wallGeo
})
]);
return {
boundingSphere,
attributes: geo[0].attributes,
indices: geo[0].indices
};
}
function computeRectangle(center, semiMajorAxis, semiMinorAxis, rotation, granularity, ellipsoid, result) {
const cep = EllipseGeometryLibrary_default.computeEllipsePositions(
{
center,
semiMajorAxis,
semiMinorAxis,
rotation,
granularity
},
false,
true
);
const positionsFlat = cep.outerPositions;
const positionsCount = positionsFlat.length / 3;
const positions = new Array(positionsCount);
for (let i = 0; i < positionsCount; ++i) {
positions[i] = Cartesian3_default.fromArray(positionsFlat, i * 3);
}
const rectangle = Rectangle_default.fromCartesianArray(positions, ellipsoid, result);
if (rectangle.width > Math_default.PI) {
rectangle.north = rectangle.north > 0 ? Math_default.PI_OVER_TWO - Math_default.EPSILON7 : rectangle.north;
rectangle.south = rectangle.south < 0 ? Math_default.EPSILON7 - Math_default.PI_OVER_TWO : rectangle.south;
rectangle.east = Math_default.PI;
rectangle.west = -Math_default.PI;
}
return rectangle;
}
function EllipseGeometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const center = options.center;
const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.default);
const semiMajorAxis = options.semiMajorAxis;
const semiMinorAxis = options.semiMinorAxis;
const granularity = defaultValue_default(
options.granularity,
Math_default.RADIANS_PER_DEGREE
);
const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
Check_default.defined("options.center", center);
Check_default.typeOf.number("options.semiMajorAxis", semiMajorAxis);
Check_default.typeOf.number("options.semiMinorAxis", semiMinorAxis);
if (semiMajorAxis < semiMinorAxis) {
throw new DeveloperError_default(
"semiMajorAxis must be greater than or equal to the semiMinorAxis."
);
}
if (granularity <= 0) {
throw new DeveloperError_default("granularity must be greater than zero.");
}
const height = defaultValue_default(options.height, 0);
const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
this._center = Cartesian3_default.clone(center);
this._semiMajorAxis = semiMajorAxis;
this._semiMinorAxis = semiMinorAxis;
this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
this._rotation = defaultValue_default(options.rotation, 0);
this._stRotation = defaultValue_default(options.stRotation, 0);
this._height = Math.max(extrudedHeight, height);
this._granularity = granularity;
this._vertexFormat = VertexFormat_default.clone(vertexFormat);
this._extrudedHeight = Math.min(extrudedHeight, height);
this._shadowVolume = defaultValue_default(options.shadowVolume, false);
this._workerName = "createEllipseGeometry";
this._offsetAttribute = options.offsetAttribute;
this._rectangle = void 0;
this._textureCoordinateRotationPoints = void 0;
}
EllipseGeometry.packedLength = Cartesian3_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 9;
EllipseGeometry.pack = function(value, array, startingIndex) {
Check_default.defined("value", value);
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
Cartesian3_default.pack(value._center, array, startingIndex);
startingIndex += Cartesian3_default.packedLength;
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
startingIndex += VertexFormat_default.packedLength;
array[startingIndex++] = value._semiMajorAxis;
array[startingIndex++] = value._semiMinorAxis;
array[startingIndex++] = value._rotation;
array[startingIndex++] = value._stRotation;
array[startingIndex++] = value._height;
array[startingIndex++] = value._granularity;
array[startingIndex++] = value._extrudedHeight;
array[startingIndex++] = value._shadowVolume ? 1 : 0;
array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
return array;
};
var scratchCenter = new Cartesian3_default();
var scratchEllipsoid = new Ellipsoid_default();
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
center: scratchCenter,
ellipsoid: scratchEllipsoid,
vertexFormat: scratchVertexFormat,
semiMajorAxis: void 0,
semiMinorAxis: void 0,
rotation: void 0,
stRotation: void 0,
height: void 0,
granularity: void 0,
extrudedHeight: void 0,
shadowVolume: void 0,
offsetAttribute: void 0
};
EllipseGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
const center = Cartesian3_default.unpack(array, startingIndex, scratchCenter);
startingIndex += Cartesian3_default.packedLength;
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex,
scratchVertexFormat
);
startingIndex += VertexFormat_default.packedLength;
const semiMajorAxis = array[startingIndex++];
const semiMinorAxis = array[startingIndex++];
const rotation = array[startingIndex++];
const stRotation = array[startingIndex++];
const height = array[startingIndex++];
const granularity = array[startingIndex++];
const extrudedHeight = array[startingIndex++];
const shadowVolume = array[startingIndex++] === 1;
const offsetAttribute = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.height = height;
scratchOptions.extrudedHeight = extrudedHeight;
scratchOptions.granularity = granularity;
scratchOptions.stRotation = stRotation;
scratchOptions.rotation = rotation;
scratchOptions.semiMajorAxis = semiMajorAxis;
scratchOptions.semiMinorAxis = semiMinorAxis;
scratchOptions.shadowVolume = shadowVolume;
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new EllipseGeometry(scratchOptions);
}
result._center = Cartesian3_default.clone(center, result._center);
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
result._semiMajorAxis = semiMajorAxis;
result._semiMinorAxis = semiMinorAxis;
result._rotation = rotation;
result._stRotation = stRotation;
result._height = height;
result._granularity = granularity;
result._extrudedHeight = extrudedHeight;
result._shadowVolume = shadowVolume;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
EllipseGeometry.computeRectangle = function(options, result) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const center = options.center;
const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.default);
const semiMajorAxis = options.semiMajorAxis;
const semiMinorAxis = options.semiMinorAxis;
const granularity = defaultValue_default(
options.granularity,
Math_default.RADIANS_PER_DEGREE
);
const rotation = defaultValue_default(options.rotation, 0);
Check_default.defined("options.center", center);
Check_default.typeOf.number("options.semiMajorAxis", semiMajorAxis);
Check_default.typeOf.number("options.semiMinorAxis", semiMinorAxis);
if (semiMajorAxis < semiMinorAxis) {
throw new DeveloperError_default(
"semiMajorAxis must be greater than or equal to the semiMinorAxis."
);
}
if (granularity <= 0) {
throw new DeveloperError_default("granularity must be greater than zero.");
}
return computeRectangle(
center,
semiMajorAxis,
semiMinorAxis,
rotation,
granularity,
ellipsoid,
result
);
};
EllipseGeometry.createGeometry = function(ellipseGeometry) {
if (ellipseGeometry._semiMajorAxis <= 0 || ellipseGeometry._semiMinorAxis <= 0) {
return;
}
const height = ellipseGeometry._height;
const extrudedHeight = ellipseGeometry._extrudedHeight;
const extrude = !Math_default.equalsEpsilon(
height,
extrudedHeight,
0,
Math_default.EPSILON2
);
ellipseGeometry._center = ellipseGeometry._ellipsoid.scaleToGeodeticSurface(
ellipseGeometry._center,
ellipseGeometry._center
);
const options = {
center: ellipseGeometry._center,
semiMajorAxis: ellipseGeometry._semiMajorAxis,
semiMinorAxis: ellipseGeometry._semiMinorAxis,
ellipsoid: ellipseGeometry._ellipsoid,
rotation: ellipseGeometry._rotation,
height,
granularity: ellipseGeometry._granularity,
vertexFormat: ellipseGeometry._vertexFormat,
stRotation: ellipseGeometry._stRotation
};
let geometry;
if (extrude) {
options.extrudedHeight = extrudedHeight;
options.shadowVolume = ellipseGeometry._shadowVolume;
options.offsetAttribute = ellipseGeometry._offsetAttribute;
geometry = computeExtrudedEllipse(options);
} else {
geometry = computeEllipse(options);
if (defined_default(ellipseGeometry._offsetAttribute)) {
const length = geometry.attributes.position.values.length;
const offsetValue = ellipseGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
geometry.attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
}
return new Geometry_default({
attributes: geometry.attributes,
indices: geometry.indices,
primitiveType: PrimitiveType_default.TRIANGLES,
boundingSphere: geometry.boundingSphere,
offsetAttribute: ellipseGeometry._offsetAttribute
});
};
EllipseGeometry.createShadowVolume = function(ellipseGeometry, minHeightFunc, maxHeightFunc) {
const granularity = ellipseGeometry._granularity;
const ellipsoid = ellipseGeometry._ellipsoid;
const minHeight = minHeightFunc(granularity, ellipsoid);
const maxHeight = maxHeightFunc(granularity, ellipsoid);
return new EllipseGeometry({
center: ellipseGeometry._center,
semiMajorAxis: ellipseGeometry._semiMajorAxis,
semiMinorAxis: ellipseGeometry._semiMinorAxis,
ellipsoid,
rotation: ellipseGeometry._rotation,
stRotation: ellipseGeometry._stRotation,
granularity,
extrudedHeight: minHeight,
height: maxHeight,
vertexFormat: VertexFormat_default.POSITION_ONLY,
shadowVolume: true
});
};
function textureCoordinateRotationPoints(ellipseGeometry) {
const stRotation = -ellipseGeometry._stRotation;
if (stRotation === 0) {
return [0, 0, 0, 1, 1, 0];
}
const cep = EllipseGeometryLibrary_default.computeEllipsePositions(
{
center: ellipseGeometry._center,
semiMajorAxis: ellipseGeometry._semiMajorAxis,
semiMinorAxis: ellipseGeometry._semiMinorAxis,
rotation: ellipseGeometry._rotation,
granularity: ellipseGeometry._granularity
},
false,
true
);
const positionsFlat = cep.outerPositions;
const positionsCount = positionsFlat.length / 3;
const positions = new Array(positionsCount);
for (let i = 0; i < positionsCount; ++i) {
positions[i] = Cartesian3_default.fromArray(positionsFlat, i * 3);
}
const ellipsoid = ellipseGeometry._ellipsoid;
const boundingRectangle = ellipseGeometry.rectangle;
return Geometry_default._textureCoordinateRotationPoints(
positions,
stRotation,
ellipsoid,
boundingRectangle
);
}
Object.defineProperties(EllipseGeometry.prototype, {
/**
* @private
*/
rectangle: {
get: function() {
if (!defined_default(this._rectangle)) {
this._rectangle = computeRectangle(
this._center,
this._semiMajorAxis,
this._semiMinorAxis,
this._rotation,
this._granularity,
this._ellipsoid
);
}
return this._rectangle;
}
},
/**
* For remapping texture coordinates when rendering EllipseGeometries as GroundPrimitives.
* @private
*/
textureCoordinateRotationPoints: {
get: function() {
if (!defined_default(this._textureCoordinateRotationPoints)) {
this._textureCoordinateRotationPoints = textureCoordinateRotationPoints(
this
);
}
return this._textureCoordinateRotationPoints;
}
}
});
var EllipseGeometry_default = EllipseGeometry;
export {
EllipseGeometry_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
PrimitivePipeline_default
} from "./chunk-IBRIWOCM.js";
import {
createTaskProcessorWorker_default
} from "./chunk-Z2QP3CXW.js";
import "./chunk-RJM36CNY.js";
import "./chunk-7ZZ5LMZY.js";
import "./chunk-LJ2JQHJT.js";
import "./chunk-NGZJIN5Z.js";
import "./chunk-QQOZO7KO.js";
import "./chunk-EDLRS3AW.js";
import "./chunk-C4WPMOKT.js";
import "./chunk-X7IQYYHF.js";
import "./chunk-JXVLNVXC.js";
import "./chunk-KHZNBFOH.js";
import "./chunk-6SQMLVGV.js";
import "./chunk-XIUSRWL6.js";
import "./chunk-FFLMY4TE.js";
import "./chunk-WGDFYAGC.js";
import "./chunk-3HQMMUPU.js";
import "./chunk-LLAF3CPH.js";
import "./chunk-U5HSOKPQ.js";
import "./chunk-P6TRGU3S.js";
import "./chunk-YCDZX5LS.js";
// packages/engine/Source/Workers/combineGeometry.js
function combineGeometry(packedParameters, transferableObjects) {
const parameters = PrimitivePipeline_default.unpackCombineGeometryParameters(
packedParameters
);
const results = PrimitivePipeline_default.combineGeometry(parameters);
return PrimitivePipeline_default.packCombineGeometryResults(
results,
transferableObjects
);
}
var combineGeometry_default = createTaskProcessorWorker_default(combineGeometry);
export {
combineGeometry_default as default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
BoxGeometry_default
} from "./chunk-HJMNR3GC.js";
import "./chunk-GBT7MJ6X.js";
import "./chunk-JBSKHTNX.js";
import "./chunk-X7IQYYHF.js";
import "./chunk-JXVLNVXC.js";
import "./chunk-KHZNBFOH.js";
import "./chunk-6SQMLVGV.js";
import "./chunk-XIUSRWL6.js";
import "./chunk-FFLMY4TE.js";
import "./chunk-WGDFYAGC.js";
import "./chunk-3HQMMUPU.js";
import "./chunk-LLAF3CPH.js";
import "./chunk-U5HSOKPQ.js";
import "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Workers/createBoxGeometry.js
function createBoxGeometry(boxGeometry, offset) {
if (defined_default(offset)) {
boxGeometry = BoxGeometry_default.unpack(boxGeometry, offset);
}
return BoxGeometry_default.createGeometry(boxGeometry);
}
var createBoxGeometry_default = createBoxGeometry;
export {
createBoxGeometry_default as default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
GeometryOffsetAttribute_default
} from "./chunk-GBT7MJ6X.js";
import {
GeometryAttributes_default
} from "./chunk-X7IQYYHF.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-JXVLNVXC.js";
import {
BoundingSphere_default
} from "./chunk-KHZNBFOH.js";
import "./chunk-6SQMLVGV.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian3_default
} from "./chunk-FFLMY4TE.js";
import "./chunk-WGDFYAGC.js";
import "./chunk-3HQMMUPU.js";
import "./chunk-LLAF3CPH.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/BoxOutlineGeometry.js
var diffScratch = new Cartesian3_default();
function BoxOutlineGeometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const min = options.minimum;
const max = options.maximum;
Check_default.typeOf.object("min", min);
Check_default.typeOf.object("max", max);
if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
throw new DeveloperError_default(
"GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
);
}
this._min = Cartesian3_default.clone(min);
this._max = Cartesian3_default.clone(max);
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createBoxOutlineGeometry";
}
BoxOutlineGeometry.fromDimensions = function(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const dimensions = options.dimensions;
Check_default.typeOf.object("dimensions", dimensions);
Check_default.typeOf.number.greaterThanOrEquals("dimensions.x", dimensions.x, 0);
Check_default.typeOf.number.greaterThanOrEquals("dimensions.y", dimensions.y, 0);
Check_default.typeOf.number.greaterThanOrEquals("dimensions.z", dimensions.z, 0);
const corner = Cartesian3_default.multiplyByScalar(dimensions, 0.5, new Cartesian3_default());
return new BoxOutlineGeometry({
minimum: Cartesian3_default.negate(corner, new Cartesian3_default()),
maximum: corner,
offsetAttribute: options.offsetAttribute
});
};
BoxOutlineGeometry.fromAxisAlignedBoundingBox = function(boundingBox) {
Check_default.typeOf.object("boundindBox", boundingBox);
return new BoxOutlineGeometry({
minimum: boundingBox.minimum,
maximum: boundingBox.maximum
});
};
BoxOutlineGeometry.packedLength = 2 * Cartesian3_default.packedLength + 1;
BoxOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
Cartesian3_default.pack(value._min, array, startingIndex);
Cartesian3_default.pack(value._max, array, startingIndex + Cartesian3_default.packedLength);
array[startingIndex + Cartesian3_default.packedLength * 2] = defaultValue_default(
value._offsetAttribute,
-1
);
return array;
};
var scratchMin = new Cartesian3_default();
var scratchMax = new Cartesian3_default();
var scratchOptions = {
minimum: scratchMin,
maximum: scratchMax,
offsetAttribute: void 0
};
BoxOutlineGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
const min = Cartesian3_default.unpack(array, startingIndex, scratchMin);
const max = Cartesian3_default.unpack(
array,
startingIndex + Cartesian3_default.packedLength,
scratchMax
);
const offsetAttribute = array[startingIndex + Cartesian3_default.packedLength * 2];
if (!defined_default(result)) {
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new BoxOutlineGeometry(scratchOptions);
}
result._min = Cartesian3_default.clone(min, result._min);
result._max = Cartesian3_default.clone(max, result._max);
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
BoxOutlineGeometry.createGeometry = function(boxGeometry) {
const min = boxGeometry._min;
const max = boxGeometry._max;
if (Cartesian3_default.equals(min, max)) {
return;
}
const attributes = new GeometryAttributes_default();
const indices = new Uint16Array(12 * 2);
const positions = new Float64Array(8 * 3);
positions[0] = min.x;
positions[1] = min.y;
positions[2] = min.z;
positions[3] = max.x;
positions[4] = min.y;
positions[5] = min.z;
positions[6] = max.x;
positions[7] = max.y;
positions[8] = min.z;
positions[9] = min.x;
positions[10] = max.y;
positions[11] = min.z;
positions[12] = min.x;
positions[13] = min.y;
positions[14] = max.z;
positions[15] = max.x;
positions[16] = min.y;
positions[17] = max.z;
positions[18] = max.x;
positions[19] = max.y;
positions[20] = max.z;
positions[21] = min.x;
positions[22] = max.y;
positions[23] = max.z;
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
indices[0] = 4;
indices[1] = 5;
indices[2] = 5;
indices[3] = 6;
indices[4] = 6;
indices[5] = 7;
indices[6] = 7;
indices[7] = 4;
indices[8] = 0;
indices[9] = 1;
indices[10] = 1;
indices[11] = 2;
indices[12] = 2;
indices[13] = 3;
indices[14] = 3;
indices[15] = 0;
indices[16] = 0;
indices[17] = 4;
indices[18] = 1;
indices[19] = 5;
indices[20] = 2;
indices[21] = 6;
indices[22] = 3;
indices[23] = 7;
const diff = Cartesian3_default.subtract(max, min, diffScratch);
const radius = Cartesian3_default.magnitude(diff) * 0.5;
if (defined_default(boxGeometry._offsetAttribute)) {
const length = positions.length;
const offsetValue = boxGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, radius),
offsetAttribute: boxGeometry._offsetAttribute
});
};
var BoxOutlineGeometry_default = BoxOutlineGeometry;
// packages/engine/Source/Workers/createBoxOutlineGeometry.js
function createBoxOutlineGeometry(boxGeometry, offset) {
if (defined_default(offset)) {
boxGeometry = BoxOutlineGeometry_default.unpack(boxGeometry, offset);
}
return BoxOutlineGeometry_default.createGeometry(boxGeometry);
}
var createBoxOutlineGeometry_default = createBoxOutlineGeometry;
export {
createBoxOutlineGeometry_default as default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
EllipseGeometry_default
} from "./chunk-ZVUUPJEM.js";
import "./chunk-JISPSEF3.js";
import "./chunk-YSIJTJ7N.js";
import "./chunk-7ZZ5LMZY.js";
import "./chunk-LJ2JQHJT.js";
import "./chunk-NGZJIN5Z.js";
import "./chunk-GBT7MJ6X.js";
import {
VertexFormat_default
} from "./chunk-JBSKHTNX.js";
import "./chunk-QQOZO7KO.js";
import "./chunk-EDLRS3AW.js";
import "./chunk-C4WPMOKT.js";
import "./chunk-X7IQYYHF.js";
import "./chunk-JXVLNVXC.js";
import "./chunk-KHZNBFOH.js";
import "./chunk-6SQMLVGV.js";
import "./chunk-XIUSRWL6.js";
import {
Cartesian3_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import "./chunk-WGDFYAGC.js";
import "./chunk-3HQMMUPU.js";
import "./chunk-LLAF3CPH.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/CircleGeometry.js
function CircleGeometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const radius = options.radius;
Check_default.typeOf.number("radius", radius);
const ellipseGeometryOptions = {
center: options.center,
semiMajorAxis: radius,
semiMinorAxis: radius,
ellipsoid: options.ellipsoid,
height: options.height,
extrudedHeight: options.extrudedHeight,
granularity: options.granularity,
vertexFormat: options.vertexFormat,
stRotation: options.stRotation,
shadowVolume: options.shadowVolume
};
this._ellipseGeometry = new EllipseGeometry_default(ellipseGeometryOptions);
this._workerName = "createCircleGeometry";
}
CircleGeometry.packedLength = EllipseGeometry_default.packedLength;
CircleGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
return EllipseGeometry_default.pack(value._ellipseGeometry, array, startingIndex);
};
var scratchEllipseGeometry = new EllipseGeometry_default({
center: new Cartesian3_default(),
semiMajorAxis: 1,
semiMinorAxis: 1
});
var scratchOptions = {
center: new Cartesian3_default(),
radius: void 0,
ellipsoid: Ellipsoid_default.clone(Ellipsoid_default.default),
height: void 0,
extrudedHeight: void 0,
granularity: void 0,
vertexFormat: new VertexFormat_default(),
stRotation: void 0,
semiMajorAxis: void 0,
semiMinorAxis: void 0,
shadowVolume: void 0
};
CircleGeometry.unpack = function(array, startingIndex, result) {
const ellipseGeometry = EllipseGeometry_default.unpack(
array,
startingIndex,
scratchEllipseGeometry
);
scratchOptions.center = Cartesian3_default.clone(
ellipseGeometry._center,
scratchOptions.center
);
scratchOptions.ellipsoid = Ellipsoid_default.clone(
ellipseGeometry._ellipsoid,
scratchOptions.ellipsoid
);
scratchOptions.ellipsoid = Ellipsoid_default.clone(
ellipseGeometry._ellipsoid,
scratchEllipseGeometry._ellipsoid
);
scratchOptions.height = ellipseGeometry._height;
scratchOptions.extrudedHeight = ellipseGeometry._extrudedHeight;
scratchOptions.granularity = ellipseGeometry._granularity;
scratchOptions.vertexFormat = VertexFormat_default.clone(
ellipseGeometry._vertexFormat,
scratchOptions.vertexFormat
);
scratchOptions.stRotation = ellipseGeometry._stRotation;
scratchOptions.shadowVolume = ellipseGeometry._shadowVolume;
if (!defined_default(result)) {
scratchOptions.radius = ellipseGeometry._semiMajorAxis;
return new CircleGeometry(scratchOptions);
}
scratchOptions.semiMajorAxis = ellipseGeometry._semiMajorAxis;
scratchOptions.semiMinorAxis = ellipseGeometry._semiMinorAxis;
result._ellipseGeometry = new EllipseGeometry_default(scratchOptions);
return result;
};
CircleGeometry.createGeometry = function(circleGeometry) {
return EllipseGeometry_default.createGeometry(circleGeometry._ellipseGeometry);
};
CircleGeometry.createShadowVolume = function(circleGeometry, minHeightFunc, maxHeightFunc) {
const granularity = circleGeometry._ellipseGeometry._granularity;
const ellipsoid = circleGeometry._ellipseGeometry._ellipsoid;
const minHeight = minHeightFunc(granularity, ellipsoid);
const maxHeight = maxHeightFunc(granularity, ellipsoid);
return new CircleGeometry({
center: circleGeometry._ellipseGeometry._center,
radius: circleGeometry._ellipseGeometry._semiMajorAxis,
ellipsoid,
stRotation: circleGeometry._ellipseGeometry._stRotation,
granularity,
extrudedHeight: minHeight,
height: maxHeight,
vertexFormat: VertexFormat_default.POSITION_ONLY,
shadowVolume: true
});
};
Object.defineProperties(CircleGeometry.prototype, {
/**
* @private
*/
rectangle: {
get: function() {
return this._ellipseGeometry.rectangle;
}
},
/**
* For remapping texture coordinates when rendering CircleGeometries as GroundPrimitives.
* @private
*/
textureCoordinateRotationPoints: {
get: function() {
return this._ellipseGeometry.textureCoordinateRotationPoints;
}
}
});
var CircleGeometry_default = CircleGeometry;
// packages/engine/Source/Workers/createCircleGeometry.js
function createCircleGeometry(circleGeometry, offset) {
if (defined_default(offset)) {
circleGeometry = CircleGeometry_default.unpack(circleGeometry, offset);
}
circleGeometry._ellipseGeometry._center = Cartesian3_default.clone(
circleGeometry._ellipseGeometry._center
);
circleGeometry._ellipseGeometry._ellipsoid = Ellipsoid_default.clone(
circleGeometry._ellipseGeometry._ellipsoid
);
return CircleGeometry_default.createGeometry(circleGeometry);
}
var createCircleGeometry_default = createCircleGeometry;
export {
createCircleGeometry_default as default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
EllipseOutlineGeometry_default
} from "./chunk-2LOWCAMW.js";
import "./chunk-JISPSEF3.js";
import "./chunk-GBT7MJ6X.js";
import "./chunk-C4WPMOKT.js";
import "./chunk-X7IQYYHF.js";
import "./chunk-JXVLNVXC.js";
import "./chunk-KHZNBFOH.js";
import "./chunk-6SQMLVGV.js";
import "./chunk-XIUSRWL6.js";
import {
Cartesian3_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import "./chunk-WGDFYAGC.js";
import "./chunk-3HQMMUPU.js";
import "./chunk-LLAF3CPH.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/CircleOutlineGeometry.js
function CircleOutlineGeometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const radius = options.radius;
Check_default.typeOf.number("radius", radius);
const ellipseGeometryOptions = {
center: options.center,
semiMajorAxis: radius,
semiMinorAxis: radius,
ellipsoid: options.ellipsoid,
height: options.height,
extrudedHeight: options.extrudedHeight,
granularity: options.granularity,
numberOfVerticalLines: options.numberOfVerticalLines
};
this._ellipseGeometry = new EllipseOutlineGeometry_default(ellipseGeometryOptions);
this._workerName = "createCircleOutlineGeometry";
}
CircleOutlineGeometry.packedLength = EllipseOutlineGeometry_default.packedLength;
CircleOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
return EllipseOutlineGeometry_default.pack(
value._ellipseGeometry,
array,
startingIndex
);
};
var scratchEllipseGeometry = new EllipseOutlineGeometry_default({
center: new Cartesian3_default(),
semiMajorAxis: 1,
semiMinorAxis: 1
});
var scratchOptions = {
center: new Cartesian3_default(),
radius: void 0,
ellipsoid: Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE),
height: void 0,
extrudedHeight: void 0,
granularity: void 0,
numberOfVerticalLines: void 0,
semiMajorAxis: void 0,
semiMinorAxis: void 0
};
CircleOutlineGeometry.unpack = function(array, startingIndex, result) {
const ellipseGeometry = EllipseOutlineGeometry_default.unpack(
array,
startingIndex,
scratchEllipseGeometry
);
scratchOptions.center = Cartesian3_default.clone(
ellipseGeometry._center,
scratchOptions.center
);
scratchOptions.ellipsoid = Ellipsoid_default.clone(
ellipseGeometry._ellipsoid,
scratchOptions.ellipsoid
);
scratchOptions.height = ellipseGeometry._height;
scratchOptions.extrudedHeight = ellipseGeometry._extrudedHeight;
scratchOptions.granularity = ellipseGeometry._granularity;
scratchOptions.numberOfVerticalLines = ellipseGeometry._numberOfVerticalLines;
if (!defined_default(result)) {
scratchOptions.radius = ellipseGeometry._semiMajorAxis;
return new CircleOutlineGeometry(scratchOptions);
}
scratchOptions.semiMajorAxis = ellipseGeometry._semiMajorAxis;
scratchOptions.semiMinorAxis = ellipseGeometry._semiMinorAxis;
result._ellipseGeometry = new EllipseOutlineGeometry_default(scratchOptions);
return result;
};
CircleOutlineGeometry.createGeometry = function(circleGeometry) {
return EllipseOutlineGeometry_default.createGeometry(circleGeometry._ellipseGeometry);
};
var CircleOutlineGeometry_default = CircleOutlineGeometry;
// packages/engine/Source/Workers/createCircleOutlineGeometry.js
function createCircleOutlineGeometry(circleGeometry, offset) {
if (defined_default(offset)) {
circleGeometry = CircleOutlineGeometry_default.unpack(circleGeometry, offset);
}
circleGeometry._ellipseGeometry._center = Cartesian3_default.clone(
circleGeometry._ellipseGeometry._center
);
circleGeometry._ellipseGeometry._ellipsoid = Ellipsoid_default.clone(
circleGeometry._ellipseGeometry._ellipsoid
);
return CircleOutlineGeometry_default.createGeometry(circleGeometry);
}
var createCircleOutlineGeometry_default = createCircleOutlineGeometry;
export {
createCircleOutlineGeometry_default as default
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment