/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.99 * * 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. */ define(["exports","./defaultValue-135942ca","./Math-a304e2d6"],(function(e,t,n){"use strict";function i(e,n,i){this.x=t.defaultValue(e,0),this.y=t.defaultValue(n,0),this.z=t.defaultValue(i,0)}i.fromSpherical=function(e,n){t.defined(n)||(n=new i);const r=e.clock,a=e.cone,o=t.defaultValue(e.magnitude,1),u=o*Math.sin(a);return n.x=u*Math.cos(r),n.y=u*Math.sin(r),n.z=o*Math.cos(a),n},i.fromElements=function(e,n,r,a){return t.defined(a)?(a.x=e,a.y=n,a.z=r,a):new i(e,n,r)},i.clone=function(e,n){if(t.defined(e))return t.defined(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new i(e.x,e.y,e.z)},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(e,n,i){return i=t.defaultValue(i,0),n[i++]=e.x,n[i++]=e.y,n[i]=e.z,n},i.unpack=function(e,n,r){return n=t.defaultValue(n,0),t.defined(r)||(r=new i),r.x=e[n++],r.y=e[n++],r.z=e[n],r},i.packArray=function(e,n){const r=e.length,a=3*r;t.defined(n)?(Array.isArray(n)||n.length===a)&&n.length!==a&&(n.length=a):n=new Array(a);for(let t=0;tn.CesiumMath.EPSILON12);return t.defined(u)?(u.x=c*b,u.y=s*E,u.z=d*T,u):new i(c*b,s*E,d*T)}function y(e,n,i){this.longitude=t.defaultValue(e,0),this.latitude=t.defaultValue(n,0),this.height=t.defaultValue(i,0)}y.fromRadians=function(e,n,i,r){return i=t.defaultValue(i,0),t.defined(r)?(r.longitude=e,r.latitude=n,r.height=i,r):new y(e,n,i)},y.fromDegrees=function(e,t,i,r){return e=n.CesiumMath.toRadians(e),t=n.CesiumMath.toRadians(t),y.fromRadians(e,t,i,r)};const p=new i,g=new i,x=new i,z=new i(1/6378137,1/6378137,1/6356752.314245179),M=new i(1/40680631590769,1/40680631590769,1/40408299984661.445),w=n.CesiumMath.EPSILON1;function S(e,r,a,o){r=t.defaultValue(r,0),a=t.defaultValue(a,0),o=t.defaultValue(o,0),e._radii=new i(r,a,o),e._radiiSquared=new i(r*r,a*a,o*o),e._radiiToTheFourth=new i(r*r*r*r,a*a*a*a,o*o*o*o),e._oneOverRadii=new i(0===r?0:1/r,0===a?0:1/a,0===o?0:1/o),e._oneOverRadiiSquared=new i(0===r?0:1/(r*r),0===a?0:1/(a*a),0===o?0:1/(o*o)),e._minimumRadius=Math.min(r,a,o),e._maximumRadius=Math.max(r,a,o),e._centerToleranceSquared=n.CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function q(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,S(this,e,t,n)}y.fromCartesian=function(e,r,a){const o=t.defined(r)?r.oneOverRadii:z,u=t.defined(r)?r.oneOverRadiiSquared:M,c=m(e,o,u,t.defined(r)?r._centerToleranceSquared:w,g);if(!t.defined(c))return;let s=i.multiplyComponents(c,u,p);s=i.normalize(s,s);const d=i.subtract(e,c,x),l=Math.atan2(s.y,s.x),f=Math.asin(s.z),h=n.CesiumMath.sign(i.dot(d,e))*i.magnitude(d);return t.defined(a)?(a.longitude=l,a.latitude=f,a.height=h,a):new y(l,f,h)},y.toCartesian=function(e,t,n){return i.fromRadians(e.longitude,e.latitude,e.height,t,n)},y.clone=function(e,n){if(t.defined(e))return t.defined(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new y(e.longitude,e.latitude,e.height)},y.equals=function(e,n){return e===n||t.defined(e)&&t.defined(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},y.equalsEpsilon=function(e,n,i){return i=t.defaultValue(i,0),e===n||t.defined(e)&&t.defined(n)&&Math.abs(e.longitude-n.longitude)<=i&&Math.abs(e.latitude-n.latitude)<=i&&Math.abs(e.height-n.height)<=i},y.ZERO=Object.freeze(new y(0,0,0)),y.prototype.clone=function(e){return y.clone(this,e)},y.prototype.equals=function(e){return y.equals(this,e)},y.prototype.equalsEpsilon=function(e,t){return y.equalsEpsilon(this,e,t)},y.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(q.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),q.clone=function(e,n){if(!t.defined(e))return;const r=e._radii;return t.defined(n)?(i.clone(r,n._radii),i.clone(e._radiiSquared,n._radiiSquared),i.clone(e._radiiToTheFourth,n._radiiToTheFourth),i.clone(e._oneOverRadii,n._oneOverRadii),i.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new q(r.x,r.y,r.z)},q.fromCartesian3=function(e,n){return t.defined(n)||(n=new q),t.defined(e)?(S(n,e.x,e.y,e.z),n):n},q.WGS84=Object.freeze(new q(6378137,6378137,6356752.314245179)),q.UNIT_SPHERE=Object.freeze(new q(1,1,1)),q.MOON=Object.freeze(new q(n.CesiumMath.LUNAR_RADIUS,n.CesiumMath.LUNAR_RADIUS,n.CesiumMath.LUNAR_RADIUS)),q.prototype.clone=function(e){return q.clone(this,e)},q.packedLength=i.packedLength,q.pack=function(e,n,r){return r=t.defaultValue(r,0),i.pack(e._radii,n,r),n},q.unpack=function(e,n,r){n=t.defaultValue(n,0);const a=i.unpack(e,n);return q.fromCartesian3(a,r)},q.prototype.geocentricSurfaceNormal=i.normalize,q.prototype.geodeticSurfaceNormalCartographic=function(e,n){const r=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(r),c=o*Math.sin(r),s=Math.sin(a);return t.defined(n)||(n=new i),n.x=u,n.y=c,n.z=s,i.normalize(n,n)},q.prototype.geodeticSurfaceNormal=function(e,r){if(!i.equalsEpsilon(e,i.ZERO,n.CesiumMath.EPSILON14))return t.defined(r)||(r=new i),r=i.multiplyComponents(e,this._oneOverRadiiSquared,r),i.normalize(r,r)};const R=new i,_=new i;q.prototype.cartographicToCartesian=function(e,n){const r=R,a=_;this.geodeticSurfaceNormalCartographic(e,r),i.multiplyComponents(this._radiiSquared,r,a);const o=Math.sqrt(i.dot(r,a));return i.divideByScalar(a,o,a),i.multiplyByScalar(r,e.height,r),t.defined(n)||(n=new i),i.add(a,r,n)},q.prototype.cartographicArrayToCartesianArray=function(e,n){const i=e.length;t.defined(n)?n.length=i:n=new Array(i);for(let t=0;t=this._radii.z-n))return r};const E=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],T=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function A(e,t,n){const i=.5*(t+e),r=.5*(t-e);let a=0;for(let e=0;e<5;e++){const t=r*E[e];a+=T[e]*(n(i+t)+n(i-t))}return a*=r,a}function v(e,n,i,r,a,o,u,c,s){this[0]=t.defaultValue(e,0),this[1]=t.defaultValue(r,0),this[2]=t.defaultValue(u,0),this[3]=t.defaultValue(n,0),this[4]=t.defaultValue(a,0),this[5]=t.defaultValue(c,0),this[6]=t.defaultValue(i,0),this[7]=t.defaultValue(o,0),this[8]=t.defaultValue(s,0)}q.prototype.surfaceArea=function(e){const t=e.west;let i=e.east;const r=e.south,a=e.north;for(;ir&&(a=t,r=n)}let o=1,u=0;const c=B[a],s=j[a];if(Math.abs(e[v.getElementIndex(s,c)])>i){const t=(e[v.getElementIndex(s,s)]-e[v.getElementIndex(c,c)])/2/e[v.getElementIndex(s,c)];let n;n=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),o=1/Math.sqrt(1+n*n),u=n*o}return(t=v.clone(v.IDENTITY,t))[v.getElementIndex(c,c)]=t[v.getElementIndex(s,s)]=o,t[v.getElementIndex(s,c)]=u,t[v.getElementIndex(c,s)]=-u,t}const D=new v,W=new v;v.computeEigenDecomposition=function(e,i){const r=n.CesiumMath.EPSILON20;let a=0,o=0;t.defined(i)||(i={});const u=i.unitary=v.clone(v.IDENTITY,i.unitary),c=i.diagonal=v.clone(e,i.diagonal),s=r*function(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}(c);for(;o<10&&$(c)>s;)P(c,D),v.transpose(D,W),v.multiply(c,D,c),v.multiply(W,c,c),v.multiply(u,D,u),++a>2&&(++o,a=0);return i},v.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},v.determinant=function(e){const t=e[0],n=e[3],i=e[6],r=e[1],a=e[4],o=e[7],u=e[2],c=e[5],s=e[8];return t*(a*s-c*o)+r*(c*i-n*s)+u*(n*o-a*i)},v.inverse=function(e,t){const n=e[0],i=e[1],r=e[2],a=e[3],o=e[4],u=e[5],c=e[6],s=e[7],d=e[8],l=v.determinant(e);t[0]=o*d-s*u,t[1]=s*r-i*d,t[2]=i*u-o*r,t[3]=c*u-a*d,t[4]=n*d-c*r,t[5]=a*r-n*u,t[6]=a*s-c*o,t[7]=c*i-n*s,t[8]=n*o-a*i;const f=1/l;return v.multiplyByScalar(t,f,t)};const Z=new v;v.inverseTranspose=function(e,t){return v.inverse(v.transpose(e,Z),t)},v.equals=function(e,n){return e===n||t.defined(e)&&t.defined(n)&&e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]&&e[3]===n[3]&&e[4]===n[4]&&e[5]===n[5]&&e[6]===n[6]&&e[7]===n[7]&&e[8]===n[8]},v.equalsEpsilon=function(e,n,i){return i=t.defaultValue(i,0),e===n||t.defined(e)&&t.defined(n)&&Math.abs(e[0]-n[0])<=i&&Math.abs(e[1]-n[1])<=i&&Math.abs(e[2]-n[2])<=i&&Math.abs(e[3]-n[3])<=i&&Math.abs(e[4]-n[4])<=i&&Math.abs(e[5]-n[5])<=i&&Math.abs(e[6]-n[6])<=i&&Math.abs(e[7]-n[7])<=i&&Math.abs(e[8]-n[8])<=i},v.IDENTITY=Object.freeze(new v(1,0,0,0,1,0,0,0,1)),v.ZERO=Object.freeze(new v(0,0,0,0,0,0,0,0,0)),v.COLUMN0ROW0=0,v.COLUMN0ROW1=1,v.COLUMN0ROW2=2,v.COLUMN1ROW0=3,v.COLUMN1ROW1=4,v.COLUMN1ROW2=5,v.COLUMN2ROW0=6,v.COLUMN2ROW1=7,v.COLUMN2ROW2=8,Object.defineProperties(v.prototype,{length:{get:function(){return v.packedLength}}}),v.prototype.clone=function(e){return v.clone(this,e)},v.prototype.equals=function(e){return v.equals(this,e)},v.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},v.prototype.equalsEpsilon=function(e,t){return v.equalsEpsilon(this,e,t)},v.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})\n(${this[1]}, ${this[4]}, ${this[7]})\n(${this[2]}, ${this[5]}, ${this[8]})`},e.Cartesian3=i,e.Cartographic=y,e.Ellipsoid=q,e.Matrix3=v}));