/** * Cesium - https://github.com/CesiumGS/cesium * * Copyright 2011-2020 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/CesiumGS/cesium/blob/master/LICENSE.md for full licensing details. */ define(["exports","./when-8d13db60","./Check-70bec281","./Math-61ede240","./Cartographic-f27b0939","./Cartesian2-09435a6c","./BoundingSphere-c409f092","./ComponentDatatype-5862616f","./AttributeCompression-75ce15eb"],function(e,S,d,f,b,C,g,s,x){function t(e,t){d.Check.typeOf.object("ellipsoid",e),this._ellipsoid=e,this._cameraPosition=new b.Cartesian3,this._cameraPositionInScaledSpace=new b.Cartesian3,this._distanceToLimbInScaledSpaceSquared=0,S.defined(t)&&(this.cameraPosition=t)}Object.defineProperties(t.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=b.Cartesian3.magnitudeSquared(t)-1;b.Cartesian3.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=t,this._distanceToLimbInScaledSpaceSquared=i}}});var c=new b.Cartesian3;t.prototype.isPointVisible=function(e){return y(this._ellipsoid.transformPositionToScaledSpace(e,c),this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)},t.prototype.isScaledSpacePointVisible=function(e){return y(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};var a=new b.Cartesian3;t.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){var i,r=this._ellipsoid;return y(e,i,S.defined(t)&&t<0&&r.minimumRadius>-t?((i=a).x=this._cameraPosition.x/(r.radii.x+t),i.y=this._cameraPosition.y/(r.radii.y+t),i.z=this._cameraPosition.z/(r.radii.z+t),i.x*i.x+i.y*i.y+i.z*i.z-1):(i=this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared))},t.prototype.computeHorizonCullingPoint=function(e,t,i){return l(this._ellipsoid,e,t,i)};var o=C.Ellipsoid.clone(C.Ellipsoid.UNIT_SPHERE);t.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,i,r){return l(u(this._ellipsoid,i,o),e,t,r)},t.prototype.computeHorizonCullingPointFromVertices=function(e,t,i,r,a){return h(this._ellipsoid,e,t,i,r,a)},t.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,i,r,a,n){return h(u(this._ellipsoid,a,o),e,t,i,r,n)};var n=[];t.prototype.computeHorizonCullingPointFromRectangle=function(e,t,i){d.Check.typeOf.object("rectangle",e);var r=C.Rectangle.subsample(e,t,0,n),a=g.BoundingSphere.fromPoints(r);if(!(b.Cartesian3.magnitude(a.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(a.center,r,i)};var m=new b.Cartesian3;function u(e,t,i){if(S.defined(t)&&t<0&&e.minimumRadius>-t){var r=b.Cartesian3.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,m);e=C.Ellipsoid.fromCartesian3(r,i)}return e}function l(e,t,i,r){d.Check.typeOf.object("directionToPoint",t),d.Check.defined("positions",i),S.defined(r)||(r=new b.Cartesian3);for(var a=E(e,t),n=0,o=0,s=i.length;oa)}var v=new b.Cartesian3,M=new b.Cartesian3;function T(e,t,i){var r=e.transformPositionToScaledSpace(t,v),a=b.Cartesian3.magnitudeSquared(r),n=Math.sqrt(a),o=b.Cartesian3.divideByScalar(r,n,M);a=Math.max(1,a);var s=1/(n=Math.max(1,n));return 1/(b.Cartesian3.dot(o,i)*s-b.Cartesian3.magnitude(b.Cartesian3.cross(o,i,o))*(Math.sqrt(a-1)*s))}function P(e,t,i){if(!(t<=0||t===1/0||t!=t))return b.Cartesian3.multiplyByScalar(e,t,i)}var i=new b.Cartesian3;function E(e,t){return b.Cartesian3.equals(t,b.Cartesian3.ZERO)?t:(e.transformPositionToScaledSpace(t,i),b.Cartesian3.normalize(i,i))}var z=Object.freeze({NONE:0,BITS12:1}),N=new b.Cartesian3,I=new b.Cartesian3,B=new C.Cartesian2,_=new g.Matrix4,w=new g.Matrix4,A=Math.pow(2,12);function r(e,t,i,r,a,n){var o,s,c,m=z.NONE;if(S.defined(e)&&S.defined(t)&&S.defined(i)&&S.defined(r)){var u=e.minimum,d=e.maximum,l=b.Cartesian3.subtract(d,u,I),p=i-t;m=Math.max(b.Cartesian3.maximumComponent(l),p)