{"_id":"ray-aabb-intersection","_rev":"11-f3ce70743632469a2b07083b8ba6dd50","name":"ray-aabb-intersection","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"ray-aabb-intersection","version":"1.0.0","keywords":["aabb,","axis,","aligned,","bounding,","box,","cube,","ray,","line,","collision,","intersection","ecosystem:stackgl"],"author":{"url":"https://github.com/hughsk","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","_id":"ray-aabb-intersection@1.0.0","maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"homepage":"https://github.com/stackgl/ray-aabb-intersection","bugs":{"url":"https://github.com/stackgl/ray-aabb-intersection/issues"},"dist":{"shasum":"b657e7ff1f81bc84979736d749d4b2d0b3dc4a95","tarball":"https://registry.npmjs.org/ray-aabb-intersection/-/ray-aabb-intersection-1.0.0.tgz","integrity":"sha512-bq84g28883lGsaZByke7s/pWZG5hHtXx2RuU/Eik+uCGIbGaZg8ppHoYuk3kkhwvJpfJ5nyJOWRUPXA+yy2n9A==","signatures":[{"sig":"MEUCIErxJK5u3oFeX6QV5wQ3pHYJ2yr7VX5cib+p5+w7Qtw5AiEA9mfLvKpJIF1UhghjI304subllqB0UlLYL3OQQ8ZK19U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"b657e7ff1f81bc84979736d749d4b2d0b3dc4a95","gitHead":"a79ba9a29d172f999f5efb05039eea24adfabff2","scripts":{"test":"standard index.js demo.js","start":"budo demo.js:bundle.js | garnish","bundle":"browserify demo.js -o bundle.js"},"_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"repository":{"url":"git://github.com/stackgl/ray-aabb-intersection.git","type":"git"},"_npmVersion":"2.14.3","description":"Determine the point of intersection between a ray and axis-aligned bounding box (AABB)","_nodeVersion":"4.1.0","dependencies":{},"devDependencies":{"raf":"^3.1.0","budo":"^5.1.0","garnish":"^3.2.1","gl-vec3":"^1.0.3","standard":"^5.3.1","browserify":"^11.2.0","touch-position":"^1.0.3"},"directories":{}},"1.0.1":{"name":"ray-aabb-intersection","version":"1.0.1","keywords":["aabb,","axis,","aligned,","bounding,","box,","cube,","ray,","line,","collision,","intersection","ecosystem:stackgl"],"author":{"url":"https://github.com/hughsk","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","_id":"ray-aabb-intersection@1.0.1","maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"homepage":"https://github.com/stackgl/ray-aabb-intersection","bugs":{"url":"https://github.com/stackgl/ray-aabb-intersection/issues"},"dist":{"shasum":"2eb510228d7d9222fdc8167e6737aad73666dcc7","tarball":"https://registry.npmjs.org/ray-aabb-intersection/-/ray-aabb-intersection-1.0.1.tgz","integrity":"sha512-ZKioVbRhjvawVHWOcWLKR4dzaEGYMWHCCYoBoY9cAS6wPFpaO1CJnThU7A5m4zK25MEzzg3aX0X5TiRugdfGDw==","signatures":[{"sig":"MEUCIQDHSrb4eGsrsewJglUwQICsHZ1AC9PPeC/hqMhkMKz2IwIgYuU3AHMNAfyV0s2qjfpn6PIccxOAhLvpMFLwdXQdpIc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"2eb510228d7d9222fdc8167e6737aad73666dcc7","gitHead":"d47aacdbe2ab9d6adca74c44377227e72c85c2d7","scripts":{"test":"standard index.js demo.js","bench":"node bench","start":"budo demo.js:bundle.js | garnish","bundle":"browserify demo.js -o bundle.js"},"_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"repository":{"url":"git://github.com/stackgl/ray-aabb-intersection.git","type":"git"},"_npmVersion":"2.14.3","description":"Determine the point of intersection between a ray and axis-aligned bounding box (AABB)","_nodeVersion":"4.1.0","dependencies":{},"devDependencies":{"raf":"^3.1.0","budo":"^5.1.0","garnish":"^3.2.1","gl-vec3":"^1.0.3","standard":"^5.3.1","benchmark":"^1.0.0","browserify":"^11.2.0","canvas-fit":"^1.5.0","touch-position":"^1.0.3"},"directories":{}}},"time":{"created":"2015-09-29T06:52:39.653Z","modified":"2024-12-29T00:47:37.425Z","1.0.0":"2015-09-29T06:52:39.653Z","1.0.1":"2015-09-30T01:59:29.125Z"},"bugs":{"url":"https://github.com/stackgl/ray-aabb-intersection/issues"},"author":{"url":"https://github.com/hughsk","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","homepage":"https://github.com/stackgl/ray-aabb-intersection","keywords":["aabb,","axis,","aligned,","bounding,","box,","cube,","ray,","line,","collision,","intersection","ecosystem:stackgl"],"repository":{"url":"git://github.com/stackgl/ray-aabb-intersection.git","type":"git"},"description":"Determine the point of intersection between a ray and axis-aligned bounding box (AABB)","maintainers":[{"email":"wwwtyro@gmail.com","name":"wwwtyro"},{"email":"me@mikkoh.com","name":"mikkoh"},{"email":"dave.des@gmail.com","name":"mattdesl"},{"email":"hughskennedy@gmail.com","name":"hughsk"},{"email":"tatum.creative@gmail.com","name":"tatumcreative"}],"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","readmeFilename":"README.md"}