define(["exports","./Transforms-713aa3a8","./Matrix3-b6f074fa","./defaultValue-0a909f67","./Matrix2-163b5a1d","./AttributeCompression-e18a879a","./ComponentDatatype-77274976","./Math-e97915da"],(function(t,e,i,a,o,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,a.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),a=i.Cartesian3.magnitudeSquared(e)-1;i.Cartesian3.clone(t,this._cameraPosition),this._cameraPositionInScaledSpace=e,this._distanceToLimbInScaledSpaceSquared=a}}});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 o,r;return a.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),o=r.x*r.x+r.y*r.y+r.z*r.z-1):(r=this._cameraPositionInScaledSpace,o=this._distanceToLimbInScaledSpaceSquared),C(t,r,o)},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,a){return p(f(this._ellipsoid,i,l),t,e,a)},c.prototype.computeHorizonCullingPointFromVertices=function(t,e,i,a,o){return S(this._ellipsoid,t,e,i,a,o)},c.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(t,e,i,a,o,r){return S(f(this._ellipsoid,o,l),t,e,i,a,r)};const m=[];c.prototype.computeHorizonCullingPointFromRectangle=function(t,a,r){const n=o.Rectangle.subsample(t,a,0,m),s=e.BoundingSphere.fromPoints(n);if(!(i.Cartesian3.magnitude(s.center)<.1*a.minimumRadius))return this.computeHorizonCullingPoint(s.center,n,r)};const h=new i.Cartesian3;function f(t,e,o){if(a.defined(e)&&e<0&&t.minimumRadius>-e){const a=i.Cartesian3.fromElements(t.radii.x+e,t.radii.y+e,t.radii.z+e,h);t=i.Ellipsoid.fromCartesian3(a,o)}return t}function p(t,e,o,r){a.defined(r)||(r=new i.Cartesian3);const n=b(t,e);let s=0;for(let e=0,i=o.length;e0:s>r&&s*s/i.Cartesian3.magnitudeSquared(n)>r)}const g=new i.Cartesian3,y=new i.Cartesian3;function N(t,e,a){const o=t.transformPositionToScaledSpace(e,g);let r=i.Cartesian3.magnitudeSquared(o),n=Math.sqrt(r);const s=i.Cartesian3.divideByScalar(o,n,y);r=Math.max(1,r),n=Math.max(1,n);const c=1/n;return 1/(i.Cartesian3.dot(s,a)*c-i.Cartesian3.magnitude(i.Cartesian3.cross(s,a,s))*(Math.sqrt(r-1)*c))}function M(t,e,a){if(!(e<=0||e===1/0||e!=e))return i.Cartesian3.multiplyByScalar(t,e,a)}const T=new i.Cartesian3;function b(t,e){return i.Cartesian3.equals(e,i.Cartesian3.ZERO)?e:(t.transformPositionToScaledSpace(e,T),i.Cartesian3.normalize(T,T))}const P={getHeight:function(t,e,i){return(t-i)*e+i}},z=new i.Cartesian3;P.getPosition=function(t,e,a,o,r){const n=e.cartesianToCartographic(t,z),s=P.getHeight(n.height,a,o);return i.Cartesian3.fromRadians(n.longitude,n.latitude,s,e,r)};var _=P;var E=Object.freeze({NONE:0,BITS12:1});const H=new i.Cartesian3,w=new i.Cartesian3,A=new o.Cartesian2,I=new o.Matrix4,V=new o.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(a.defined(e)&&a.defined(r)&&a.defined(n)&&a.defined(s)){const t=e.minimum,a=e.maximum,c=i.Cartesian3.subtract(a,t,w),u=n-r;p=Math.max(i.Cartesian3.maximumComponent(c),u)