{"dist":{"shasum":"d0bc8e3240c17c1f6c06e53c0ec9a4704a25969e","tarball":"https://registry.npmjs.org/n-body-pairs/-/n-body-pairs-0.0.0.tgz","integrity":"sha512-hfgvhmw+gPH1ADqgz8Xn2ekz6x4fX7fBAxYB68wB/1HIBnnvR/tFlsYC7RM8gsAAJvvBbATYqOgJ7IvbiZ/ODw==","signatures":[{"sig":"MEUCIDjy+CGRJNgBRNyU2VBVN++v+LMqmP78bT//x12zi/OwAiEAklMSxX7W9yWkhxh/pqVqBTZEG4RbvB3Kdfqz8uFIDoQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"pairs.js","name":"n-body-pairs","_from":".","author":{"name":"Mikola Lysenko"},"readme":"n-body-pairs\n============\nGiven a collection of spheres with equal radii, find all pairwise intersections.\n\nUsage\n=====\nFirst install using npm:\n\n    npm install n-body-pairs\n    \nThen use it as follows:\n\n```javascript\n//Load the library\nvar nbp = require(\"n-body-pairs\")\n\n//Create some points\nvar points = [\n  [0, 0, 0],\n  [1, 0, 0],\n  [0, 1, 0],\n  [0, 0, 100000000],\n  [0, 0, 100000001]\n]\n\n//Report all pairs of points which are within 1.1 units of eachother\nnbp(points, 1.1, function(i,j) {\n    console.log(\"Overlap (\"+i+\",\"+j+\"):\", points[i], points[j])\n})\n//Prints:\n//\n//  Overlap (0,3): [ 0, 0, 0 ] [ 0, 0, 1 ]\n//  Overlap (2,0): [ 0, 1, 0 ] [ 0, 0, 0 ]\n//  Overlap (1,0): [ 1, 0, 0 ] [ 0, 0, 0 ]\n//  Overlap (4,5): [ 0, 0, 100000000 ] [ 0, 0, 100000001 ]\n//\n```\n\n### `nbp(points, radius, callback(a,b)[, storage])`\nComputes all pairwise overlaps\n\n* `points` is an array of points\n* `radius` is the radius of the overlap query\n* `callback(a,b)` is a function which is called on each pair of points.  If it returns a truthy value, then iteration is terminated.\n* `storage` an optional storage data structure, created using allocateStorage.  If not specified, it is created upon running the algorithm.\n\n**Time Complexity:** `O(points.length * dimension * 2^dimension * log(points.length) + number of intersections)`\n\n**Space Complexity:** Size of storage is `O(points.length * 2^dimension)`\n\n### `nbp.allocateStorage(max_points, dimension)`\nReserves space for an intermediate storage data structure\n\n* `max_points` is the initial capacity of the storage\n* `dimension` is the dimension of the point set\n\n**Returns:** A new storage object for resolving the overlap queries\n\n### `nbp.resizeStorage(storage, max_points, dimension)`\nResizes the storage data structure\n\n* `storage` is the data structure to resize\n* `max_points` is the new capacity of the storage\n* `dimension` is the dimension of the point set\n\nCredits\n=======\n(c) 2013 Mikola Lysenko. BSD License\n","gitHead":"ee6f5c7993073cb19fc9bb1bc19cbf9e29fc11e1","license":"BSD","scripts":{"test":"tap test/*.js"},"_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"keywords":["point","pairs","overlap","n","body","collision","detect","detection","collide","simulate","sphere","radius"],"repository":{"url":"git://github.com/mikolalysenko/n-body-pairs.git","type":"git"},"_npmVersion":"1.2.14","description":"Given a collection of spheres with equal radii, find all pairwise intersections.","directories":{"test":"test"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"dependencies":{},"readmeFilename":"README.md","devDependencies":{"tap":"~0.4.1"},"_id":"n-body-pairs@0.0.0","version":"0.0.0"}