define(["exports","./Transforms-20461479","./Matrix3-81054f0f","./defaultValue-f6d5e6da","./Matrix2-413c4048","./AttributeCompression-48e336db","./ComponentDatatype-ab629b88","./Math-2ce22ee9"],(function(t,e,i,o,a,r,n,s){"use strict";function c(t,e){this._ellipsoid=t,this._cameraPosition=new i.Cartesian3,this._cameraPositionInScaledSpace=new i.Cartesian3,this._distanceToLimbInScaledSpaceSquared=0,o.defined(e)&&(this.cameraPosition=e)}Object.defineProperties(c.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(t){const e=this._ellipsoid.transformPositionToScaledSpace(t,this._cameraPositionInScaledSpace),o=i.Cartesian3.magnitudeSquared(e)-1;i.Cartesian3.clone(t,this._cameraPosition),this._cameraPositionInScaledSpace=e,this._distanceToLimbInScaledSpaceSquared=o}}});const u=new i.Cartesian3;c.prototype.isPointVisible=function(t){return C(this._ellipsoid.transformPositionToScaledSpace(t,u),this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)},c.prototype.isScaledSpacePointVisible=function(t){return C(t,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const d=new i.Cartesian3;c.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(t,e){const i=this._ellipsoid;let a,r;return o.defined(e)&&e<0&&i.minimumRadius>-e?(r=d,r.x=this._cameraPosition.x/(i.radii.x+e),r.y=this._cameraPosition.y/(i.radii.y+e),r.z=this._cameraPosition.z/(i.radii.z+e),a=r.x*r.x+r.y*r.y+r.z*r.z-1):(r=this._cameraPositionInScaledSpace,a=this._distanceToLimbInScaledSpaceSquared),C(t,r,a)},c.prototype.computeHorizonCullingPoint=function(t,e,i){return p(this._ellipsoid,t,e,i)};const l=i.Ellipsoid.clone(i.Ellipsoid.UNIT_SPHERE);c.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(t,e,i,o){return p(f(this._ellipsoid,i,l),t,e,o)},c.prototype.computeHorizonCullingPointFromVertices=function(t,e,i,o,a){return S(this._ellipsoid,t,e,i,o,a)},c.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(t,e,i,o,a,r){return S(f(this._ellipsoid,a,l),t,e,i,o,r)};const m=[];c.prototype.computeHorizonCullingPointFromRectangle=function(t,o,r){const n=a.Rectangle.subsample(t,o,0,m),s=e.BoundingSphere.fromPoints(n);if(!(i.Cartesian3.magnitude(s.center)<.1*o.minimumRadius))return this.computeHorizonCullingPoint(s.center,n,r)};const h=new i.Cartesian3;function f(t,e,a){if(o.defined(e)&&e<0&&t.minimumRadius>-e){const o=i.Cartesian3.fromElements(t.radii.x+e,t.radii.y+e,t.radii.z+e,h);t=i.Ellipsoid.fromCartesian3(o,a)}return t}function p(t,e,a,r){o.defined(r)||(r=new i.Cartesian3);const n=P(t,e);let s=0;for(let e=0,i=a.length;e0:s>r&&s*s/i.Cartesian3.magnitudeSquared(n)>r)}const g=new i.Cartesian3,y=new i.Cartesian3;function N(t,e,o){const a=t.transformPositionToScaledSpace(e,g);let r=i.Cartesian3.magnitudeSquared(a),n=Math.sqrt(r);const s=i.Cartesian3.divideByScalar(a,n,y);r=Math.max(1,r),n=Math.max(1,n);const c=1/n;return 1/(i.Cartesian3.dot(s,o)*c-i.Cartesian3.magnitude(i.Cartesian3.cross(s,o,s))*(Math.sqrt(r-1)*c))}function M(t,e,o){if(!(e<=0||e===1/0||e!=e))return i.Cartesian3.multiplyByScalar(t,e,o)}const T=new i.Cartesian3;function P(t,e){return i.Cartesian3.equals(e,i.Cartesian3.ZERO)?e:(t.transformPositionToScaledSpace(e,T),i.Cartesian3.normalize(T,T))}const b={getHeight:function(t,e,i){return(t-i)*e+i}},z=new i.Cartesian3;b.getPosition=function(t,e,o,a,r){const n=e.cartesianToCartographic(t,z),s=b.getHeight(n.height,o,a);return i.Cartesian3.fromRadians(n.longitude,n.latitude,s,e,r)};var _=b;var E=Object.freeze({NONE:0,BITS12:1});const H=new i.Cartesian3,w=new i.Cartesian3,A=new a.Cartesian2,I=new a.Matrix4,V=new a.Matrix4,q=Math.pow(2,12);function G(t,e,r,n,s,c,u,d,l,m){let h,f,p=E.NONE;if(o.defined(e)&&o.defined(r)&&o.defined(n)&&o.defined(s)){const t=e.minimum,o=e.maximum,c=i.Cartesian3.subtract(o,t,w),u=n-r;p=Math.max(i.Cartesian3.maximumComponent(c),u)