{"_id":"ray-3d","_rev":"7-bbc7c5ef27bce07e5dc320b484cd0d6f","name":"ray-3d","description":"a high-level ray picking helper for 3D intersection","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"ray-3d","version":"1.0.0","description":"a high-level picking ray helper for 3D intersection","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"gl-vec3":"^1.0.3","ray-plane-intersection":"^1.0.0","ray-sphere-intersection":"^1.0.0","ray-triangle-intersection":"^1.0.3"},"devDependencies":{"tape":"^4.0.0"},"scripts":{"test":"node test.js"},"keywords":["pick","picking","ray","camera","unproject","project","hit","test","collision","intersect","intersection","intersects","mouse","touch"],"repository":{"type":"git","url":"git://github.com/Jam3/ray-3d.git"},"homepage":"https://github.com/Jam3/ray-3d","bugs":{"url":"https://github.com/Jam3/ray-3d/issues"},"gitHead":"33571ddf7757388c5f9572b9f6c4f7b04e71c695","_id":"ray-3d@1.0.0","_shasum":"4d60a8a07fc16d1dab40b069b536332dc2c704d9","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.32","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"4d60a8a07fc16d1dab40b069b536332dc2c704d9","tarball":"https://registry.npmjs.org/ray-3d/-/ray-3d-1.0.0.tgz","integrity":"sha512-egJvBQ9n2CADNVnLy7j+oouXd2+RPDo9ayfLYKNHHj81oTfIfH1oRvm3nebNaMacJ5S6NU1U7caAYHMnJ8i7ww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHchH+OmHk8aBc1pRXwKDYBchClbOcIz5ZsTyI9mNvYuAiBqIpWBgfNN9sEQoVDxR0aW6myac1ZgPAeNOShe3K6bow=="}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}]},"1.0.1":{"name":"ray-3d","version":"1.0.1","description":"a high-level picking ray helper for 3D intersection","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"gl-vec3":"^1.0.3","ray-plane-intersection":"^1.0.0","ray-sphere-intersection":"^1.0.0","ray-triangle-intersection":"^1.0.3"},"devDependencies":{"tape":"^4.0.0"},"scripts":{"test":"node test.js"},"keywords":["pick","picking","ray","camera","unproject","project","hit","test","collision","intersect","intersection","intersects","mouse","touch"],"repository":{"type":"git","url":"git://github.com/Jam3/ray-3d.git"},"homepage":"https://github.com/Jam3/ray-3d","bugs":{"url":"https://github.com/Jam3/ray-3d/issues"},"gitHead":"47b9f768e08e9b9467bce3e70944b9924f524ca1","_id":"ray-3d@1.0.1","_shasum":"cf46e085a353e06678b6b96a9915f21eb44029d1","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.32","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"cf46e085a353e06678b6b96a9915f21eb44029d1","tarball":"https://registry.npmjs.org/ray-3d/-/ray-3d-1.0.1.tgz","integrity":"sha512-gMZYEpOtWO91AbG6BeSh8yfQSqeahuYNIOLgbBJJbwcqs1JNKCc5zA6GfcZI8snSD/gTsQ9rZmDsIxKQ9SD20Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJkVyEAgkE42LC+6aexDOGkpPbfphk3kV0nS0QiOvKUAIhAMB9WB+t4jSjLY6j8vtFhTxFu2TM1YcyITRO079GBaQk"}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}]},"1.0.2":{"name":"ray-3d","version":"1.0.2","description":"a high-level ray picking helper for 3D intersection","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"gl-vec3":"^1.0.3","ray-plane-intersection":"^1.0.0","ray-sphere-intersection":"^1.0.0","ray-triangle-intersection":"^1.0.3"},"devDependencies":{"tape":"^4.0.0"},"scripts":{"test":"node test.js"},"keywords":["pick","picking","ray","camera","unproject","project","hit","test","collision","intersect","intersection","intersects","mouse","touch"],"repository":{"type":"git","url":"git://github.com/Jam3/ray-3d.git"},"homepage":"https://github.com/Jam3/ray-3d","bugs":{"url":"https://github.com/Jam3/ray-3d/issues"},"gitHead":"8868be5fb7993868aeb412c9ce77accd1cb12d96","_id":"ray-3d@1.0.2","_shasum":"f4815e8df63252b2271cf1b0dad259bbe30f5ffd","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.32","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"f4815e8df63252b2271cf1b0dad259bbe30f5ffd","tarball":"https://registry.npmjs.org/ray-3d/-/ray-3d-1.0.2.tgz","integrity":"sha512-HzBBlecS29WL+qkFZZPYUCLwWLlBWKZXZt39dXA7ifdgWjxaWeKVnEmFvkSjMvGCZoqSglkjkwyM4t5IwaY0OQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID9wfNlKalFDJ07DgJ5YAx7BgrkzcW78wD0pJFLkS1iUAiEA2pcSFFyNjD+mj6GTspeDRxXRSA4UPCatpNxaKB7wN4Q="}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}]},"1.1.0":{"name":"ray-3d","version":"1.1.0","description":"a high-level ray picking helper for 3D intersection","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"gl-vec3":"^1.0.3","ray-aabb-intersection":"^1.0.1","ray-plane-intersection":"^1.0.0","ray-sphere-intersection":"^1.0.0","ray-triangle-intersection":"^1.0.3"},"devDependencies":{"tape":"^4.0.0"},"scripts":{"test":"node test.js"},"keywords":["pick","picking","ray","camera","unproject","project","hit","test","collision","intersect","intersection","intersects","mouse","touch"],"repository":{"type":"git","url":"git://github.com/Jam3/ray-3d.git"},"homepage":"https://github.com/Jam3/ray-3d","bugs":{"url":"https://github.com/Jam3/ray-3d/issues"},"gitHead":"f172493707fd1734fd91c340ae58ff34c9dd9ea3","_id":"ray-3d@1.1.0","_shasum":"d816dc25eee8d201d4efaede14b311e3626bce89","_from":".","_npmVersion":"2.14.5","_nodeVersion":"0.12.7","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"d816dc25eee8d201d4efaede14b311e3626bce89","tarball":"https://registry.npmjs.org/ray-3d/-/ray-3d-1.1.0.tgz","integrity":"sha512-OypwPS961QD5viLVgbhwmRsG5tnmz7UM5HfmYM38jHDWwHvYtzWir3C9Y4h4AuhUURwHGRM8B4egkr2KiCpoGg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdqKF9+ZS3aUFqgIAuu0TCNVbyUfmxBd7xKJ+lpxgnZwIgcoR7r3IXMD4bI699KjR+JkaBOdFIvRR9+xPLPCuDck0="}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}]},"1.1.1":{"name":"ray-3d","version":"1.1.1","description":"a high-level ray picking helper for 3D intersection","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"gl-vec3":"^1.0.3","ray-aabb-intersection":"^1.0.1","ray-plane-intersection":"^1.0.0","ray-sphere-intersection":"^1.0.0","ray-triangle-intersection":"^1.0.3"},"devDependencies":{"tape":"^4.0.0"},"scripts":{"test":"node test.js"},"keywords":["pick","picking","ray","camera","unproject","project","hit","test","collision","intersect","intersection","intersects","mouse","touch"],"repository":{"type":"git","url":"git://github.com/Jam3/ray-3d.git"},"homepage":"https://github.com/Jam3/ray-3d","bugs":{"url":"https://github.com/Jam3/ray-3d/issues"},"gitHead":"798874b6aec3f38ac4bcb8178b19e55af9d0a5f9","_id":"ray-3d@1.1.1","_shasum":"73801135b567866850881a5c06655853f2e10273","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"73801135b567866850881a5c06655853f2e10273","tarball":"https://registry.npmjs.org/ray-3d/-/ray-3d-1.1.1.tgz","integrity":"sha512-6BZQ2duBTU0nDgk8PCcDlYt7yph0NNBQE1ntYf4iCZ+ZiDh+DHj/HkJEnsQg4E54ydWsJ7O/DSrqQgxDqyNG9g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGp+wGEbwx80OUFNd/Ghx/9XUnsr/wuvpZSbGan8zYKXAiEAo27ZecYuNnCZ2FzLKTqWkjxaq5px1luu8kuRjmeXfiU="}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}]}},"readme":"# ray-3d\n\n[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)\n\nA high-level ray picking helper for 3D intersection, built from modular pieces.\n\n```js\nvar Ray = require('ray-3d')\n\nvar ray = new Ray(origin, direction)\n\nif (ray.intersectsSphere(center, radius)) {\n  console.log(\"Hit a sphere!\")\n}\n```\n\nFeatures:\n\n- `intersectsSphere`\n- `intersectsPlane`\n- `intersectsTriangle`\n- `intersectsTriangleCell`\n- `intersectsAABB` (Axis-Aligned Bounding Box)\n\nThe API is still experimental, and missing some features:\n\n- `ray-ray-intersection`\n- `ray-mesh-intersection` (simplicial complex)\n\n## Usage\n\n[![NPM](https://nodei.co/npm/ray-3d.png)](https://www.npmjs.com/package/ray-3d)\n\n#### `ray = new Ray([origin, direction])`\n\nCreates a new `Ray` with optional `origin` and `direction`, both arrays in the form `[x, y, z]`. \n\n`origin` defaults to `[0, 0, 0]` and `direction` defaults to `[0, 0, -1]`.\n\n#### `ray.set(origin, direction)`\n\nAssigns this ray's `origin` and `direction` to the given values.\n\n#### `ray.copy(otherRay)`\n\nCopies the `origin` and `direction` from the `otherRay` into this ray.\n\n#### `otherRay = ray.clone()`\n\nDeep clones this ray into a new `Ray` instance.\n\n---\n\n### intersections\n\nAll intersection methods return the collision point `[x, y, z]` if one occurred, which is re-used across calls to avoid GC thrashing. \n\nIf no collision occurred, the methods return `null`.\n\n#### `ray.intersectsPlane(normal, distance)`\n\nWhether this ray intersects the plane with the unit `normal` [x, y, z] and `distance` from origin.\n\n#### `ray.intersectsSphere(center, radius)`\n\nWhether this ray intersects with the sphere at `center` [x, y, z] and `radius`.\n\n#### `ray.intersectsTriangle(triangle)`\n\nWhether this ray intersects with the `triangle`:\n\n```\n[ [x1, y1, z1], [x2, y2, z2], [x3, y3, z3] ]\n```\n\n#### `ray.intersectsTriangleCell(cell, positions)`\n\nWhether this ray intersects with the triangle cell, where `cell` is a face like so:\n\n```\n[ a, b, c ]\n```\n\nWhere `[ a, b, c ]` are indices into the `positions` array:\n\n```\n[ [x1, y1, z1], [x2, y2, z2] ... ]\n```\n\nThis is useful for indexed meshes and simplicial complexes like [icosphere](https://www.npmjs.com/package/icosphere).\n\n#### `ray.intersectsBox(aabb)`\n\nWhether this ray intersects with the [Axis-Aligned Bounding Box](http://www.gamasutra.com/view/feature/131833/when_two_hearts_collide_.php) `aabb`:\n\n```\n[ [x1, y1, z1], [x2, y2, z2] ]\n```\n\n## See Also\n\n- [camera-unproject](https://www.npmjs.com/package/camera-unproject)\n- [camera-project](https://www.npmjs.com/package/camera-project)\n- [camera-picking-ray](https://www.npmjs.com/package/camera-picking-ray)\n- [ray-sphere-intersection](https://www.npmjs.com/package/ray-sphere-intersection)\n- [ray-plane-intersection](https://www.npmjs.com/package/ray-plane-intersection)\n- [ray-triangle-intersection](https://www.npmjs.com/package/ray-triangle-intersection)\n- [ray-aabb-intersection](https://www.npmjs.com/package/ray-aabb-intersection)\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/Jam3/ray-3d/blob/master/LICENSE.md) for details.\n","maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"time":{"modified":"2022-06-25T13:44:36.467Z","created":"2015-05-15T17:18:22.543Z","1.0.0":"2015-05-15T17:18:22.543Z","1.0.1":"2015-05-15T17:19:21.140Z","1.0.2":"2015-05-15T17:20:38.677Z","1.1.0":"2015-10-04T19:42:44.180Z","1.1.1":"2015-12-23T16:27:45.729Z"},"homepage":"https://github.com/Jam3/ray-3d","keywords":["pick","picking","ray","camera","unproject","project","hit","test","collision","intersect","intersection","intersects","mouse","touch"],"repository":{"type":"git","url":"git://github.com/Jam3/ray-3d.git"},"author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"bugs":{"url":"https://github.com/Jam3/ray-3d/issues"},"license":"MIT","readmeFilename":"README.md"}