{"name":"ray-aabb-intersection","version":"1.0.1","description":"Determine the point of intersection between a ray and axis-aligned bounding box (AABB)","main":"index.js","license":"MIT","author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"https://github.com/hughsk"},"dependencies":{},"devDependencies":{"benchmark":"^1.0.0","browserify":"^11.2.0","budo":"^5.1.0","canvas-fit":"^1.5.0","garnish":"^3.2.1","gl-vec3":"^1.0.3","raf":"^3.1.0","standard":"^5.3.1","touch-position":"^1.0.3"},"scripts":{"bench":"node bench","start":"budo demo.js:bundle.js | garnish","bundle":"browserify demo.js -o bundle.js","test":"standard index.js demo.js"},"keywords":["aabb,","axis,","aligned,","bounding,","box,","cube,","ray,","line,","collision,","intersection","ecosystem:stackgl"],"repository":{"type":"git","url":"git://github.com/stackgl/ray-aabb-intersection.git"},"homepage":"https://github.com/stackgl/ray-aabb-intersection","bugs":{"url":"https://github.com/stackgl/ray-aabb-intersection/issues"},"gitHead":"d47aacdbe2ab9d6adca74c44377227e72c85c2d7","_id":"ray-aabb-intersection@1.0.1","_shasum":"2eb510228d7d9222fdc8167e6737aad73666dcc7","_from":".","_npmVersion":"2.14.3","_nodeVersion":"4.1.0","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"dist":{"shasum":"2eb510228d7d9222fdc8167e6737aad73666dcc7","tarball":"http://registry-npm.ywwl.com/ray-aabb-intersection/download/ray-aabb-intersection-1.0.1.tgz","integrity":"sha512-ZKioVbRhjvawVHWOcWLKR4dzaEGYMWHCCYoBoY9cAS6wPFpaO1CJnThU7A5m4zK25MEzzg3aX0X5TiRugdfGDw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHSrb4eGsrsewJglUwQICsHZ1AC9PPeC/hqMhkMKz2IwIgYuU3AHMNAfyV0s2qjfpn6PIccxOAhLvpMFLwdXQdpIc="}],"size":4350,"noattachment":false,"key":"/ray-aabb-intersection/-/ray-aabb-intersection-1.0.1.tgz"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"directories":{},"readme":"# ray-aabb-intersection\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nDetermine the point of intersection between a ray and axis-aligned bounding box (AABB). Theoretically works in an arbitrary number of dimensions!\n\nMany thanks to [**@BSVino**](http://github.com/BSVino) for providing the [original C++ implementation](https://github.com/BSVino/MathForGameDevelopers/blob/line-box-intersection/math/collision.cpp) and [accompanying](https://www.youtube.com/watch?v=USjbg5QXk3g) [videos](https://www.youtube.com/watch?v=3vONlLYtHUE).\n\n[**view demo**](http://stack.gl/ray-aabb-intersection/)\n\n## Usage\n\n[![NPM](https://nodei.co/npm/ray-aabb-intersection.png)](https://www.npmjs.com/package/ray-aabb-intersection)\n\n### `out = intersection(out, origin, dir, aabb)`\n\nDetermines if the given ray `(origin, direction)` intersects with the `aabb`.\n\nIf no intersection occurs, returns `null`. Otherwise, the intersection point is stored in `out` and then returned.\n\n``` javascript\nconst origin = new Float32Array([0, 4, 0])\nconst dir = new Float32Array([0, 1, 0])\nconst out = new Float32Array(3)\n\nconst aabb = [\n  [-1, -1, -1],\n  [+1, +1, +1]\n]\n\nintersection(out, origin, dir, aabb)\n```\n\n### `d = intersection.distance(origin, dir, aabb)`\n\nReturns the distance from the given ray `(origin, direction)` to the supplied `aabb`. If no intersection occurs, returns `Infinity`.\n\nNote that the `direction` vector should be normalized.\n\n## See Also\n\n* [ray-aabb](http://github.com/tmpvar/ray-aabb) — faster, but doesn't provide the point of intersection.\n* [ray-sphere-intersection](http://github.com/mattdesl/ray-sphere-intersection)\n* [ray-plane-intersection](http://github.com/mattdesl/ray-plane-intersection)\n* [ray-triangle-intersection](http://github.com/substack/ray-triangle-intersection)\n* [camera-picking-ray](https://github.com/Jam3/camera-picking-ray)\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/stackgl/ray-aabb-intersection/blob/master/LICENSE.md) for details.\n","publish_time":1443578369125,"_cnpm_publish_time":1443578369125,"dist-tags":{"latest":"1.0.1"}}