月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-07-07 3c23ce2d0214a1246664e61fd51466033e25481e
1
define(["exports","./Transforms-f3654378","./Matrix3-6e56fbc7","./Matrix2-23dd5853","./ComponentDatatype-985dcc38","./defaultValue-865ac579","./GeometryAttribute-e3f63a02","./GeometryAttributes-75794475","./Math-76ce6367","./Plane-4befcca0","./VertexFormat-20b5279f"],(function(t,e,a,i,n,r,s,o,f,u,l){"use strict";function c(t){this.planes=r.defaultValue(t,[])}const h=[new a.Cartesian3,new a.Cartesian3,new a.Cartesian3];a.Cartesian3.clone(a.Cartesian3.UNIT_X,h[0]),a.Cartesian3.clone(a.Cartesian3.UNIT_Y,h[1]),a.Cartesian3.clone(a.Cartesian3.UNIT_Z,h[2]);const p=new a.Cartesian3,d=new a.Cartesian3,C=new u.Plane(new a.Cartesian3(1,0,0),0);function m(t){t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT),this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=r.defaultValue(t.near,1),this._near=this.near,this.far=r.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new c,this._orthographicMatrix=new i.Matrix4}function _(t){t.top===t._top&&t.bottom===t._bottom&&t.left===t._left&&t.right===t._right&&t.near===t._near&&t.far===t._far||(t._left=t.left,t._right=t.right,t._top=t.top,t._bottom=t.bottom,t._near=t.near,t._far=t.far,t._orthographicMatrix=i.Matrix4.computeOrthographicOffCenter(t.left,t.right,t.bottom,t.top,t.near,t.far,t._orthographicMatrix))}c.fromBoundingSphere=function(t,e){r.defined(e)||(e=new c);const n=h.length,s=e.planes;s.length=2*n;const o=t.center,f=t.radius;let u=0;for(let t=0;t<n;++t){const e=h[t];let n=s[u],l=s[u+1];r.defined(n)||(n=s[u]=new i.Cartesian4),r.defined(l)||(l=s[u+1]=new i.Cartesian4),a.Cartesian3.multiplyByScalar(e,-f,p),a.Cartesian3.add(o,p,p),n.x=e.x,n.y=e.y,n.z=e.z,n.w=-a.Cartesian3.dot(e,p),a.Cartesian3.multiplyByScalar(e,f,p),a.Cartesian3.add(o,p,p),l.x=-e.x,l.y=-e.y,l.z=-e.z,l.w=-a.Cartesian3.dot(a.Cartesian3.negate(e,d),p),u+=2}return e},c.prototype.computeVisibility=function(t){const a=this.planes;let i=!1;for(let n=0,r=a.length;n<r;++n){const r=t.intersectPlane(u.Plane.fromCartesian4(a[n],C));if(r===e.Intersect.OUTSIDE)return e.Intersect.OUTSIDE;r===e.Intersect.INTERSECTING&&(i=!0)}return i?e.Intersect.INTERSECTING:e.Intersect.INSIDE},c.prototype.computeVisibilityWithPlaneMask=function(t,a){if(a===c.MASK_OUTSIDE||a===c.MASK_INSIDE)return a;let i=c.MASK_INSIDE;const n=this.planes;for(let r=0,s=n.length;r<s;++r){const s=r<31?1<<r:0;if(r<31&&0==(a&s))continue;const o=t.intersectPlane(u.Plane.fromCartesian4(n[r],C));if(o===e.Intersect.OUTSIDE)return c.MASK_OUTSIDE;o===e.Intersect.INTERSECTING&&(i|=s)}return i},c.MASK_OUTSIDE=4294967295,c.MASK_INSIDE=0,c.MASK_INDETERMINATE=2147483647,Object.defineProperties(m.prototype,{projectionMatrix:{get:function(){return _(this),this._orthographicMatrix}}});const y=new a.Cartesian3,w=new a.Cartesian3,g=new a.Cartesian3,x=new a.Cartesian3;function v(t){t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new m,this.width=t.width,this._width=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=r.defaultValue(t.near,1),this._near=this.near,this.far=r.defaultValue(t.far,5e8),this._far=this.far}function F(t){const e=t._offCenterFrustum;if(t.width!==t._width||t.aspectRatio!==t._aspectRatio||t.near!==t._near||t.far!==t._far){t._aspectRatio=t.aspectRatio,t._width=t.width,t._near=t.near,t._far=t.far;const a=1/t.aspectRatio;e.right=.5*t.width,e.left=-e.right,e.top=a*e.right,e.bottom=-e.top,e.near=t.near,e.far=t.far}}function b(t){t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT),this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=r.defaultValue(t.near,1),this._near=this.near,this.far=r.defaultValue(t.far,5e8),this._far=this.far,this.farForTileset=r.defaultValue(t.farForTileset,5e8),this._farForTileset=this.farForTileset,this._cullingVolumeForTileset=new c,this._cullingVolume=new c,this._perspectiveMatrix=new i.Matrix4,this._infinitePerspective=new i.Matrix4}function M(t){const e=t.top,a=t.bottom,n=t.right,r=t.left,s=t.near,o=t.far;e===t._top&&a===t._bottom&&r===t._left&&n===t._right&&s===t._near&&o===t._far||(t._left=r,t._right=n,t._top=e,t._bottom=a,t._near=s,t._far=o,t._perspectiveMatrix=i.Matrix4.computePerspectiveOffCenter(r,n,a,e,s,o,t._perspectiveMatrix),t._infinitePerspective=i.Matrix4.computeInfinitePerspectiveOffCenter(r,n,a,e,s,t._infinitePerspective))}m.prototype.computeCullingVolume=function(t,e,n){const s=this._cullingVolume.planes,o=this.top,f=this.bottom,u=this.right,l=this.left,c=this.near,h=this.far,p=a.Cartesian3.cross(e,n,y);a.Cartesian3.normalize(p,p);const d=w;a.Cartesian3.multiplyByScalar(e,c,d),a.Cartesian3.add(t,d,d);const C=g;a.Cartesian3.multiplyByScalar(p,l,C),a.Cartesian3.add(d,C,C);let m=s[0];return r.defined(m)||(m=s[0]=new i.Cartesian4),m.x=p.x,m.y=p.y,m.z=p.z,m.w=-a.Cartesian3.dot(p,C),a.Cartesian3.multiplyByScalar(p,u,C),a.Cartesian3.add(d,C,C),m=s[1],r.defined(m)||(m=s[1]=new i.Cartesian4),m.x=-p.x,m.y=-p.y,m.z=-p.z,m.w=-a.Cartesian3.dot(a.Cartesian3.negate(p,x),C),a.Cartesian3.multiplyByScalar(n,f,C),a.Cartesian3.add(d,C,C),m=s[2],r.defined(m)||(m=s[2]=new i.Cartesian4),m.x=n.x,m.y=n.y,m.z=n.z,m.w=-a.Cartesian3.dot(n,C),a.Cartesian3.multiplyByScalar(n,o,C),a.Cartesian3.add(d,C,C),m=s[3],r.defined(m)||(m=s[3]=new i.Cartesian4),m.x=-n.x,m.y=-n.y,m.z=-n.z,m.w=-a.Cartesian3.dot(a.Cartesian3.negate(n,x),C),m=s[4],r.defined(m)||(m=s[4]=new i.Cartesian4),m.x=e.x,m.y=e.y,m.z=e.z,m.w=-a.Cartesian3.dot(e,d),a.Cartesian3.multiplyByScalar(e,h,C),a.Cartesian3.add(t,C,C),m=s[5],r.defined(m)||(m=s[5]=new i.Cartesian4),m.x=-e.x,m.y=-e.y,m.z=-e.z,m.w=-a.Cartesian3.dot(a.Cartesian3.negate(e,x),C),this._cullingVolume},m.prototype.getPixelDimensions=function(t,e,a,i,n){_(this);const r=i*(this.right-this.left)/t,s=i*(this.top-this.bottom)/e;return n.x=r,n.y=s,n},m.prototype.clone=function(t){return r.defined(t)||(t=new m),t.left=this.left,t.right=this.right,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t._left=void 0,t._right=void 0,t._top=void 0,t._bottom=void 0,t._near=void 0,t._far=void 0,t},m.prototype.equals=function(t){return r.defined(t)&&t instanceof m&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},m.prototype.equalsEpsilon=function(t,e,a){return t===this||r.defined(t)&&t instanceof m&&f.CesiumMath.equalsEpsilon(this.right,t.right,e,a)&&f.CesiumMath.equalsEpsilon(this.left,t.left,e,a)&&f.CesiumMath.equalsEpsilon(this.top,t.top,e,a)&&f.CesiumMath.equalsEpsilon(this.bottom,t.bottom,e,a)&&f.CesiumMath.equalsEpsilon(this.near,t.near,e,a)&&f.CesiumMath.equalsEpsilon(this.far,t.far,e,a)},v.packedLength=4,v.pack=function(t,e,a){return a=r.defaultValue(a,0),e[a++]=t.width,e[a++]=t.aspectRatio,e[a++]=t.near,e[a]=t.far,e},v.unpack=function(t,e,a){return e=r.defaultValue(e,0),r.defined(a)||(a=new v),a.width=t[e++],a.aspectRatio=t[e++],a.near=t[e++],a.far=t[e],a},Object.defineProperties(v.prototype,{projectionMatrix:{get:function(){return F(this),this._offCenterFrustum.projectionMatrix}}}),v.prototype.computeCullingVolume=function(t,e,a){return F(this),this._offCenterFrustum.computeCullingVolume(t,e,a)},v.prototype.getPixelDimensions=function(t,e,a,i,n){return F(this),this._offCenterFrustum.getPixelDimensions(t,e,a,i,n)},v.prototype.clone=function(t){return r.defined(t)||(t=new v),t.aspectRatio=this.aspectRatio,t.width=this.width,t.near=this.near,t.far=this.far,t._aspectRatio=void 0,t._width=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},v.prototype.equals=function(t){return!!(r.defined(t)&&t instanceof v)&&(F(this),F(t),this.width===t.width&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},v.prototype.equalsEpsilon=function(t,e,a){return!!(r.defined(t)&&t instanceof v)&&(F(this),F(t),f.CesiumMath.equalsEpsilon(this.width,t.width,e,a)&&f.CesiumMath.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,a)&&this._offCenterFrustum.equalsEpsilon(t._offCenterFrustum,e,a))},Object.defineProperties(b.prototype,{projectionMatrix:{get:function(){return M(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return M(this),this._infinitePerspective}}});const V=new a.Cartesian3,z=new a.Cartesian3,T=new a.Cartesian3,E=new a.Cartesian3;function O(t){t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new b,this.fov=t.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=r.defaultValue(t.near,1),this._near=this.near,this.far=r.defaultValue(t.far,5e8),this._far=this.far,this.farForTileset=r.defaultValue(t.farForTileset,5e8),this._farForTileset=this.farForTileset,this.xOffset=r.defaultValue(t.xOffset,0),this._xOffset=this.xOffset,this.yOffset=r.defaultValue(t.yOffset,0),this._yOffset=this.yOffset}function S(t){const e=t._offCenterFrustum;t.fov===t._fov&&t.aspectRatio===t._aspectRatio&&t.near===t._near&&t.far===t._far&&t.farForTileset===t._farForTileset&&t.xOffset===t._xOffset&&t.yOffset===t._yOffset||(t._aspectRatio=t.aspectRatio,t._fov=t.fov,t._fovy=t.aspectRatio<=1?t.fov:2*Math.atan(Math.tan(.5*t.fov)/t.aspectRatio),t._near=t.near,t._far=t.far,t._farForTileset=t.farForTileset,t._sseDenominator=2*Math.tan(.5*t._fovy),t._xOffset=t.xOffset,t._yOffset=t.yOffset,e.top=t.near*Math.tan(.5*t._fovy),e.bottom=-e.top,e.right=t.aspectRatio*e.top,e.left=-e.right,e.near=t.near,e.far=t.far,e.farForTileset=t.farForTileset,e.right+=t.xOffset,e.left+=t.xOffset,e.top+=t.yOffset,e.bottom+=t.yOffset)}b.prototype.computeCullingVolume=function(t,e,n){const s=this._cullingVolume.planes,o=this.top,f=this.bottom,u=this.right,l=this.left,c=this.near,h=this.far,p=a.Cartesian3.cross(e,n,V),d=z;a.Cartesian3.multiplyByScalar(e,c,d),a.Cartesian3.add(t,d,d);const C=T;a.Cartesian3.multiplyByScalar(e,h,C),a.Cartesian3.add(t,C,C);const m=E;a.Cartesian3.multiplyByScalar(p,l,m),a.Cartesian3.add(d,m,m),a.Cartesian3.subtract(m,t,m),a.Cartesian3.normalize(m,m),a.Cartesian3.cross(m,n,m),a.Cartesian3.normalize(m,m);let _=s[0];return r.defined(_)||(_=s[0]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,t),a.Cartesian3.multiplyByScalar(p,u,m),a.Cartesian3.add(d,m,m),a.Cartesian3.subtract(m,t,m),a.Cartesian3.cross(n,m,m),a.Cartesian3.normalize(m,m),_=s[1],r.defined(_)||(_=s[1]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,t),a.Cartesian3.multiplyByScalar(n,f,m),a.Cartesian3.add(d,m,m),a.Cartesian3.subtract(m,t,m),a.Cartesian3.cross(p,m,m),a.Cartesian3.normalize(m,m),_=s[2],r.defined(_)||(_=s[2]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,t),a.Cartesian3.multiplyByScalar(n,o,m),a.Cartesian3.add(d,m,m),a.Cartesian3.subtract(m,t,m),a.Cartesian3.cross(m,p,m),a.Cartesian3.normalize(m,m),_=s[3],r.defined(_)||(_=s[3]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,t),_=s[4],r.defined(_)||(_=s[4]=new i.Cartesian4),_.x=e.x,_.y=e.y,_.z=e.z,_.w=-a.Cartesian3.dot(e,d),a.Cartesian3.negate(e,m),_=s[5],r.defined(_)||(_=s[5]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,C),this._cullingVolume},b.prototype.computeCullingVolumeForTileset=function(t,e,n){const s=this._cullingVolumeForTileset.planes,o=this.top,f=this.bottom,u=this.right,l=this.left,c=this.near,h=this.farForTileset,p=a.Cartesian3.cross(e,n,V),d=z;a.Cartesian3.multiplyByScalar(e,c,d),a.Cartesian3.add(t,d,d);const C=T;a.Cartesian3.multiplyByScalar(e,h,C),a.Cartesian3.add(t,C,C);const m=E;a.Cartesian3.multiplyByScalar(p,l,m),a.Cartesian3.add(d,m,m),a.Cartesian3.subtract(m,t,m),a.Cartesian3.normalize(m,m),a.Cartesian3.cross(m,n,m),a.Cartesian3.normalize(m,m);let _=s[0];return r.defined(_)||(_=s[0]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,t),a.Cartesian3.multiplyByScalar(p,u,m),a.Cartesian3.add(d,m,m),a.Cartesian3.subtract(m,t,m),a.Cartesian3.cross(n,m,m),a.Cartesian3.normalize(m,m),_=s[1],r.defined(_)||(_=s[1]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,t),a.Cartesian3.multiplyByScalar(n,f,m),a.Cartesian3.add(d,m,m),a.Cartesian3.subtract(m,t,m),a.Cartesian3.cross(p,m,m),a.Cartesian3.normalize(m,m),_=s[2],r.defined(_)||(_=s[2]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,t),a.Cartesian3.multiplyByScalar(n,o,m),a.Cartesian3.add(d,m,m),a.Cartesian3.subtract(m,t,m),a.Cartesian3.cross(m,p,m),a.Cartesian3.normalize(m,m),_=s[3],r.defined(_)||(_=s[3]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,t),_=s[4],r.defined(_)||(_=s[4]=new i.Cartesian4),_.x=e.x,_.y=e.y,_.z=e.z,_.w=-a.Cartesian3.dot(e,d),a.Cartesian3.negate(e,m),_=s[5],r.defined(_)||(_=s[5]=new i.Cartesian4),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-a.Cartesian3.dot(m,C),this._cullingVolumeForTileset},b.prototype.getPixelDimensions=function(t,e,a,i,n){M(this);const r=1/this.near;let s=this.top*r;const o=2*i*a*s/e;s=this.right*r;const f=2*i*a*s/t;return n.x=f,n.y=o,n},b.prototype.clone=function(t){return r.defined(t)||(t=new b),t.right=this.right,t.left=this.left,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t._left=void 0,t._right=void 0,t._top=void 0,t._bottom=void 0,t._near=void 0,t._far=void 0,t},b.prototype.equals=function(t){return r.defined(t)&&t instanceof b&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},b.prototype.equalsEpsilon=function(t,e,a){return t===this||r.defined(t)&&t instanceof b&&f.CesiumMath.equalsEpsilon(this.right,t.right,e,a)&&f.CesiumMath.equalsEpsilon(this.left,t.left,e,a)&&f.CesiumMath.equalsEpsilon(this.top,t.top,e,a)&&f.CesiumMath.equalsEpsilon(this.bottom,t.bottom,e,a)&&f.CesiumMath.equalsEpsilon(this.near,t.near,e,a)&&f.CesiumMath.equalsEpsilon(this.far,t.far,e,a)},O.packedLength=6,O.pack=function(t,e,a){return a=r.defaultValue(a,0),e[a++]=t.fov,e[a++]=t.aspectRatio,e[a++]=t.near,e[a++]=t.far,e[a++]=t.xOffset,e[a]=t.yOffset,e},O.unpack=function(t,e,a){return e=r.defaultValue(e,0),r.defined(a)||(a=new O),a.fov=t[e++],a.aspectRatio=t[e++],a.near=t[e++],a.far=t[e++],a.xOffset=t[e++],a.yOffset=t[e],a},Object.defineProperties(O.prototype,{projectionMatrix:{get:function(){return S(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return S(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return S(this),this._fovy}},sseDenominator:{get:function(){return S(this),this._sseDenominator}}}),O.prototype.computeCullingVolume=function(t,e,a){return S(this),this._offCenterFrustum.computeCullingVolume(t,e,a)},O.prototype.computeCullingVolumeForTileset=function(t,e,a){return S(this),this._offCenterFrustum.computeCullingVolumeForTileset(t,e,a)},O.prototype.getPixelDimensions=function(t,e,a,i,n){return S(this),this._offCenterFrustum.getPixelDimensions(t,e,a,i,n)},O.prototype.clone=function(t){return r.defined(t)||(t=new O),t.aspectRatio=this.aspectRatio,t.fov=this.fov,t.near=this.near,t.far=this.far,t._aspectRatio=void 0,t._fov=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},O.prototype.equals=function(t){return!!(r.defined(t)&&t instanceof O)&&(S(this),S(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},O.prototype.equalsEpsilon=function(t,e,a){return!!(r.defined(t)&&t instanceof O)&&(S(this),S(t),f.CesiumMath.equalsEpsilon(this.fov,t.fov,e,a)&&f.CesiumMath.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,a)&&this._offCenterFrustum.equalsEpsilon(t._offCenterFrustum,e,a))};function P(t){const i=t.frustum,n=t.orientation,s=t.origin,o=r.defaultValue(t.vertexFormat,l.VertexFormat.DEFAULT),f=r.defaultValue(t._drawNearPlane,!0);let u,c;i instanceof O?(u=0,c=O.packedLength):i instanceof v&&(u=1,c=v.packedLength),this._frustumType=u,this._frustum=i.clone(),this._origin=a.Cartesian3.clone(s),this._orientation=e.Quaternion.clone(n),this._drawNearPlane=f,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+c+a.Cartesian3.packedLength+e.Quaternion.packedLength+l.VertexFormat.packedLength}P.pack=function(t,i,n){n=r.defaultValue(n,0);const s=t._frustumType,o=t._frustum;return i[n++]=s,0===s?(O.pack(o,i,n),n+=O.packedLength):(v.pack(o,i,n),n+=v.packedLength),a.Cartesian3.pack(t._origin,i,n),n+=a.Cartesian3.packedLength,e.Quaternion.pack(t._orientation,i,n),n+=e.Quaternion.packedLength,l.VertexFormat.pack(t._vertexFormat,i,n),i[n+=l.VertexFormat.packedLength]=t._drawNearPlane?1:0,i};const R=new O,k=new v,A=new e.Quaternion,D=new a.Cartesian3,I=new l.VertexFormat;function B(t,e,a,i,n,s,o,f){const u=t/3*2;for(let n=0;n<4;++n)r.defined(e)&&(e[t]=s.x,e[t+1]=s.y,e[t+2]=s.z),r.defined(a)&&(a[t]=o.x,a[t+1]=o.y,a[t+2]=o.z),r.defined(i)&&(i[t]=f.x,i[t+1]=f.y,i[t+2]=f.z),t+=3;n[u]=0,n[u+1]=0,n[u+2]=1,n[u+3]=0,n[u+4]=1,n[u+5]=1,n[u+6]=0,n[u+7]=1}P.unpack=function(t,i,n){i=r.defaultValue(i,0);const s=t[i++];let o;0===s?(o=O.unpack(t,i,R),i+=O.packedLength):(o=v.unpack(t,i,k),i+=v.packedLength);const f=a.Cartesian3.unpack(t,i,D);i+=a.Cartesian3.packedLength;const u=e.Quaternion.unpack(t,i,A);i+=e.Quaternion.packedLength;const c=l.VertexFormat.unpack(t,i,I),h=1===t[i+=l.VertexFormat.packedLength];if(!r.defined(n))return new P({frustum:o,origin:f,orientation:u,vertexFormat:c,_drawNearPlane:h});const p=s===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(p),n._frustumType=s,n._origin=a.Cartesian3.clone(f,n._origin),n._orientation=e.Quaternion.clone(u,n._orientation),n._vertexFormat=l.VertexFormat.clone(c,n._vertexFormat),n._drawNearPlane=h,n};const q=new a.Matrix3,L=new i.Matrix4,N=new i.Matrix4,G=new a.Cartesian3,j=new a.Cartesian3,U=new a.Cartesian3,Q=new a.Cartesian3,K=new a.Cartesian3,Y=new a.Cartesian3,J=new Array(3),W=new Array(4);W[0]=new i.Cartesian4(-1,-1,1,1),W[1]=new i.Cartesian4(1,-1,1,1),W[2]=new i.Cartesian4(1,1,1,1),W[3]=new i.Cartesian4(-1,1,1,1);const X=new Array(4);for(let t=0;t<4;++t)X[t]=new i.Cartesian4;P._computeNearFarPlanes=function(t,e,n,s,o,f,u,l){const c=a.Matrix3.fromQuaternion(e,q);let h=r.defaultValue(f,G),p=r.defaultValue(u,j),d=r.defaultValue(l,U);h=a.Matrix3.getColumn(c,0,h),p=a.Matrix3.getColumn(c,1,p),d=a.Matrix3.getColumn(c,2,d),a.Cartesian3.normalize(h,h),a.Cartesian3.normalize(p,p),a.Cartesian3.normalize(d,d),a.Cartesian3.negate(h,h);const C=i.Matrix4.computeView(t,d,p,h,L);let m,_;if(0===n){const t=s.projectionMatrix,e=i.Matrix4.multiply(t,C,N);_=i.Matrix4.inverse(e,N)}else m=i.Matrix4.inverseTransformation(C,N);r.defined(_)?(J[0]=s.near,J[1]=s.far):(J[0]=0,J[1]=s.near,J[2]=s.far);for(let e=0;e<2;++e)for(let n=0;n<4;++n){let f=i.Cartesian4.clone(W[n],X[n]);if(r.defined(_)){f=i.Matrix4.multiplyByVector(_,f,f);const n=1/f.w;a.Cartesian3.multiplyByScalar(f,n,f),a.Cartesian3.subtract(f,t,f),a.Cartesian3.normalize(f,f);const r=a.Cartesian3.dot(d,f);a.Cartesian3.multiplyByScalar(f,J[e]/r,f),a.Cartesian3.add(f,t,f)}else{r.defined(s._offCenterFrustum)&&(s=s._offCenterFrustum);const t=J[e],a=J[e+1];f.x=.5*(f.x*(s.right-s.left)+s.left+s.right),f.y=.5*(f.y*(s.top-s.bottom)+s.bottom+s.top),f.z=.5*(f.z*(t-a)-t-a),f.w=1,i.Matrix4.multiplyByVector(m,f,f)}o[12*e+3*n]=f.x,o[12*e+3*n+1]=f.y,o[12*e+3*n+2]=f.z}},P.createGeometry=function(t){const i=t._frustumType,f=t._frustum,u=t._origin,l=t._orientation,c=t._drawNearPlane,h=t._vertexFormat,p=c?6:5;let d=new Float64Array(72);P._computeNearFarPlanes(u,l,i,f,d);let C=24;d[C]=d[12],d[C+1]=d[13],d[C+2]=d[14],d[C+3]=d[0],d[C+4]=d[1],d[C+5]=d[2],d[C+6]=d[9],d[C+7]=d[10],d[C+8]=d[11],d[C+9]=d[21],d[C+10]=d[22],d[C+11]=d[23],C+=12,d[C]=d[15],d[C+1]=d[16],d[C+2]=d[17],d[C+3]=d[3],d[C+4]=d[4],d[C+5]=d[5],d[C+6]=d[0],d[C+7]=d[1],d[C+8]=d[2],d[C+9]=d[12],d[C+10]=d[13],d[C+11]=d[14],C+=12,d[C]=d[3],d[C+1]=d[4],d[C+2]=d[5],d[C+3]=d[15],d[C+4]=d[16],d[C+5]=d[17],d[C+6]=d[18],d[C+7]=d[19],d[C+8]=d[20],d[C+9]=d[6],d[C+10]=d[7],d[C+11]=d[8],C+=12,d[C]=d[6],d[C+1]=d[7],d[C+2]=d[8],d[C+3]=d[18],d[C+4]=d[19],d[C+5]=d[20],d[C+6]=d[21],d[C+7]=d[22],d[C+8]=d[23],d[C+9]=d[9],d[C+10]=d[10],d[C+11]=d[11],c||(d=d.subarray(12));const m=new o.GeometryAttributes({position:new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:d})});if(r.defined(h.normal)||r.defined(h.tangent)||r.defined(h.bitangent)||r.defined(h.st)){const t=r.defined(h.normal)?new Float32Array(12*p):void 0,e=r.defined(h.tangent)?new Float32Array(12*p):void 0,i=r.defined(h.bitangent)?new Float32Array(12*p):void 0,o=r.defined(h.st)?new Float32Array(8*p):void 0,f=G,u=j,l=U,d=a.Cartesian3.negate(f,Q),_=a.Cartesian3.negate(u,K),y=a.Cartesian3.negate(l,Y);C=0,c&&(B(C,t,e,i,o,y,f,u),C+=12),B(C,t,e,i,o,l,d,u),C+=12,B(C,t,e,i,o,d,y,u),C+=12,B(C,t,e,i,o,_,y,d),C+=12,B(C,t,e,i,o,f,l,u),C+=12,B(C,t,e,i,o,u,l,d),r.defined(t)&&(m.normal=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:t})),r.defined(e)&&(m.tangent=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e})),r.defined(i)&&(m.bitangent=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:i})),r.defined(o)&&(m.st=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:o}))}const _=new Uint16Array(6*p);for(let t=0;t<p;++t){const e=6*t,a=4*t;_[e]=a,_[e+1]=a+1,_[e+2]=a+2,_[e+3]=a,_[e+4]=a+2,_[e+5]=a+3}return new s.Geometry({attributes:m,indices:_,primitiveType:s.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(d)})},t.FrustumGeometry=P,t.OrthographicFrustum=v,t.PerspectiveFrustum=O}));