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