2 lines
8.9 KiB
JavaScript
2 lines
8.9 KiB
JavaScript
|
define(["exports","./buildModuleUrl-4e1b81e7","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./Cartesian2-47311507","./AttributeCompression-90851096","./ComponentDatatype-c140a87d","./Math-119be1a3","./PrimitiveType-a54dc62f"],(function(t,e,i,r,a,n,o,s,m,c){"use strict";function d(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(d.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(t){var e=this._ellipsoid.transformPositionToScaledSpace(t,this._cameraPositionInScaledSpace),r=i.Cartesian3.magnitudeSquared(e)-1;i.Cartesian3.clone(t,this._cameraPosition),this._cameraPositionInScaledSpace=e,this._distanceToLimbInScaledSpaceSquared=r}}});var u=new i.Cartesian3;d.prototype.isPointVisible=function(t){return M(this._ellipsoid.transformPositionToScaledSpace(t,u),this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)},d.prototype.isScaledSpacePointVisible=function(t){return M(t,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};var l=new i.Cartesian3;d.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(t,e){var i,r,n=this._ellipsoid;return a.defined(e)&&e<0&&n.minimumRadius>-e?((r=l).x=this._cameraPosition.x/(n.radii.x+e),r.y=this._cameraPosition.y/(n.radii.y+e),r.z=this._cameraPosition.z/(n.radii.z+e),i=r.x*r.x+r.y*r.y+r.z*r.z-1):(r=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared),M(t,r,i)},d.prototype.computeHorizonCullingPoint=function(t,e,i){return C(this._ellipsoid,t,e,i)};var p=n.Ellipsoid.clone(n.Ellipsoid.UNIT_SPHERE);d.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(t,e,i,r){return C(x(this._ellipsoid,i,p),t,e,r)},d.prototype.computeHorizonCullingPointFromVertices=function(t,e,i,r,a){return S(this._ellipsoid,t,e,i,r,a)},d.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(t,e,i,r,a,n){return S(x(this._ellipsoid,a,p),t,e,i,r,n)};var h=[];d.prototype.computeHorizonCullingPointFromRectangle=function(t,r,a){var o=n.Rectangle.subsample(t,r,0,h),s=e.BoundingSphere.fromPoints(o);if(!(i.Cartesian3.magnitude(s.center)<.1*r.minimumRadius))return this.computeHorizonCullingPoint(s.center,o,a)};var f=new i.Cartesian3;function x(t,e,r){if(a.defined(e)&&e<0&&t.minimumRadius>-e){var o=i.Cartesian3.fromElements(t.radii.x+e,t.radii.y+e,t.radii.z+e,f);t=n.Ellipsoid.fromCartesian3(o,r)}return t}function C(t,e,r,n){a.defined(n)||(n=new i.Cartesian3);for(var o=E(t,e),s=0,m=0,c=r.length;m<c;++m){var d=g(t,r[m],o);if(d<0)return;s=Math.max(s,d)}return T(o,s,n)}var y=new i.Cartesian3;function S(t,e,r,n,o,s){a.defined(s)||(s=new i.Cartesian3),n=a.defaultValue(n,3),o=a.defaultValue(o,i.Cartesian3.ZERO);for(var m=E(t,e),c=0,d=0,u=r.length;d<u;d+=n){y.x=r[d]+o.x,y.y=r[d+1]+o.y,y.z=r[d+2]+o.z;var l=g(t,y,m);if(l<0)return;c=Math.max(c,l)}return T(m,c,s)}function M(t,e,r){var a=e,n=r,o=i.Cartesian3.subtract(t,a,u),s=-i.Cartesian3.dot(o,a);return!(n<0?s>0:s>n&&s*s/i.Cartesian3.magnitudeSquared(o)>n)}var b=new i.Cartesian3,v=new i.Cartesian3;function g(t,e,r){var a=t.transformPositionToScaledSpace(e,b),n=i.Cartesian3.magnitudeSquared(a),o=Math.sqrt(n),s=i.Cartesian3.divideByScalar(a,o,v);n=Math.max(1,n);var m=1/(o=Math.max(1,o));return 1/(i.Cartesian3.dot(s,r)*m-i.Cartesian3.magnitude(i.Cartesian3.cross(s,r,s))*(Math.sqrt(n-1)*m))}function T(t,e,r){if(!(e<=0||e===1/0||e!=e))return i.Cartesian3.multiplyByScalar(t,e,r)}var P=new i.Cartesian3;function E(t,e){return i.Cartesian3.equals(e,i.Cartesian3.ZERO)?e:(t.transformPositionToScaledSpace(e,P),i.Cartesian3.normalize(P,P))}var z=Object.freeze({NONE:0,BITS12:1}),N=new i.Cartesian3,I=new i.Cartesian3,B=new n.Cartesian2,_=new c.Matrix4,A=new c.Matrix4,w=Math.pow(2,12);function H(t,e,r,n,o,s){var m,d,u,l=z.NONE;if(a.defined(t)&&a.defined(e)&&a.defined(r)&&a.defined(n)){var p=t.minimum,h=t.maximum,f=i.Cartesian
|