@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{copy as t,normalize as o,set as n,subtract as c,cross as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function l(t,o,n,c,e,s,l,i,u,h,a,g,m){const p=n.length/3;let x=2*c.count;r(t,o,c.index,c.count,n,0,p,e,s,l,i,u,h,x,a,g,m);let L=0,b=2*c.count;x=0;const j=c.pathLengths[0];f(e,s,i,l,L,j,c.count,b,u,x,a),b+=4*j,x+=2*j,L+=j;for(let r=1;r<c.pathLengths.length;++r){const t=c.pathLengths[r];f(e,s,i,l,L,t,c.count,b,u,x,a),b+=4*t,x+=2*t,L+=t}}function r(n,c,e,s,l,r,f,i,u,h,a,g,m,p,x,v,d){t(L,v),u??=[],h??=[],a??=[];const k=x>0?1:-1;let q=3*e,w=0,y=3*w,z=s,A=3*z;for(let t=0;t<s;++t){const t=n[q],e=n[q+1],s=n[q+2];d&&(L[0]=t,L[1]=e,L[2]=s,o(L,L)),i[y+0]=t,i[y+1]=e,i[y+2]=s;const l=c[q+0],r=c[q+1],f=c[q+2];u[y+0]=l,u[y+1]=r,u[y+2]=f,h[y+0]=-k*L[0],h[y+1]=-k*L[1],h[y+2]=-k*L[2],a[w]=0,i[A+0]=t+x*L[0],i[A+1]=e+x*L[1],i[A+2]=s+x*L[2],u[A+0]=l,u[A+1]=r,u[A+2]=f,a[z]=x,y+=3,A+=3,q+=3,w+=1,z+=1}q=3*r,y=0,A=3*p;const B=x<0?j:b,C=x<0?b:j;for(let t=0;t<f;++t)m[y]=l[q+B[0]],m[y+1]=l[q+B[1]],m[y+2]=l[q+B[2]],g[A]=l[q+C[0]]+s,g[A+1]=l[q+C[1]]+s,g[A+2]=l[q+C[2]]+s,y+=3,A+=3,q+=3}function f(t,o,n,c,e,s,l,r,f,a,g){o??=[],n??=[],c??=[];let m=e,p=e+1,x=e+l,L=e+l+1,b=r,j=r+1,v=r+2*s,d=r+2*s+1;g<0&&(m=e+l+1,L=e);let k=3*a;for(let q=0;q<s;++q)q===s-1&&(p=e,g>0?L=e+l:m=e+l),i(t,m,p,x,h),u(t,o,c,n,h,b,m),u(t,o,c,n,h,j,p),u(t,o,c,n,h,v,x),u(t,o,c,n,h,d,L),f[k]=b,f[k+1]=v,f[k+2]=d,f[k+3]=b,f[k+4]=d,f[k+5]=j,k+=6,m++,p++,x++,L++,b+=2,j+=2,v+=2,d+=2}function i(t,s,l,r,f){s*=3,l*=3,r*=3,n(a,t[s++],t[s++],t[s++]),n(g,t[l++],t[l++],t[l++]),n(m,t[r++],t[r++],t[r++]),c(p,g,a),c(x,m,a),e(f,x,p),o(f,f)}function u(t,o,n,c,e,s,l){c[s]=c[l],l*=3,t[s*=3]=t[l],t[s+1]=t[l+1],t[s+2]=t[l+2],o[s]=o[l],o[s+1]=o[l+1],o[s+2]=o[l+2],n[s]=e[0],n[s+1]=e[1],n[s+2]=e[2]}const h=s(),a=s(),g=s(),m=s(),p=s(),x=s(),L=s(),b=[0,2,1],j=[0,1,2];export{l as extrudePolygon};