Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-octree

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-octree - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

dist/d3-octree.js

@@ -1,2 +0,2 @@

// https://github.com/vasturiano/d3-octree v1.0.0
// https://github.com/vasturiano/d3-octree v1.0.1
(function (global, factory) {

@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

@@ -1,2 +0,2 @@

// https://github.com/vasturiano/d3-octree v1.0.0
// https://github.com/vasturiano/d3-octree v1.0.1
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function i(t,i,n,s,e){if(isNaN(i)||isNaN(n)||isNaN(s))return t;var r,h,o,a,l,u,_,f,c,y,x,d,p=t._root,w={data:e},z=t._x0,N=t._y0,v=t._z0,g=t._x1,A=t._y1,b=t._z1;if(!p)return t._root=w,t;for(;p.length;)if((f=i>=(h=(z+g)/2))?z=h:g=h,(c=n>=(o=(N+A)/2))?N=o:A=o,(y=s>=(a=(v+b)/2))?v=a:b=a,r=p,!(p=p[x=y<<2|c<<1|f]))return r[x]=w,t;if(l=+t._x.call(null,p.data),u=+t._y.call(null,p.data),_=+t._z.call(null,p.data),i===l&&n===u&&s===_)return w.next=p,r?r[x]=w:t._root=w,t;do{r=r?r[x]=new Array(8):t._root=new Array(8),(f=i>=(h=(z+g)/2))?z=h:g=h,(c=n>=(o=(N+A)/2))?N=o:A=o,(y=s>=(a=(v+b)/2))?v=a:b=a}while((x=y<<2|c<<1|f)==(d=(_>=a)<<2|(u>=o)<<1|l>=h));return r[d]=p,r[x]=w,t}function n(t,i,n,s,e,r,h){this.node=t,this.x0=i,this.y0=n,this.z0=s,this.x1=e,this.y1=r,this.z1=h}function s(t){return t[0]}function e(t){return t[1]}function r(t){return t[2]}function h(t,i,n,h){var a=new o(null==i?s:i,null==n?e:n,null==h?r:h,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?a:a.addAll(t)}function o(t,i,n,s,e,r,h,o,a){this._x=t,this._y=i,this._z=n,this._x0=s,this._y0=e,this._z0=r,this._x1=h,this._y1=o,this._z1=a,this._root=void 0}function a(t){for(var i={data:t.data},n=i;t=t.next;)n=n.next={data:t.data};return i}var l=h.prototype=o.prototype;l.copy=function(){var t,i,n=new o(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),s=this._root;if(!s)return n;if(!s.length)return n._root=a(s),n;for(t=[{source:s,target:n._root=new Array(8)}];s=t.pop();)for(var e=0;e<8;++e)(i=s.source[e])&&(i.length?t.push({source:i,target:s.target[e]=new Array(8)}):s.target[e]=a(i));return n},l.add=function(t){const n=+this._x.call(null,t),s=+this._y.call(null,t),e=+this._z.call(null,t);return i(this.cover(n,s,e),n,s,e,t)},l.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const n=t.length,s=new Float64Array(n),e=new Float64Array(n),r=new Float64Array(n);let h=1/0,o=1/0,a=1/0,l=-1/0,u=-1/0,_=-1/0;for(let i,f,c,y,x=0;x<n;++x)isNaN(f=+this._x.call(null,i=t[x]))||isNaN(c=+this._y.call(null,i))||isNaN(y=+this._z.call(null,i))||(s[x]=f,e[x]=c,r[x]=y,f<h&&(h=f),f>l&&(l=f),c<o&&(o=c),c>u&&(u=c),y<a&&(a=y),y>_&&(_=y));if(h>l||o>u||a>_)return this;this.cover(h,o,a).cover(l,u,_);for(let h=0;h<n;++h)i(this,s[h],e[h],r[h],t[h]);return this},l.cover=function(t,i,n){if(isNaN(t=+t)||isNaN(i=+i)||isNaN(n=+n))return this;var s=this._x0,e=this._y0,r=this._z0,h=this._x1,o=this._y1,a=this._z1;if(isNaN(s))h=(s=Math.floor(t))+1,o=(e=Math.floor(i))+1,a=(r=Math.floor(n))+1;else{for(var l,u,_=h-s||1,f=this._root;s>t||t>=h||e>i||i>=o||r>n||n>=a;)switch(u=(n<r)<<2|(i<e)<<1|t<s,(l=new Array(8))[u]=f,f=l,_*=2,u){case 0:h=s+_,o=e+_,a=r+_;break;case 1:s=h-_,o=e+_,a=r+_;break;case 2:h=s+_,e=o-_,a=r+_;break;case 3:s=h-_,e=o-_,a=r+_;break;case 4:h=s+_,o=e+_,r=a-_;break;case 5:s=h-_,o=e+_,r=a-_;break;case 6:h=s+_,e=o-_,r=a-_;break;case 7:s=h-_,e=o-_,r=a-_}this._root&&this._root.length&&(this._root=f)}return this._x0=s,this._y0=e,this._z0=r,this._x1=h,this._y1=o,this._z1=a,this},l.data=function(){var t=[];return this.visit((function(i){if(!i.length)do{t.push(i.data)}while(i=i.next)})),t},l.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},l.find=function(t,i,s,e){var r,h,o,a,l,u,_,f,c,y=this._x0,x=this._y0,d=this._z0,p=this._x1,w=this._y1,z=this._z1,N=[],v=this._root;for(v&&N.push(new n(v,y,x,d,p,w,z)),null==e?e=1/0:(y=t-e,x=i-e,d=s-e,p=t+e,w=i+e,z=s+e,e*=e);f=N.pop();)if(!(!(v=f.node)||(h=f.x0)>p||(o=f.y0)>w||(a=f.z0)>z||(l=f.x1)<y||(u=f.y1)<x||(_=f.z1)<d))if(v.length){var g=(h+l)/2,A=(o+u)/2,b=(a+_)/2;N.push(new n(v[7],g,A,b,l,u,_),new n(v[6],h,A,b,g,u,_),new n(v[5],g,o,b,l,A,_),new n(v[4],h,o,b,g,A,_),new n(v[3],g,A,a,l,u,b),new n(v[2],h,A,a,g,u,b),new n(v[1],g,o,a,l,A,b),new n(v[0],h,o,a,g,A,b)),(c=(s>=b)<<2|(i>=A)<<1|t>=g)&&(f=N[N.length-1],N[N.length-1]=N[N.length-1-c],N[N.length-1-c]=f)}else{var k=t-+this._x.call(null,v.data),m=i-+this._y.call(null,v.data),M=s-+this._z.call(null,v.data),F=k*k+m*m+M*M;if(F<e){var T=Math.sqrt(e=F);y=t-T,x=i-T,d=s-T,p=t+T,w=i+T,z=s+T,r=v.data}}return r},l.remove=function(t){if(isNaN(r=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t))||isNaN(o=+this._z.call(null,t)))return this;var i,n,s,e,r,h,o,a,l,u,_,f,c,y,x,d=this._root,p=this._x0,w=this._y0,z=this._z0,N=this._x1,v=this._y1,g=this._z1;if(!d)return this;if(d.length)for(;;){if((_=r>=(a=(p+N)/2))?p=a:N=a,(f=h>=(l=(w+v)/2))?w=l:v=l,(c=o>=(u=(z+g)/2))?z=u:g=u,i=d,!(d=d[y=c<<2|f<<1|_]))return this;if(!d.length)break;(i[y+1&7]||i[y+2&7]||i[y+3&7]||i[y+4&7]||i[y+5&7]||i[y+6&7]||i[y+7&7])&&(n=i,x=y)}for(;d.data!==t;)if(s=d,!(d=d.next))return this;return(e=d.next)&&delete d.next,s?(e?s.next=e:delete s.next,this):i?(e?i[y]=e:delete i[y],(d=i[0]||i[1]||i[2]||i[3]||i[4]||i[5]||i[6]||i[7])&&d===(i[7]||i[6]||i[5]||i[4]||i[3]||i[2]||i[1]||i[0])&&!d.length&&(n?n[x]=d:this._root=d),this):(this._root=e,this)},l.removeAll=function(t){for(var i=0,n=t.length;i<n;++i)this.remove(t[i]);return this},l.root=function(){return this._root},l.size=function(){var t=0;return this.visit((function(i){if(!i.length)do{++t}while(i=i.next)})),t},l.visit=function(t){var i,s,e,r,h,o,a,l,u=[],_=this._root;for(_&&u.push(new n(_,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=u.pop();)if(!t(_=i.node,e=i.x0,r=i.y0,h=i.z0,o=i.x1,a=i.y1,l=i.z1)&&_.length){var f=(e+o)/2,c=(r+a)/2,y=(h+l)/2;(s=_[7])&&u.push(new n(s,f,c,y,o,a,l)),(s=_[6])&&u.push(new n(s,e,c,y,f,a,l)),(s=_[5])&&u.push(new n(s,f,r,y,o,c,l)),(s=_[4])&&u.push(new n(s,e,r,y,f,c,l)),(s=_[3])&&u.push(new n(s,f,c,h,o,a,y)),(s=_[2])&&u.push(new n(s,e,c,h,f,a,y)),(s=_[1])&&u.push(new n(s,f,r,h,o,c,y)),(s=_[0])&&u.push(new n(s,e,r,h,f,c,y))}return this},l.visitAfter=function(t){var i,s=[],e=[];for(this._root&&s.push(new n(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=s.pop();){var r=i.node;if(r.length){var h,o=i.x0,a=i.y0,l=i.z0,u=i.x1,_=i.y1,f=i.z1,c=(o+u)/2,y=(a+_)/2,x=(l+f)/2;(h=r[0])&&s.push(new n(h,o,a,l,c,y,x)),(h=r[1])&&s.push(new n(h,c,a,l,u,y,x)),(h=r[2])&&s.push(new n(h,o,y,l,c,_,x)),(h=r[3])&&s.push(new n(h,c,y,l,u,_,x)),(h=r[4])&&s.push(new n(h,o,a,x,c,y,f)),(h=r[5])&&s.push(new n(h,c,a,x,u,y,f)),(h=r[6])&&s.push(new n(h,o,y,x,c,_,f)),(h=r[7])&&s.push(new n(h,c,y,x,u,_,f))}e.push(i)}for(;i=e.pop();)t(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this},l.x=function(t){return arguments.length?(this._x=t,this):this._x},l.y=function(t){return arguments.length?(this._y=t,this):this._y},l.z=function(t){return arguments.length?(this._z=t,this):this._z},t.octree=h}));
{
"name": "d3-octree",
"version": "1.0.0",
"version": "1.0.1",
"description": "Three-dimensional recursive spatial subdivision.",

@@ -41,6 +41,6 @@ "keywords": [

"@rollup/plugin-terser": "^0.4.0",
"eslint": "7",
"mocha": "8",
"rollup": "3"
"eslint": "^8.33.0",
"mocha": "^10.2.0",
"rollup": "^3.14.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc