qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/FrustumGeometry-5b6f7f2c.js

2 lines
19 KiB
JavaScript

define(["exports","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./Matrix4-4c545f70","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./Math-e73894ab","./Plane-bc8b6777","./Transforms-5b829630","./VertexFormat-d50a69ba"],(function(t,e,a,i,n,r,o,s,f,u,l,h,c){"use strict";function p(t){this.planes=o.defaultValue(t,[])}const d=[new a.Cartesian3,new a.Cartesian3,new a.Cartesian3];a.Cartesian3.clone(a.Cartesian3.UNIT_X,d[0]),a.Cartesian3.clone(a.Cartesian3.UNIT_Y,d[1]),a.Cartesian3.clone(a.Cartesian3.UNIT_Z,d[2]);const m=new a.Cartesian3,C=new a.Cartesian3,_=new l.Plane(new a.Cartesian3(1,0,0),0);function y(t){t=o.defaultValue(t,o.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=o.defaultValue(t.near,1),this._near=this.near,this.far=o.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new p,this._orthographicMatrix=new i.Matrix4}function g(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))}p.fromBoundingSphere=function(t,e){o.defined(e)||(e=new p);const n=d.length,r=e.planes;r.length=2*n;const s=t.center,f=t.radius;let u=0;for(let t=0;t<n;++t){const e=d[t];let n=r[u],l=r[u+1];o.defined(n)||(n=r[u]=new i.Cartesian4),o.defined(l)||(l=r[u+1]=new i.Cartesian4),a.Cartesian3.multiplyByScalar(e,-f,m),a.Cartesian3.add(s,m,m),n.x=e.x,n.y=e.y,n.z=e.z,n.w=-a.Cartesian3.dot(e,m),a.Cartesian3.multiplyByScalar(e,f,m),a.Cartesian3.add(s,m,m),l.x=-e.x,l.y=-e.y,l.z=-e.z,l.w=-a.Cartesian3.dot(a.Cartesian3.negate(e,C),m),u+=2}return e},p.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(l.Plane.fromCartesian4(a[n],_));if(r===e.Intersect.OUTSIDE)return e.Intersect.OUTSIDE;r===e.Intersect.INTERSECTING&&(i=!0)}return i?e.Intersect.INTERSECTING:e.Intersect.INSIDE},p.prototype.computeVisibilityWithPlaneMask=function(t,a){if(a===p.MASK_OUTSIDE||a===p.MASK_INSIDE)return a;let i=p.MASK_INSIDE;const n=this.planes;for(let r=0,o=n.length;r<o;++r){const o=r<31?1<<r:0;if(r<31&&0==(a&o))continue;const s=t.intersectPlane(l.Plane.fromCartesian4(n[r],_));if(s===e.Intersect.OUTSIDE)return p.MASK_OUTSIDE;s===e.Intersect.INTERSECTING&&(i|=o)}return i},p.MASK_OUTSIDE=4294967295,p.MASK_INSIDE=0,p.MASK_INDETERMINATE=2147483647,Object.defineProperties(y.prototype,{projectionMatrix:{get:function(){return g(this),this._orthographicMatrix}}});var w=new a.Cartesian3,x=new a.Cartesian3,v=new a.Cartesian3,b=new a.Cartesian3;function M(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new y,this.width=t.width,this._width=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=o.defaultValue(t.near,1),this._near=this.near,this.far=o.defaultValue(t.far,5e8),this._far=this.far}function V(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 F(t){t=o.defaultValue(t,o.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=o.defaultValue(t.near,1),this._near=this.near,this.far=o.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new p,this._perspectiveMatrix=new i.Matrix4,this._infinitePerspective=new i.Matrix4}function E(t){const e=t.top,a=t.bottom,n=t.right,r=t.left,o=t.near,s=t.far;e===t._top&&a===t._bottom&&r===t._left&&n===t._right&&o===t._near&&s===t._far||(t._left=r,t._right=n,t._top=e,t._bottom=a,t._near=o,t._far=s,t._perspectiveMatrix=i.Matrix4.computePerspectiveOffCenter(r,n,a,e,o,s,t._perspectiveMatrix),t._infinitePerspective=i.Matrix4.computeInfinitePerspectiveOffCenter(r,n,a,e,o,t._infinitePerspective))}y.prototype.computeCullingVolume=function(t,e,n){var r=this._cullingVolume.planes,s=this.top,f=this.bottom,u=this.right,l=this.left,h=this.near,c=this.far,p=a.Cartesian3.cross(e,n,w);a.Cartesian3.normalize(p,p);var d=x;a.Cartesian3.multiplyByScalar(e,h,d),a.Cartesian3.add(t,d,d);var m=v;a.Cartesian3.multiplyByScalar(p,l,m),a.Cartesian3.add(d,m,m);var C=r[0];return o.defined(C)||(C=r[0]=new i.Cartesian4),C.x=p.x,C.y=p.y,C.z=p.z,C.w=-a.Cartesian3.dot(p,m),a.Cartesian3.multiplyByScalar(p,u,m),a.Cartesian3.add(d,m,m),C=r[1],o.defined(C)||(C=r[1]=new i.Cartesian4),C.x=-p.x,C.y=-p.y,C.z=-p.z,C.w=-a.Cartesian3.dot(a.Cartesian3.negate(p,b),m),a.Cartesian3.multiplyByScalar(n,f,m),a.Cartesian3.add(d,m,m),C=r[2],o.defined(C)||(C=r[2]=new i.Cartesian4),C.x=n.x,C.y=n.y,C.z=n.z,C.w=-a.Cartesian3.dot(n,m),a.Cartesian3.multiplyByScalar(n,s,m),a.Cartesian3.add(d,m,m),C=r[3],o.defined(C)||(C=r[3]=new i.Cartesian4),C.x=-n.x,C.y=-n.y,C.z=-n.z,C.w=-a.Cartesian3.dot(a.Cartesian3.negate(n,b),m),C=r[4],o.defined(C)||(C=r[4]=new i.Cartesian4),C.x=e.x,C.y=e.y,C.z=e.z,C.w=-a.Cartesian3.dot(e,d),a.Cartesian3.multiplyByScalar(e,c,m),a.Cartesian3.add(t,m,m),C=r[5],o.defined(C)||(C=r[5]=new i.Cartesian4),C.x=-e.x,C.y=-e.y,C.z=-e.z,C.w=-a.Cartesian3.dot(a.Cartesian3.negate(e,b),m),this._cullingVolume},y.prototype.getPixelDimensions=function(t,e,a,i,n){g(this);var r=i*(this.right-this.left)/t,o=i*(this.top-this.bottom)/e;return n.x=r,n.y=o,n},y.prototype.clone=function(t){return o.defined(t)||(t=new y),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},y.prototype.equals=function(t){return o.defined(t)&&t instanceof y&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},y.prototype.equalsEpsilon=function(t,e,a){return t===this||o.defined(t)&&t instanceof y&&u.CesiumMath.equalsEpsilon(this.right,t.right,e,a)&&u.CesiumMath.equalsEpsilon(this.left,t.left,e,a)&&u.CesiumMath.equalsEpsilon(this.top,t.top,e,a)&&u.CesiumMath.equalsEpsilon(this.bottom,t.bottom,e,a)&&u.CesiumMath.equalsEpsilon(this.near,t.near,e,a)&&u.CesiumMath.equalsEpsilon(this.far,t.far,e,a)},M.packedLength=4,M.pack=function(t,e,a){return a=o.defaultValue(a,0),e[a++]=t.width,e[a++]=t.aspectRatio,e[a++]=t.near,e[a]=t.far,e},M.unpack=function(t,e,a){return e=o.defaultValue(e,0),o.defined(a)||(a=new M),a.width=t[e++],a.aspectRatio=t[e++],a.near=t[e++],a.far=t[e],a},Object.defineProperties(M.prototype,{projectionMatrix:{get:function(){return V(this),this._offCenterFrustum.projectionMatrix}}}),M.prototype.computeCullingVolume=function(t,e,a){return V(this),this._offCenterFrustum.computeCullingVolume(t,e,a)},M.prototype.getPixelDimensions=function(t,e,a,i,n){return V(this),this._offCenterFrustum.getPixelDimensions(t,e,a,i,n)},M.prototype.clone=function(t){return o.defined(t)||(t=new M),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},M.prototype.equals=function(t){return!!(o.defined(t)&&t instanceof M)&&(V(this),V(t),this.width===t.width&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},M.prototype.equalsEpsilon=function(t,e,a){return!!(o.defined(t)&&t instanceof M)&&(V(this),V(t),u.CesiumMath.equalsEpsilon(this.width,t.width,e,a)&&u.CesiumMath.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,a)&&this._offCenterFrustum.equalsEpsilon(t._offCenterFrustum,e,a))},Object.defineProperties(F.prototype,{projectionMatrix:{get:function(){return E(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return E(this),this._infinitePerspective}}});const O=new a.Cartesian3,P=new a.Cartesian3,z=new a.Cartesian3,R=new a.Cartesian3;function S(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new F,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=o.defaultValue(t.near,1),this._near=this.near,this.far=o.defaultValue(t.far,5e8),this._far=this.far,this.xOffset=o.defaultValue(t.xOffset,0),this._xOffset=this.xOffset,this.yOffset=o.defaultValue(t.yOffset,0),this._yOffset=this.yOffset}function T(t){const e=t._offCenterFrustum;t.fov===t._fov&&t.aspectRatio===t._aspectRatio&&t.near===t._near&&t.far===t._far&&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._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.right+=t.xOffset,e.left+=t.xOffset,e.top+=t.yOffset,e.bottom+=t.yOffset)}F.prototype.computeCullingVolume=function(t,e,n){const r=this._cullingVolume.planes,s=this.top,f=this.bottom,u=this.right,l=this.left,h=this.near,c=this.far,p=a.Cartesian3.cross(e,n,O),d=P;a.Cartesian3.multiplyByScalar(e,h,d),a.Cartesian3.add(t,d,d);const m=z;a.Cartesian3.multiplyByScalar(e,c,m),a.Cartesian3.add(t,m,m);const C=R;a.Cartesian3.multiplyByScalar(p,l,C),a.Cartesian3.add(d,C,C),a.Cartesian3.subtract(C,t,C),a.Cartesian3.normalize(C,C),a.Cartesian3.cross(C,n,C),a.Cartesian3.normalize(C,C);let _=r[0];return o.defined(_)||(_=r[0]=new i.Cartesian4),_.x=C.x,_.y=C.y,_.z=C.z,_.w=-a.Cartesian3.dot(C,t),a.Cartesian3.multiplyByScalar(p,u,C),a.Cartesian3.add(d,C,C),a.Cartesian3.subtract(C,t,C),a.Cartesian3.cross(n,C,C),a.Cartesian3.normalize(C,C),_=r[1],o.defined(_)||(_=r[1]=new i.Cartesian4),_.x=C.x,_.y=C.y,_.z=C.z,_.w=-a.Cartesian3.dot(C,t),a.Cartesian3.multiplyByScalar(n,f,C),a.Cartesian3.add(d,C,C),a.Cartesian3.subtract(C,t,C),a.Cartesian3.cross(p,C,C),a.Cartesian3.normalize(C,C),_=r[2],o.defined(_)||(_=r[2]=new i.Cartesian4),_.x=C.x,_.y=C.y,_.z=C.z,_.w=-a.Cartesian3.dot(C,t),a.Cartesian3.multiplyByScalar(n,s,C),a.Cartesian3.add(d,C,C),a.Cartesian3.subtract(C,t,C),a.Cartesian3.cross(C,p,C),a.Cartesian3.normalize(C,C),_=r[3],o.defined(_)||(_=r[3]=new i.Cartesian4),_.x=C.x,_.y=C.y,_.z=C.z,_.w=-a.Cartesian3.dot(C,t),_=r[4],o.defined(_)||(_=r[4]=new i.Cartesian4),_.x=e.x,_.y=e.y,_.z=e.z,_.w=-a.Cartesian3.dot(e,d),a.Cartesian3.negate(e,C),_=r[5],o.defined(_)||(_=r[5]=new i.Cartesian4),_.x=C.x,_.y=C.y,_.z=C.z,_.w=-a.Cartesian3.dot(C,m),this._cullingVolume},F.prototype.getPixelDimensions=function(t,e,a,i,n){E(this);const r=1/this.near;let o=this.top*r;const s=2*i*a*o/e;o=this.right*r;const f=2*i*a*o/t;return n.x=f,n.y=s,n},F.prototype.clone=function(t){return o.defined(t)||(t=new F),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},F.prototype.equals=function(t){return o.defined(t)&&t instanceof F&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},F.prototype.equalsEpsilon=function(t,e,a){return t===this||o.defined(t)&&t instanceof F&&u.CesiumMath.equalsEpsilon(this.right,t.right,e,a)&&u.CesiumMath.equalsEpsilon(this.left,t.left,e,a)&&u.CesiumMath.equalsEpsilon(this.top,t.top,e,a)&&u.CesiumMath.equalsEpsilon(this.bottom,t.bottom,e,a)&&u.CesiumMath.equalsEpsilon(this.near,t.near,e,a)&&u.CesiumMath.equalsEpsilon(this.far,t.far,e,a)},S.packedLength=6,S.pack=function(t,e,a){return a=o.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},S.unpack=function(t,e,a){return e=o.defaultValue(e,0),o.defined(a)||(a=new S),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(S.prototype,{projectionMatrix:{get:function(){return T(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return T(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return T(this),this._fovy}},sseDenominator:{get:function(){return T(this),this._sseDenominator}}}),S.prototype.computeCullingVolume=function(t,e,a){return T(this),this._offCenterFrustum.computeCullingVolume(t,e,a)},S.prototype.getPixelDimensions=function(t,e,a,i,n){return T(this),this._offCenterFrustum.getPixelDimensions(t,e,a,i,n)},S.prototype.clone=function(t){return o.defined(t)||(t=new S),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},S.prototype.equals=function(t){return!!(o.defined(t)&&t instanceof S)&&(T(this),T(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},S.prototype.equalsEpsilon=function(t,e,a){return!!(o.defined(t)&&t instanceof S)&&(T(this),T(t),u.CesiumMath.equalsEpsilon(this.fov,t.fov,e,a)&&u.CesiumMath.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,a)&&this._offCenterFrustum.equalsEpsilon(t._offCenterFrustum,e,a))};function k(t){const e=t.frustum,i=t.orientation,n=t.origin,r=o.defaultValue(t.vertexFormat,c.VertexFormat.DEFAULT),s=o.defaultValue(t._drawNearPlane,!0);let f,u;e instanceof S?(f=0,u=S.packedLength):e instanceof M&&(f=1,u=M.packedLength),this._frustumType=f,this._frustum=e.clone(),this._origin=a.Cartesian3.clone(n),this._orientation=h.Quaternion.clone(i),this._drawNearPlane=s,this._vertexFormat=r,this._workerName="createFrustumGeometry",this.packedLength=2+u+a.Cartesian3.packedLength+h.Quaternion.packedLength+c.VertexFormat.packedLength}k.pack=function(t,e,i){i=o.defaultValue(i,0);const n=t._frustumType,r=t._frustum;return e[i++]=n,0===n?(S.pack(r,e,i),i+=S.packedLength):(M.pack(r,e,i),i+=M.packedLength),a.Cartesian3.pack(t._origin,e,i),i+=a.Cartesian3.packedLength,h.Quaternion.pack(t._orientation,e,i),i+=h.Quaternion.packedLength,c.VertexFormat.pack(t._vertexFormat,e,i),e[i+=c.VertexFormat.packedLength]=t._drawNearPlane?1:0,e};const A=new S,D=new M,I=new h.Quaternion,q=new a.Cartesian3,B=new c.VertexFormat;function L(t,e,a,i,n,r,s,f){const u=t/3*2;for(let n=0;n<4;++n)o.defined(e)&&(e[t]=r.x,e[t+1]=r.y,e[t+2]=r.z),o.defined(a)&&(a[t]=s.x,a[t+1]=s.y,a[t+2]=s.z),o.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}k.unpack=function(t,e,i){e=o.defaultValue(e,0);const n=t[e++];let r;0===n?(r=S.unpack(t,e,A),e+=S.packedLength):(r=M.unpack(t,e,D),e+=M.packedLength);const s=a.Cartesian3.unpack(t,e,q);e+=a.Cartesian3.packedLength;const f=h.Quaternion.unpack(t,e,I);e+=h.Quaternion.packedLength;const u=c.VertexFormat.unpack(t,e,B),l=1===t[e+=c.VertexFormat.packedLength];if(!o.defined(i))return new k({frustum:r,origin:s,orientation:f,vertexFormat:u,_drawNearPlane:l});const p=n===i._frustumType?i._frustum:void 0;return i._frustum=r.clone(p),i._frustumType=n,i._origin=a.Cartesian3.clone(s,i._origin),i._orientation=h.Quaternion.clone(f,i._orientation),i._vertexFormat=c.VertexFormat.clone(u,i._vertexFormat),i._drawNearPlane=l,i};const N=new i.Matrix3,G=new i.Matrix4,j=new i.Matrix4,U=new a.Cartesian3,Q=new a.Cartesian3,K=new a.Cartesian3,Y=new a.Cartesian3,J=new a.Cartesian3,W=new a.Cartesian3,X=new Array(3),Z=new Array(4);Z[0]=new i.Cartesian4(-1,-1,1,1),Z[1]=new i.Cartesian4(1,-1,1,1),Z[2]=new i.Cartesian4(1,1,1,1),Z[3]=new i.Cartesian4(-1,1,1,1);const H=new Array(4);for(let t=0;t<4;++t)H[t]=new i.Cartesian4;k._computeNearFarPlanes=function(t,e,n,r,s,f,u,l){const h=i.Matrix3.fromQuaternion(e,N);let c=o.defaultValue(f,U),p=o.defaultValue(u,Q),d=o.defaultValue(l,K);c=i.Matrix3.getColumn(h,0,c),p=i.Matrix3.getColumn(h,1,p),d=i.Matrix3.getColumn(h,2,d),a.Cartesian3.normalize(c,c),a.Cartesian3.normalize(p,p),a.Cartesian3.normalize(d,d),a.Cartesian3.negate(c,c);const m=i.Matrix4.computeView(t,d,p,c,G);let C,_;if(0===n){const t=r.projectionMatrix,e=i.Matrix4.multiply(t,m,j);_=i.Matrix4.inverse(e,j)}else C=i.Matrix4.inverseTransformation(m,j);o.defined(_)?(X[0]=r.near,X[1]=r.far):(X[0]=0,X[1]=r.near,X[2]=r.far);for(let e=0;e<2;++e)for(let n=0;n<4;++n){let f=i.Cartesian4.clone(Z[n],H[n]);if(o.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,X[e]/r,f),a.Cartesian3.add(f,t,f)}else{o.defined(r._offCenterFrustum)&&(r=r._offCenterFrustum);const t=X[e],a=X[e+1];f.x=.5*(f.x*(r.right-r.left)+r.left+r.right),f.y=.5*(f.y*(r.top-r.bottom)+r.bottom+r.top),f.z=.5*(f.z*(t-a)-t-a),f.w=1,i.Matrix4.multiplyByVector(C,f,f)}s[12*e+3*n]=f.x,s[12*e+3*n+1]=f.y,s[12*e+3*n+2]=f.z}},k.createGeometry=function(t){const i=t._frustumType,n=t._frustum,u=t._origin,l=t._orientation,h=t._drawNearPlane,c=t._vertexFormat,p=h?6:5;let d=new Float64Array(72);k._computeNearFarPlanes(u,l,i,n,d);let m=24;d[m]=d[12],d[m+1]=d[13],d[m+2]=d[14],d[m+3]=d[0],d[m+4]=d[1],d[m+5]=d[2],d[m+6]=d[9],d[m+7]=d[10],d[m+8]=d[11],d[m+9]=d[21],d[m+10]=d[22],d[m+11]=d[23],m+=12,d[m]=d[15],d[m+1]=d[16],d[m+2]=d[17],d[m+3]=d[3],d[m+4]=d[4],d[m+5]=d[5],d[m+6]=d[0],d[m+7]=d[1],d[m+8]=d[2],d[m+9]=d[12],d[m+10]=d[13],d[m+11]=d[14],m+=12,d[m]=d[3],d[m+1]=d[4],d[m+2]=d[5],d[m+3]=d[15],d[m+4]=d[16],d[m+5]=d[17],d[m+6]=d[18],d[m+7]=d[19],d[m+8]=d[20],d[m+9]=d[6],d[m+10]=d[7],d[m+11]=d[8],m+=12,d[m]=d[6],d[m+1]=d[7],d[m+2]=d[8],d[m+3]=d[18],d[m+4]=d[19],d[m+5]=d[20],d[m+6]=d[21],d[m+7]=d[22],d[m+8]=d[23],d[m+9]=d[9],d[m+10]=d[10],d[m+11]=d[11],h||(d=d.subarray(12));const C=new f.GeometryAttributes({position:new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:d})});if(o.defined(c.normal)||o.defined(c.tangent)||o.defined(c.bitangent)||o.defined(c.st)){const t=o.defined(c.normal)?new Float32Array(12*p):void 0,e=o.defined(c.tangent)?new Float32Array(12*p):void 0,i=o.defined(c.bitangent)?new Float32Array(12*p):void 0,n=o.defined(c.st)?new Float32Array(8*p):void 0,f=U,u=Q,l=K,d=a.Cartesian3.negate(f,Y),_=a.Cartesian3.negate(u,J),y=a.Cartesian3.negate(l,W);m=0,h&&(L(m,t,e,i,n,y,f,u),m+=12),L(m,t,e,i,n,l,d,u),m+=12,L(m,t,e,i,n,d,y,u),m+=12,L(m,t,e,i,n,_,y,d),m+=12,L(m,t,e,i,n,f,l,u),m+=12,L(m,t,e,i,n,u,l,d),o.defined(t)&&(C.normal=new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:t})),o.defined(e)&&(C.tangent=new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e})),o.defined(i)&&(C.bitangent=new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:i})),o.defined(n)&&(C.st=new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:n}))}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:C,indices:_,primitiveType:s.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(d)})},t.FrustumGeometry=k,t.OrthographicFrustum=M,t.PerspectiveFrustum=S}));