qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/TerrainEncoding-0f7ffc20.js

2 lines
11 KiB
JavaScript
Raw Permalink Normal View History

2023-12-17 15:30:40 +08:00
define(["exports","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./Check-741c5f3c","./defaultValue-81eec7ed","./Cartesian2-bd414876","./Rectangle-cf3e0e3e","./AttributeCompression-8f752c03","./ComponentDatatype-aaeec80f","./Math-e73894ab","./Matrix4-4c545f70"],(function(t,e,i,a,o,n,r,s,c,u,d){"use strict";function l(t,e){this._ellipsoid=t,this._cameraPosition=new i.Cartesian3,this._cameraPositionInScaledSpace=new i.Cartesian3,this._distanceToLimbInScaledSpaceSquared=0,o.defined(e)&&(this.cameraPosition=e)}Object.defineProperties(l.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(t){const e=this._ellipsoid.transformPositionToScaledSpace(t,this._cameraPositionInScaledSpace),a=i.Cartesian3.magnitudeSquared(e)-1;i.Cartesian3.clone(t,this._cameraPosition),this._cameraPositionInScaledSpace=e,this._distanceToLimbInScaledSpaceSquared=a}}});const m=new i.Cartesian3;l.prototype.isPointVisible=function(t){return N(this._ellipsoid.transformPositionToScaledSpace(t,m),this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)},l.prototype.isScaledSpacePointVisible=function(t){return N(t,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const h=new i.Cartesian3;l.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(t,e){const i=this._ellipsoid;let a,n;return o.defined(e)&&e<0&&i.minimumRadius>-e?(n=h,n.x=this._cameraPosition.x/(i.radii.x+e),n.y=this._cameraPosition.y/(i.radii.y+e),n.z=this._cameraPosition.z/(i.radii.z+e),a=n.x*n.x+n.y*n.y+n.z*n.z-1):(n=this._cameraPositionInScaledSpace,a=this._distanceToLimbInScaledSpaceSquared),N(t,n,a)},l.prototype.computeHorizonCullingPoint=function(t,e,i){return C(this._ellipsoid,t,e,i)};const f=n.Ellipsoid.clone(n.Ellipsoid.UNIT_SPHERE);l.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(t,e,i,a){return C(S(this._ellipsoid,i,f),t,e,a)},l.prototype.computeHorizonCullingPointFromVertices=function(t,e,i,a,o){return y(this._ellipsoid,t,e,i,a,o)},l.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(t,e,i,a,o,n){return y(S(this._ellipsoid,o,f),t,e,i,a,n)};const p=[];l.prototype.computeHorizonCullingPointFromRectangle=function(t,a,o){const n=r.Rectangle.subsample(t,a,0,p),s=e.BoundingSphere.fromPoints(n);if(!(i.Cartesian3.magnitude(s.center)<.1*a.minimumRadius))return this.computeHorizonCullingPoint(s.center,n,o)};const x=new i.Cartesian3;function S(t,e,a){if(o.defined(e)&&e<0&&t.minimumRadius>-e){const o=i.Cartesian3.fromElements(t.radii.x+e,t.radii.y+e,t.radii.z+e,x);t=n.Ellipsoid.fromCartesian3(o,a)}return t}function C(t,e,a,n){o.defined(n)||(n=new i.Cartesian3);const r=_(t,e);let s=0;for(let e=0,i=a.length;e<i;++e){const i=b(t,a[e],r);if(i<0)return;s=Math.max(s,i)}return P(r,s,n)}const g=new i.Cartesian3;function y(t,e,a,n,r,s){o.defined(s)||(s=new i.Cartesian3),n=o.defaultValue(n,3),r=o.defaultValue(r,i.Cartesian3.ZERO);const c=_(t,e);let u=0;for(let e=0,i=a.length;e<i;e+=n){g.x=a[e]+r.x,g.y=a[e+1]+r.y,g.z=a[e+2]+r.z;const i=b(t,g,c);if(i<0)return;u=Math.max(u,i)}return P(c,u,s)}function N(t,e,a){const o=e,n=a,r=i.Cartesian3.subtract(t,o,m),s=-i.Cartesian3.dot(r,o);return!(n<0?s>0:s>n&&s*s/i.Cartesian3.magnitudeSquared(r)>n)}const M=new i.Cartesian3,T=new i.Cartesian3;function b(t,e,a){const o=t.transformPositionToScaledSpace(e,M);let n=i.Cartesian3.magnitudeSquared(o),r=Math.sqrt(n);const s=i.Cartesian3.divideByScalar(o,r,T);n=Math.max(1,n),r=Math.max(1,r);const c=1/r;return 1/(i.Cartesian3.dot(s,a)*c-i.Cartesian3.magnitude(i.Cartesian3.cross(s,a,s))*(Math.sqrt(n-1)*c))}function P(t,e,a){if(!(e<=0||e===1/0||e!=e))return i.Cartesian3.multiplyByScalar(t,e,a)}const z=new i.Cartesian3;function _(t,e){return i.Cartesian3.equals(e,i.Cartesian3.ZERO)?e:(t.transformPositionToScaledSpace(e,z),i.Cartesian3.normalize(z,z))}const E={getHeight:function(t,e,i){return(t-i)*e+i}},H=new i.Cartesian3;E.getPosition=function(t,e,a,o,n){const r=e.cartesianToCartographic(t,H),s=E.getHeight(r.height,a,o);return i.Cartesian3.fr