Agriculture-front-end/dist/Cesium/Workers/FrustumGeometry-96291783.js
2023-09-11 21:56:39 +08:00

2 lines
20 KiB
JavaScript

define(["exports","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./Cartesian4-3ca25aab","./Check-7b2a090c","./ComponentDatatype-c140a87d","./when-b60132fc","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./Math-119be1a3","./Plane-097b3a8f","./PrimitiveType-39acab88","./Transforms-cb0006b0","./VertexFormat-6446fca0"],(function(t,e,a,i,r,n,o,s,f,u,h,l,p,c){"use strict";function d(t){this.planes=o.defaultValue(t,[]),this.enableFusion=!1}var m=[new a.Cartesian3,new a.Cartesian3,new a.Cartesian3];a.Cartesian3.clone(a.Cartesian3.UNIT_X,m[0]),a.Cartesian3.clone(a.Cartesian3.UNIT_Y,m[1]),a.Cartesian3.clone(a.Cartesian3.UNIT_Z,m[2]);var C=new a.Cartesian3,_=new a.Cartesian3,y=new h.Plane(new a.Cartesian3(1,0,0),0);function v(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 d,this._orthographicMatrix=new e.Matrix4}function w(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=e.Matrix4.computeOrthographicOffCenter(t.left,t.right,t.bottom,t.top,t.near,t.far,t._orthographicMatrix))}d.fromBoundingSphere=function(t,e){o.defined(e)||(e=new d);var r=m.length,n=e.planes;n.length=2*r;for(var s=t.center,f=t.radius,u=0,h=0;h<r;++h){var l=m[h],p=n[u],c=n[u+1];o.defined(p)||(p=n[u]=new i.Cartesian4),o.defined(c)||(c=n[u+1]=new i.Cartesian4),a.Cartesian3.multiplyByScalar(l,-f,C),a.Cartesian3.add(s,C,C),p.x=l.x,p.y=l.y,p.z=l.z,p.w=-a.Cartesian3.dot(l,C),a.Cartesian3.multiplyByScalar(l,f,C),a.Cartesian3.add(s,C,C),c.x=-l.x,c.y=-l.y,c.z=-l.z,c.w=-a.Cartesian3.dot(a.Cartesian3.negate(l,_),C),u+=2}return e},d.prototype.computeVisibility=function(t){if(this.enableFusion)return e.Intersect.INSIDE;for(var a=this.planes,i=!1,r=0,n=a.length;r<n;++r){var o=t.intersectPlane(h.Plane.fromCartesian4(a[r],y));if(o===e.Intersect.OUTSIDE)return e.Intersect.OUTSIDE;o===e.Intersect.INTERSECTING&&(i=!0)}return i?e.Intersect.INTERSECTING:e.Intersect.INSIDE},d.prototype.computeVisibilityWithPlaneMask=function(t,a){if(a===d.MASK_OUTSIDE||a===d.MASK_INSIDE)return a;for(var i=d.MASK_INSIDE,r=this.planes,n=0,o=r.length;n<o;++n){var s=n<31?1<<n:0;if(!(n<31&&0==(a&s))){var f=t.intersectPlane(h.Plane.fromCartesian4(r[n],y));if(f===e.Intersect.OUTSIDE)return d.MASK_OUTSIDE;f===e.Intersect.INTERSECTING&&(i|=s)}}return i},d.MASK_OUTSIDE=4294967295,d.MASK_INSIDE=0,d.MASK_INDETERMINATE=2147483647,Object.defineProperties(v.prototype,{projectionMatrix:{get:function(){return w(this),this._orthographicMatrix}}});var g=new a.Cartesian3,x=new a.Cartesian3,M=new a.Cartesian3,b=new a.Cartesian3;function V(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new v,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 F(t){var 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;var 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 P(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 d,this._perspectiveMatrix=new e.Matrix4,this._infinitePerspective=new e.Matrix4}function E(t){var a=t.top,i=t.bottom,r=t.right,n=t.left,o=t.near,s=t.far;a===t._top&&i===t._bottom&&n===t._left&&r===t._right&&o===t._near&&s===t._far||(t._left=n,t._right=r,t._top=a,t._bottom=i,t._near=o,t._far=s,t._perspectiveMatrix=e.Matrix4.computePerspectiveOffCenter(n,r,i,a,o,s,t._perspectiveMatrix),t._infinitePerspective=e.Matrix4.computeInfinitePerspectiveOffCenter(n,r,i,a,o,t._infinitePerspective))}v.prototype.computeCullingVolume=function(t,e,r){var n=this._cullingVolume.planes,s=this.top,f=this.bottom,u=this.right,h=this.left,l=this.near,p=this.far,c=a.Cartesian3.cross(e,r,g);a.Cartesian3.normalize(c,c);var d=x;a.Cartesian3.multiplyByScalar(e,l,d),a.Cartesian3.add(t,d,d);var m=M;a.Cartesian3.multiplyByScalar(c,h,m),a.Cartesian3.add(d,m,m);var C=n[0];return o.defined(C)||(C=n[0]=new i.Cartesian4),C.x=c.x,C.y=c.y,C.z=c.z,C.w=-a.Cartesian3.dot(c,m),a.Cartesian3.multiplyByScalar(c,u,m),a.Cartesian3.add(d,m,m),C=n[1],o.defined(C)||(C=n[1]=new i.Cartesian4),C.x=-c.x,C.y=-c.y,C.z=-c.z,C.w=-a.Cartesian3.dot(a.Cartesian3.negate(c,b),m),a.Cartesian3.multiplyByScalar(r,f,m),a.Cartesian3.add(d,m,m),C=n[2],o.defined(C)||(C=n[2]=new i.Cartesian4),C.x=r.x,C.y=r.y,C.z=r.z,C.w=-a.Cartesian3.dot(r,m),a.Cartesian3.multiplyByScalar(r,s,m),a.Cartesian3.add(d,m,m),C=n[3],o.defined(C)||(C=n[3]=new i.Cartesian4),C.x=-r.x,C.y=-r.y,C.z=-r.z,C.w=-a.Cartesian3.dot(a.Cartesian3.negate(r,b),m),C=n[4],o.defined(C)||(C=n[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,p,m),a.Cartesian3.add(t,m,m),C=n[5],o.defined(C)||(C=n[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},v.prototype.getPixelDimensions=function(t,e,a,i,r){w(this);var n=i*(this.right-this.left)/t,o=i*(this.top-this.bottom)/e;return r.x=n,r.y=o,r},v.prototype.clone=function(t){return o.defined(t)||(t=new v),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},v.prototype.equals=function(t){return o.defined(t)&&t instanceof v&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},v.prototype.equalsEpsilon=function(t,e,a){return t===this||o.defined(t)&&t instanceof v&&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)},V.packedLength=4,V.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},V.unpack=function(t,e,a){return e=o.defaultValue(e,0),o.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,r){return F(this),this._offCenterFrustum.getPixelDimensions(t,e,a,i,r)},V.prototype.clone=function(t){return o.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!!(o.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!!(o.defined(t)&&t instanceof V)&&(F(this),F(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(P.prototype,{projectionMatrix:{get:function(){return E(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return E(this),this._infinitePerspective}}});var O=new a.Cartesian3,z=new a.Cartesian3,S=new a.Cartesian3,T=new a.Cartesian3;function R(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new P,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,this.reflect=!1}function I(t){var 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)}P.prototype.resetProjectionMatrix=function(){var t=this.top,a=this.bottom,i=this.right,r=this.left,n=this.near,o=this.far;this._left=r,this._right=i,this._top=t,this._bottom=a,this._near=n,this._far=o,this._perspectiveMatrix=e.Matrix4.computePerspectiveOffCenter(r,i,a,t,n,o,this._perspectiveMatrix),this._infinitePerspective=e.Matrix4.computeInfinitePerspectiveOffCenter(r,i,a,t,n,this._infinitePerspective)},P.prototype.computeCullingVolume=function(t,e,r,n){var s=this._cullingVolume.planes,f=o.defaultValue(n,0);f=Math.min(f,.5),f=Math.max(f,0);var u=this.top+this.top*f,h=this.bottom-this.top*f,l=this.right+this.right*f,p=this.left-this.right*f,c=this.near,d=this.far,m=a.Cartesian3.cross(e,r,O),C=z;a.Cartesian3.multiplyByScalar(e,c,C),a.Cartesian3.add(t,C,C);var _=S;a.Cartesian3.multiplyByScalar(e,d,_),a.Cartesian3.add(t,_,_);var y=T;a.Cartesian3.multiplyByScalar(m,p,y),a.Cartesian3.add(C,y,y),a.Cartesian3.subtract(y,t,y),a.Cartesian3.normalize(y,y),a.Cartesian3.cross(y,r,y),a.Cartesian3.normalize(y,y);var v=s[0];return o.defined(v)||(v=s[0]=new i.Cartesian4),v.x=y.x,v.y=y.y,v.z=y.z,v.w=-a.Cartesian3.dot(y,t),a.Cartesian3.multiplyByScalar(m,l,y),a.Cartesian3.add(C,y,y),a.Cartesian3.subtract(y,t,y),a.Cartesian3.cross(r,y,y),a.Cartesian3.normalize(y,y),v=s[1],o.defined(v)||(v=s[1]=new i.Cartesian4),v.x=y.x,v.y=y.y,v.z=y.z,v.w=-a.Cartesian3.dot(y,t),a.Cartesian3.multiplyByScalar(r,h,y),a.Cartesian3.add(C,y,y),a.Cartesian3.subtract(y,t,y),a.Cartesian3.cross(m,y,y),a.Cartesian3.normalize(y,y),v=s[2],o.defined(v)||(v=s[2]=new i.Cartesian4),v.x=y.x,v.y=y.y,v.z=y.z,v.w=-a.Cartesian3.dot(y,t),a.Cartesian3.multiplyByScalar(r,u,y),a.Cartesian3.add(C,y,y),a.Cartesian3.subtract(y,t,y),a.Cartesian3.cross(y,m,y),a.Cartesian3.normalize(y,y),v=s[3],o.defined(v)||(v=s[3]=new i.Cartesian4),v.x=y.x,v.y=y.y,v.z=y.z,v.w=-a.Cartesian3.dot(y,t),v=s[4],o.defined(v)||(v=s[4]=new i.Cartesian4),v.x=e.x,v.y=e.y,v.z=e.z,v.w=-a.Cartesian3.dot(e,C),a.Cartesian3.negate(e,y),v=s[5],o.defined(v)||(v=s[5]=new i.Cartesian4),v.x=y.x,v.y=y.y,v.z=y.z,v.w=-a.Cartesian3.dot(y,_),this._cullingVolume},P.prototype.getPixelDimensions=function(t,e,a,i,r){E(this);var n=1/this.near,o=this.top*n,s=2*i*a*o/e,f=2*i*a*(o=this.right*n)/t;return r.x=f,r.y=s,r},P.prototype.clone=function(t){return o.defined(t)||(t=new P),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},P.prototype.equals=function(t){return o.defined(t)&&t instanceof P&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},P.prototype.equalsEpsilon=function(t,e,a){return t===this||o.defined(t)&&t instanceof P&&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)},R.packedLength=6,R.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},R.unpack=function(t,e,a){return e=o.defaultValue(e,0),o.defined(a)||(a=new R),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(R.prototype,{projectionMatrix:{get:function(){return I(this),this.reflect&&function(t){if(!o.defined(t.clipPlane)||!o.defined(t.currentViewMatrix))return;var a=t.currentViewMatrix,r=t._offCenterFrustum.projectionMatrix;e.Matrix4.multiplyByPlane(a,t.clipPlane,k),A.x=(u.CesiumMath.sign(k.normal.x)+r[8])/r[0],A.y=(u.CesiumMath.sign(k.normal.y)+r[9])/r[5],A.z=-1,A.w=(1+r[10])/r[14],D.x=k.normal.x,D.y=k.normal.y,D.z=k.normal.z,D.w=k.distance,i.Cartesian4.multiplyByScalar(D,2/i.Cartesian4.dot(D,A),q),r[2]=q.x,r[6]=q.y,r[10]=q.z+1,r[14]=q.w}(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return I(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return I(this),this._fovy}},sseDenominator:{get:function(){return I(this),this._sseDenominator}}}),R.prototype.resetProjectionMatrix=function(){return this._offCenterFrustum.resetProjectionMatrix()},R.prototype.computeCullingVolume=function(t,e,a,i){return I(this),this._offCenterFrustum.computeCullingVolume(t,e,a,i)},R.prototype.getPixelDimensions=function(t,e,a,i,r){return I(this),this._offCenterFrustum.getPixelDimensions(t,e,a,i,r)},R.prototype.clone=function(t){return o.defined(t)||(t=new R),t.aspectRatio=this.aspectRatio,t.fov=this.fov,t.near=this.near,t.far=this.far,t.reflect=this.reflect,t.clipPlane=this.clipPlane,t.currentViewMatrix=this.currentViewMatrix,t._aspectRatio=void 0,t._fov=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},R.prototype.equals=function(t){return!!(o.defined(t)&&t instanceof R)&&(I(this),I(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},R.prototype.equalsEpsilon=function(t,e,a){return!!(o.defined(t)&&t instanceof R)&&(I(this),I(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))};var k=new h.Plane(a.Cartesian3.UNIT_Z,1),A=new i.Cartesian4,D=new i.Cartesian4,q=new i.Cartesian4;function B(t){var e,i,r=t.frustum,n=t.orientation,s=t.origin,f=o.defaultValue(t.vertexFormat,c.VertexFormat.DEFAULT),u=o.defaultValue(t._drawNearPlane,!0);r instanceof R?(e=0,i=R.packedLength):r instanceof V&&(e=1,i=V.packedLength),this._frustumType=e,this._frustum=r.clone(),this._origin=a.Cartesian3.clone(s),this._orientation=p.Quaternion.clone(n),this._drawNearPlane=u,this._vertexFormat=f,this._workerName="createFrustumGeometry",this.packedLength=2+i+a.Cartesian3.packedLength+p.Quaternion.packedLength+c.VertexFormat.packedLength}B.pack=function(t,e,i){i=o.defaultValue(i,0);var r=t._frustumType,n=t._frustum;return e[i++]=r,0===r?(R.pack(n,e,i),i+=R.packedLength):(V.pack(n,e,i),i+=V.packedLength),a.Cartesian3.pack(t._origin,e,i),i+=a.Cartesian3.packedLength,p.Quaternion.pack(t._orientation,e,i),i+=p.Quaternion.packedLength,c.VertexFormat.pack(t._vertexFormat,e,i),e[i+=c.VertexFormat.packedLength]=t._drawNearPlane?1:0,e};var N=new R,L=new V,j=new p.Quaternion,G=new a.Cartesian3,U=new c.VertexFormat;function Q(t,e,a,i,r,n,s,f){for(var u=t/3*2,h=0;h<4;++h)o.defined(e)&&(e[t]=n.x,e[t+1]=n.y,e[t+2]=n.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;r[u]=0,r[u+1]=0,r[u+2]=1,r[u+3]=0,r[u+4]=1,r[u+5]=1,r[u+6]=0,r[u+7]=1}B.unpack=function(t,e,i){e=o.defaultValue(e,0);var r,n=t[e++];0===n?(r=R.unpack(t,e,N),e+=R.packedLength):(r=V.unpack(t,e,L),e+=V.packedLength);var s=a.Cartesian3.unpack(t,e,G);e+=a.Cartesian3.packedLength;var f=p.Quaternion.unpack(t,e,j);e+=p.Quaternion.packedLength;var u=c.VertexFormat.unpack(t,e,U),h=1===t[e+=c.VertexFormat.packedLength];if(!o.defined(i))return new B({frustum:r,origin:s,orientation:f,vertexFormat:u,_drawNearPlane:h});var l=n===i._frustumType?i._frustum:void 0;return i._frustum=r.clone(l),i._frustumType=n,i._origin=a.Cartesian3.clone(s,i._origin),i._orientation=p.Quaternion.clone(f,i._orientation),i._vertexFormat=c.VertexFormat.clone(u,i._vertexFormat),i._drawNearPlane=h,i};var K=new e.Matrix3,Y=new e.Matrix4,J=new e.Matrix4,Z=new a.Cartesian3,W=new a.Cartesian3,X=new a.Cartesian3,H=new a.Cartesian3,$=new a.Cartesian3,tt=new a.Cartesian3,et=new Array(3),at=new Array(4);at[0]=new i.Cartesian4(-1,-1,1,1),at[1]=new i.Cartesian4(1,-1,1,1),at[2]=new i.Cartesian4(1,1,1,1),at[3]=new i.Cartesian4(-1,1,1,1);for(var it=new Array(4),rt=0;rt<4;++rt)it[rt]=new i.Cartesian4;B._computeNearFarPlanes=function(t,r,n,s,f,u,h,l){var p=e.Matrix3.fromQuaternion(r,K),c=o.defaultValue(u,Z),d=o.defaultValue(h,W),m=o.defaultValue(l,X);c=e.Matrix3.getColumn(p,0,c),d=e.Matrix3.getColumn(p,1,d),m=e.Matrix3.getColumn(p,2,m),a.Cartesian3.normalize(c,c),a.Cartesian3.normalize(d,d),a.Cartesian3.normalize(m,m),a.Cartesian3.negate(c,c);var C,_,y=e.Matrix4.computeView(t,m,d,c,Y);if(0===n){var v=s.projectionMatrix,w=e.Matrix4.multiply(v,y,J);_=e.Matrix4.inverse(w,J)}else C=e.Matrix4.inverseTransformation(y,J);o.defined(_)?(et[0]=s.near,et[1]=s.far):(et[0]=0,et[1]=s.near,et[2]=s.far);for(var g=0;g<2;++g)for(var x=0;x<4;++x){var M=i.Cartesian4.clone(at[x],it[x]);if(o.defined(_)){var b=1/(M=e.Matrix4.multiplyByVector(_,M,M)).w;a.Cartesian3.multiplyByScalar(M,b,M),a.Cartesian3.subtract(M,t,M),a.Cartesian3.normalize(M,M);var V=a.Cartesian3.dot(m,M);a.Cartesian3.multiplyByScalar(M,et[g]/V,M),a.Cartesian3.add(M,t,M)}else{o.defined(s._offCenterFrustum)&&(s=s._offCenterFrustum);var F=et[g],P=et[g+1];M.x=.5*(M.x*(s.right-s.left)+s.left+s.right),M.y=.5*(M.y*(s.top-s.bottom)+s.bottom+s.top),M.z=.5*(M.z*(F-P)-F-P),M.w=1,e.Matrix4.multiplyByVector(C,M,M)}f[12*g+3*x]=M.x,f[12*g+3*x+1]=M.y,f[12*g+3*x+2]=M.z}},B.createGeometry=function(t){var i=t._frustumType,r=t._frustum,u=t._origin,h=t._orientation,p=t._drawNearPlane,c=t._vertexFormat,d=p?6:5,m=new Float64Array(72);B._computeNearFarPlanes(u,h,i,r,m);var C=24;m[C]=m[12],m[C+1]=m[13],m[C+2]=m[14],m[C+3]=m[0],m[C+4]=m[1],m[C+5]=m[2],m[C+6]=m[9],m[C+7]=m[10],m[C+8]=m[11],m[C+9]=m[21],m[C+10]=m[22],m[C+11]=m[23],m[C+=12]=m[15],m[C+1]=m[16],m[C+2]=m[17],m[C+3]=m[3],m[C+4]=m[4],m[C+5]=m[5],m[C+6]=m[0],m[C+7]=m[1],m[C+8]=m[2],m[C+9]=m[12],m[C+10]=m[13],m[C+11]=m[14],m[C+=12]=m[3],m[C+1]=m[4],m[C+2]=m[5],m[C+3]=m[15],m[C+4]=m[16],m[C+5]=m[17],m[C+6]=m[18],m[C+7]=m[19],m[C+8]=m[20],m[C+9]=m[6],m[C+10]=m[7],m[C+11]=m[8],m[C+=12]=m[6],m[C+1]=m[7],m[C+2]=m[8],m[C+3]=m[18],m[C+4]=m[19],m[C+5]=m[20],m[C+6]=m[21],m[C+7]=m[22],m[C+8]=m[23],m[C+9]=m[9],m[C+10]=m[10],m[C+11]=m[11],p||(m=m.subarray(12));var _=new f.GeometryAttributes({position:new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:m})});if(o.defined(c.normal)||o.defined(c.tangent)||o.defined(c.bitangent)||o.defined(c.st)){var y=o.defined(c.normal)?new Float32Array(12*d):void 0,v=o.defined(c.tangent)?new Float32Array(12*d):void 0,w=o.defined(c.bitangent)?new Float32Array(12*d):void 0,g=o.defined(c.st)?new Float32Array(8*d):void 0,x=Z,M=W,b=X,V=a.Cartesian3.negate(x,H),F=a.Cartesian3.negate(M,$),P=a.Cartesian3.negate(b,tt);C=0,p&&(Q(C,y,v,w,g,P,x,M),C+=12),Q(C,y,v,w,g,b,V,M),Q(C+=12,y,v,w,g,V,P,M),Q(C+=12,y,v,w,g,F,P,V),Q(C+=12,y,v,w,g,x,b,M),Q(C+=12,y,v,w,g,M,b,V),o.defined(y)&&(_.normal=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:y})),o.defined(v)&&(_.tangent=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:v})),o.defined(w)&&(_.bitangent=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:w})),o.defined(g)&&(_.st=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:g}))}for(var E=new Uint16Array(6*d),O=0;O<d;++O){var z=6*O,S=4*O;E[z]=S,E[z+1]=S+1,E[z+2]=S+2,E[z+3]=S,E[z+4]=S+2,E[z+5]=S+3}return new s.Geometry({attributes:_,indices:E,primitiveType:l.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(m)})},t.FrustumGeometry=B,t.OrthographicFrustum=V,t.PerspectiveFrustum=R}));