@dp_unity/dpu-gis-viewer
Version:
DPU GIS Viewer version Beta
2 lines • 2.54 kB
JavaScript
/*! For license information please see chunk-MWSGYAUE.js.LICENSE.txt */
import{f as C}from"./chunk-M3A6SPGI.js";import{a as n,e as b}from"./chunk-S4VBGY2U.js";import{a as w}from"./chunk-UCTPWOTZ.js";var j={},q=new n,L=new n,Q=new C,G=new b;function W(e,t,r,a,o,i,l,s,y,c){let m=e+t;n.multiplyByScalar(a,Math.cos(m),q),n.multiplyByScalar(r,Math.sin(m),L),n.add(q,L,q);let u=Math.cos(e);u*=u;let w=Math.sin(e);w*=w;let x=i/Math.sqrt(l*u+o*w)/s;return C.fromAxisAngle(q,x,Q),b.fromQuaternion(Q,G),b.multiplyByVector(G,y,c),n.normalize(c,c),n.multiplyByScalar(c,s,c),c}var U=new n,Z=new n,N=new n,v=new n;j.raisePositionsToHeight=function(e,t,r){let a=t.ellipsoid,o=t.height,i=t.extrudedHeight,l=r?e.length/3*2:e.length/3,s=new Float64Array(3*l),y=e.length,c=r?y:0;for(let t=0;t<y;t+=3){let l=t+1,y=t+2,m=n.fromArray(e,t,U);a.scaleToGeodeticSurface(m,m);let u=n.clone(m,Z),w=a.geodeticSurfaceNormal(m,v),x=n.multiplyByScalar(w,o,N);n.add(m,x,m),r&&(n.multiplyByScalar(w,i,x),n.add(u,x,u),s[t+c]=u.x,s[l+c]=u.y,s[y+c]=u.z),s[t]=m.x,s[l]=m.y,s[y]=m.z}return s};var D=new n,J=new n,K=new n;j.computeEllipsePositions=function(e,t,r){let a=e.semiMinorAxis,o=e.semiMajorAxis,i=e.rotation,l=e.center,s=8*e.granularity,y=a*a,c=o*o,m=o*a,u=n.magnitude(l),x=n.normalize(l,D),h=n.cross(n.UNIT_Z,l,J);h=n.normalize(h,h);let f=n.cross(x,h,K),z=1+Math.ceil(w.PI_OVER_TWO/s),O=w.PI_OVER_TWO/(z-1),_=w.PI_OVER_TWO-z*O;_<0&&(z-=Math.ceil(Math.abs(_)/O));let p,P,d,M,T,I=t?new Array(z*(z+2)*2*3):void 0,g=0,V=U,A=Z,E=4*z*3,S=E-1,j=0,v=r?new Array(E):void 0;for(_=w.PI_OVER_TWO,V=W(_,i,f,h,y,m,c,u,x,V),t&&(I[g++]=V.x,I[g++]=V.y,I[g++]=V.z),r&&(v[S--]=V.z,v[S--]=V.y,v[S--]=V.x),_=w.PI_OVER_TWO-O,p=1;p<z+1;++p){if(V=W(_,i,f,h,y,m,c,u,x,V),A=W(Math.PI-_,i,f,h,y,m,c,u,x,A),t){for(I[g++]=V.x,I[g++]=V.y,I[g++]=V.z,d=2*p+2,P=1;P<d-1;++P)M=P/(d-1),T=n.lerp(V,A,M,N),I[g++]=T.x,I[g++]=T.y,I[g++]=T.z;I[g++]=A.x,I[g++]=A.y,I[g++]=A.z}r&&(v[S--]=V.z,v[S--]=V.y,v[S--]=V.x,v[j++]=A.x,v[j++]=A.y,v[j++]=A.z),_=w.PI_OVER_TWO-(p+1)*O}for(p=z;p>1;--p){if(_=w.PI_OVER_TWO-(p-1)*O,V=W(-_,i,f,h,y,m,c,u,x,V),A=W(_+Math.PI,i,f,h,y,m,c,u,x,A),t){for(I[g++]=V.x,I[g++]=V.y,I[g++]=V.z,d=2*(p-1)+2,P=1;P<d-1;++P)M=P/(d-1),T=n.lerp(V,A,M,N),I[g++]=T.x,I[g++]=T.y,I[g++]=T.z;I[g++]=A.x,I[g++]=A.y,I[g++]=A.z}r&&(v[S--]=V.z,v[S--]=V.y,v[S--]=V.x,v[j++]=A.x,v[j++]=A.y,v[j++]=A.z)}_=w.PI_OVER_TWO,V=W(-_,i,f,h,y,m,c,u,x,V);let R={};return t&&(I[g++]=V.x,I[g++]=V.y,I[g++]=V.z,R.positions=I,R.numPts=z),r&&(v[S--]=V.z,v[S--]=V.y,v[S--]=V.x,R.outerPositions=v),R};var tt=j;export{tt as a};