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 0.1.5 to 0.1.6

6

dist/d3-octree.js

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

// https://github.com/vasturiano/d3-octree v0.1.5 Copyright 2019 Vasco Asturiano
// https://github.com/vasturiano/d3-octree v0.1.6 Copyright 2020 Vasco Asturiano
(function (global, factory) {

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

(global = global || self, factory(global.d3 = global.d3 || {}));
}(this, function (exports) { 'use strict';
}(this, (function (exports) { 'use strict';

@@ -518,2 +518,2 @@ function tree_add(d) {

}));
})));

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

// https://github.com/vasturiano/d3-octree v0.1.5 Copyright 2019 Vasco Asturiano
// https://github.com/vasturiano/d3-octree v0.1.6 Copyright 2020 Vasco Asturiano
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function i(t,i,e,n,s){if(isNaN(i)||isNaN(e)||isNaN(n))return t;var r,h,o,a,l,_,u,f,c,y,x,w,d=t._root,p={data:s},z=t._x0,N=t._y0,v=t._z0,g=t._x1,A=t._y1,b=t._z1;if(!d)return t._root=p,t;for(;d.length;)if((f=i>=(h=(z+g)/2))?z=h:g=h,(c=e>=(o=(N+A)/2))?N=o:A=o,(y=n>=(a=(v+b)/2))?v=a:b=a,r=d,!(d=d[x=y<<2|c<<1|f]))return r[x]=p,t;if(l=+t._x.call(null,d.data),_=+t._y.call(null,d.data),u=+t._z.call(null,d.data),i===l&&e===_&&n===u)return p.next=d,r?r[x]=p:t._root=p,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=e>=(o=(N+A)/2))?N=o:A=o,(y=n>=(a=(v+b)/2))?v=a:b=a}while((x=y<<2|c<<1|f)==(w=(u>=a)<<2|(_>=o)<<1|l>=h));return r[w]=d,r[x]=p,t}function e(t,i,e,n,s,r,h){this.node=t,this.x0=i,this.y0=e,this.z0=n,this.x1=s,this.y1=r,this.z1=h}function n(t){return t[0]}function s(t){return t[1]}function r(t){return t[2]}function h(t,i,e,h){var a=new o(null==i?n:i,null==e?s:e,null==h?r:h,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?a:a.addAll(t)}function o(t,i,e,n,s,r,h,o,a){this._x=t,this._y=i,this._z=e,this._x0=n,this._y0=s,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},e=i;t=t.next;)e=e.next={data:t.data};return i}var l=h.prototype=o.prototype;l.copy=function(){var t,i,e=new o(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return e;if(!n.length)return e._root=a(n),e;for(t=[{source:n,target:e._root=new Array(8)}];n=t.pop();)for(var s=0;s<8;++s)(i=n.source[s])&&(i.length?t.push({source:i,target:n.target[s]=new Array(8)}):n.target[s]=a(i));return e},l.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t),s=+this._z.call(null,t);return i(this.cover(e,n,s),e,n,s,t)},l.addAll=function(t){var e,n,s,r,h,o=t.length,a=new Array(o),l=new Array(o),_=new Array(o),u=1/0,f=1/0,c=1/0,y=-1/0,x=-1/0,w=-1/0;for(n=0;n<o;++n)isNaN(s=+this._x.call(null,e=t[n]))||isNaN(r=+this._y.call(null,e))||isNaN(h=+this._z.call(null,e))||(a[n]=s,l[n]=r,_[n]=h,s<u&&(u=s),s>y&&(y=s),r<f&&(f=r),r>x&&(x=r),h<c&&(c=h),h>w&&(w=h));for(y<u&&(u=this._x0,y=this._x1),x<f&&(f=this._y0,x=this._y1),w<c&&(c=this._z0,w=this._z1),this.cover(u,f,c).cover(y,x,w),n=0;n<o;++n)i(this,a[n],l[n],_[n],t[n]);return this},l.cover=function(t,i,e){if(isNaN(t=+t)||isNaN(i=+i)||isNaN(e=+e))return this;var n=this._x0,s=this._y0,r=this._z0,h=this._x1,o=this._y1,a=this._z1;if(isNaN(n))h=(n=Math.floor(t))+1,o=(s=Math.floor(i))+1,a=(r=Math.floor(e))+1;else{if(!(n>t||t>h||s>i||i>o||r>e||e>a))return this;var l,_,u=h-n,f=this._root;switch(_=(e<(r+a)/2)<<2|(i<(s+o)/2)<<1|t<(n+h)/2){case 0:do{(l=new Array(8))[_]=f,f=l}while(o=s+(u*=2),a=r+u,t>(h=n+u)||i>o||e>a);break;case 1:do{(l=new Array(8))[_]=f,f=l}while(o=s+(u*=2),a=r+u,(n=h-u)>t||i>o||e>a);break;case 2:do{(l=new Array(8))[_]=f,f=l}while(s=o-(u*=2),a=r+u,t>(h=n+u)||s>i||e>a);break;case 3:do{(l=new Array(8))[_]=f,f=l}while(s=o-(u*=2),a=r+u,(n=h-u)>t||s>i||e>a);break;case 4:do{(l=new Array(8))[_]=f,f=l}while(o=s+(u*=2),r=a-u,t>(h=n+u)||i>o||r>e);break;case 5:do{(l=new Array(8))[_]=f,f=l}while(o=s+(u*=2),r=a-u,(n=h-u)>t||i>o||r>e);break;case 6:do{(l=new Array(8))[_]=f,f=l}while(s=o-(u*=2),r=a-u,t>(h=n+u)||s>i||r>e);break;case 7:do{(l=new Array(8))[_]=f,f=l}while(s=o-(u*=2),r=a-u,(n=h-u)>t||s>i||r>e)}this._root&&this._root.length&&(this._root=f)}return this._x0=n,this._y0=s,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,n,s){var r,h,o,a,l,_,u,f,c,y=this._x0,x=this._y0,w=this._z0,d=this._x1,p=this._y1,z=this._z1,N=[],v=this._root;for(v&&N.push(new e(v,y,x,w,d,p,z)),null==s?s=1/0:(y=t-s,x=i-s,w=n-s,d=t+s,p=i+s,z=n+s,s*=s);f=N.pop();)if(!(!(v=f.node)||(h=f.x0)>d||(o=f.y0)>p||(a=f.z0)>z||(l=f.x1)<y||(_=f.y1)<x||(u=f.z1)<w))if(v.length){var g=(h+l)/2,A=(o+_)/2,b=(a+u)/2;N.push(new e(v[7],g,A,b,l,_,u),new e(v[6],h,A,b,g,_,u),new e(v[5],g,o,b,l,A,u),new e(v[4],h,o,b,g,A,u),new e(v[3],g,A,a,l,_,b),new e(v[2],h,A,a,g,_,b),new e(v[1],g,o,a,l,A,b),new e(v[0],h,o,a,g,A,b)),(c=(n>=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=n-+this._z.call(null,v.data),j=k*k+m*m+M*M;if(j<s){var q=Math.sqrt(s=j);y=t-q,x=i-q,w=n-q,d=t+q,p=i+q,z=n+q,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,e,n,s,r,h,o,a,l,_,u,f,c,y,x,w=this._root,d=this._x0,p=this._y0,z=this._z0,N=this._x1,v=this._y1,g=this._z1;if(!w)return this;if(w.length)for(;;){if((u=r>=(a=(d+N)/2))?d=a:N=a,(f=h>=(l=(p+v)/2))?p=l:v=l,(c=o>=(_=(z+g)/2))?z=_:g=_,i=w,!(w=w[y=c<<2|f<<1|u]))return this;if(!w.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])&&(e=i,x=y)}for(;w.data!==t;)if(n=w,!(w=w.next))return this;return(s=w.next)&&delete w.next,n?(s?n.next=s:delete n.next,this):i?(s?i[y]=s:delete i[y],(w=i[0]||i[1]||i[2]||i[3]||i[4]||i[5]||i[6]||i[7])&&w===(i[7]||i[6]||i[5]||i[4]||i[3]||i[2]||i[1]||i[0])&&!w.length&&(e?e[x]=w:this._root=w),this):(this._root=s,this)},l.removeAll=function(t){for(var i=0,e=t.length;i<e;++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,n,s,r,h,o,a,l,_=[],u=this._root;for(u&&_.push(new e(u,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=_.pop();)if(!t(u=i.node,s=i.x0,r=i.y0,h=i.z0,o=i.x1,a=i.y1,l=i.z1)&&u.length){var f=(s+o)/2,c=(r+a)/2,y=(h+l)/2;(n=u[7])&&_.push(new e(n,f,c,y,o,a,l)),(n=u[6])&&_.push(new e(n,s,c,y,f,a,l)),(n=u[5])&&_.push(new e(n,f,r,y,o,c,l)),(n=u[4])&&_.push(new e(n,s,r,y,f,c,l)),(n=u[3])&&_.push(new e(n,f,c,h,o,a,y)),(n=u[2])&&_.push(new e(n,s,c,h,f,a,y)),(n=u[1])&&_.push(new e(n,f,r,h,o,c,y)),(n=u[0])&&_.push(new e(n,s,r,h,f,c,y))}return this},l.visitAfter=function(t){var i,n=[],s=[];for(this._root&&n.push(new e(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=n.pop();){var r=i.node;if(r.length){var h,o=i.x0,a=i.y0,l=i.z0,_=i.x1,u=i.y1,f=i.z1,c=(o+_)/2,y=(a+u)/2,x=(l+f)/2;(h=r[0])&&n.push(new e(h,o,a,l,c,y,x)),(h=r[1])&&n.push(new e(h,c,a,l,_,y,x)),(h=r[2])&&n.push(new e(h,o,y,l,c,u,x)),(h=r[3])&&n.push(new e(h,c,y,l,_,u,x)),(h=r[4])&&n.push(new e(h,o,a,x,c,y,f)),(h=r[5])&&n.push(new e(h,c,a,x,_,y,f)),(h=r[6])&&n.push(new e(h,o,y,x,c,u,f)),(h=r[7])&&n.push(new e(h,c,y,x,_,u,f))}s.push(i)}for(;i=s.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,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "d3-octree",
"version": "0.1.5",
"version": "0.1.6",
"description": "Three-dimensional recursive spatial subdivision.",

@@ -28,8 +28,11 @@ "keywords": [

"test": "tape 'test/**/*-test.js' && eslint src test",
"prepublishOnly": "rm -rf dist && yarn test"
"prepare": "rm -rf dist && yarn test"
},
"files": [
"dist/**/*"
],
"devDependencies": {
"d3-array": "2",
"eslint": "6",
"rollup": "1.24",
"rollup": "2",
"rollup-plugin-terser": "5",

@@ -36,0 +39,0 @@ "tape": "4"

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