UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

1 lines 1.32 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5856],{35856(t,e,s){s.r(e),s.d(e,{SplatSortWorkerInput:()=>r,SplatSortWorkerOutput:()=>n,destroy:()=>u,sort:()=>a});class r{constructor(t,e,s,r=!1){this.distances=t,this.sortOrderIndices=e,this.numGaussians=s,this.preciseSort=r}}class n{constructor(t,e){this.distances=t,this.sortedOrderIndices=e}}let o=null,l=null;function i(t,e){const s=t.length,r=Math.max(10,Math.min(20,Math.round(Math.log2(s/.25)))),n=1+(1<<r);!function(t,e){o?.length!==t&&(o=new Uint32Array(t)),l&&l.length===e?l.fill(0):l=new Uint32Array(e)}(s,n);let i=t[0],a=t[0];for(let e=0;e<t.length;e++)i=Math.min(i,t[e]),a=Math.max(a,t[e]);const u=a-i;if(u<1e-6)for(let t=0;t<s;++t)o[t]=0,l[0]++;else{const e=(1<<r)/u;for(let r=0;r<s;r++){const s=(t[r]-i)*e>>>0;o[r]=s,l[s]++}}for(let t=1;t<n;t++)l[t]+=l[t-1];for(let t=0;t<s;t++){const s=o[t];e[--l[s]]=t}}async function a(t){const{distances:e,sortOrderIndices:s,preciseSort:r,numGaussians:o}=t,l=e.subarray(0,o),a=s.subarray(0,o);if(0===l.length||0===a.length)return{result:new n(e,s),transferList:[e.buffer,s.buffer]};if(r){const t=Array.from(a.keys());t.sort((t,e)=>l[t]-l[e]||t-e);const e=t.map(t=>a[t]);a.set(e)}else i(l,a);return{result:new n(e,s),transferList:[e.buffer,s.buffer]}}function u(){o=null,l=null}}}]);