qd-changjing/public/static/Build/Cesium/Workers/TerrainEncoding-6d07f5d8.js

2 lines
10 KiB
JavaScript
Raw Normal View History

2022-07-05 16:56:29 +08:00
define(["exports","./Transforms-f15de320","./Matrix2-c6c16658","./RuntimeError-5b082e8f","./when-4bbc8319","./AttributeCompression-f7a901f9","./ComponentDatatype-3d0a0aac"],(function(t,e,i,o,a,r,n){"use strict";function s(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(s.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(t){const e=this._ellipsoid.transformPositionToScaledSpace(t,this._cameraPositionInScaledSpace),o=i.Cartesian3.magnitudeSquared(e)-1;i.Cartesian3.clone(t,this._cameraPosition),this._cameraPositionInScaledSpace=e,this._distanceToLimbInScaledSpaceSquared=o}}});const c=new i.Cartesian3;s.prototype.isPointVisible=function(t){return S(this._ellipsoid.transformPositionToScaledSpace(t,c),this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)},s.prototype.isScaledSpacePointVisible=function(t){return S(t,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const u=new i.Cartesian3;s.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(t,e){const i=this._ellipsoid;let o,r;return a.defined(e)&&e<0&&i.minimumRadius>-e?(r=u,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),S(t,r,o)},s.prototype.computeHorizonCullingPoint=function(t,e,i){return f(this._ellipsoid,t,e,i)};const d=i.Ellipsoid.clone(i.Ellipsoid.UNIT_SPHERE);s.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(t,e,i,o){return f(h(this._ellipsoid,i,d),t,e,o)},s.prototype.computeHorizonCullingPointFromVertices=function(t,e,i,o,a){return x(this._ellipsoid,t,e,i,o,a)},s.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(t,e,i,o,a,r){return x(h(this._ellipsoid,a,d),t,e,i,o,r)};const l=[];s.prototype.computeHorizonCullingPointFromRectangle=function(t,o,a){const r=i.Rectangle.subsample(t,o,0,l),n=e.BoundingSphere.fromPoints(r);if(!(i.Cartesian3.magnitude(n.center)<.1*o.minimumRadius))return this.computeHorizonCullingPoint(n.center,r,a)};const m=new i.Cartesian3;function h(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,m);t=i.Ellipsoid.fromCartesian3(a,o)}return t}function f(t,e,o,r){a.defined(r)||(r=new i.Cartesian3);const n=T(t,e);let s=0;for(let e=0,i=o.length;e<i;++e){const i=y(t,o[e],n);if(i<0)return;s=Math.max(s,i)}return N(n,s,r)}const p=new i.Cartesian3;function x(t,e,o,r,n,s){a.defined(s)||(s=new i.Cartesian3),r=a.defaultValue(r,3),n=a.defaultValue(n,i.Cartesian3.ZERO);const c=T(t,e);let u=0;for(let e=0,i=o.length;e<i;e+=r){p.x=o[e]+n.x,p.y=o[e+1]+n.y,p.z=o[e+2]+n.z;const i=y(t,p,c);if(i<0)return;u=Math.max(u,i)}return N(c,u,s)}function S(t,e,o){const a=e,r=o,n=i.Cartesian3.subtract(t,a,c),s=-i.Cartesian3.dot(n,a);return!(r<0?s>0:s>r&&s*s/i.Cartesian3.magnitudeSquared(n)>r)}const C=new i.Cartesian3,g=new i.Cartesian3;function y(t,e,o){const a=t.transformPositionToScaledSpace(e,C);let r=i.Cartesian3.magnitudeSquared(a),n=Math.sqrt(r);const s=i.Cartesian3.divideByScalar(a,n,g);r=Math.max(1,r),n=Math.max(1,n);const c=1/n;return 1/(i.Cartesian3.dot(s,o)*c-i.Cartesian3.magnitude(i.Cartesian3.cross(s,o,s))*(Math.sqrt(r-1)*c))}function N(t,e,o){if(!(e<=0||e===1/0||e!=e))return i.Cartesian3.multiplyByScalar(t,e,o)}const M=new i.Cartesian3;function T(t,e){return i.Cartesian3.equals(e,i.Cartesian3.ZERO)?e:(t.transformPositionToScaledSpace(e,M),i.Cartesian3.normalize(M,M))}const b={getHeight:function(t,e,i){return(t-i)*e+i}},P=new i.Cartesian3;b.getPosition=function(t,e,o,a,r){const n=e.cartesianToCartographic(t,P),s=b.getHeight(n.height,o,a);return i.Cartesian3.fromRadians(n.longitude,n.latitude,s,e,r)};var z=Object.freeze({NONE:0,BITS12:1});const _=new i.Cartesia