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