{"_id":"ray-sphere-intersection","_rev":"812871","name":"ray-sphere-intersection","description":"test whether a ray intersects with a sphere","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"time":{"modified":"2024-07-02T14:02:02.000Z","created":"2015-05-15T13:44:28.833Z","1.0.0":"2015-05-15T13:44:28.833Z"},"users":{},"author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"repository":{"type":"git","url":"git://github.com/mattdesl/ray-sphere-intersection.git"},"versions":{"1.0.0":{"name":"ray-sphere-intersection","version":"1.0.0","description":"test whether a ray intersects with a sphere","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"},"devDependencies":{"tape":"^4.0.0"},"scripts":{"test":"node test.js"},"keywords":["sphere","intersect","ray","origin","direction","test","hit","pick","ray","picking","camera","project","unproject","collision","intersections"],"repository":{"type":"git","url":"git://github.com/mattdesl/ray-sphere-intersection.git"},"homepage":"https://github.com/mattdesl/ray-sphere-intersection","bugs":{"url":"https://github.com/mattdesl/ray-sphere-intersection/issues"},"gitHead":"f3d5ff5928f57adb3a512b37bbdedb6e2e47fff5","_id":"ray-sphere-intersection@1.0.0","_shasum":"7f233d1d4dbaf5265757c9826532f53b1e4eeaca","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.32","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"7f233d1d4dbaf5265757c9826532f53b1e4eeaca","tarball":"http://registry-npm.ywwl.com/ray-sphere-intersection/download/ray-sphere-intersection-1.0.0.tgz","integrity":"sha512-rjoi1dz5hIThzJGPzcU64YqwVsWDh9nqhSgka2UfXP/WirJLWXbNcVW91Jy0GfJZNaZknxkC/ipIm5wBSxwccA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDfC8Cvj9hVX+u0mk1mbnOjePaxXODxIosS8AnMXzqpiAIgUtEPqShOarzndIWJLRfKPUgyZxDIe3zmFIrL3qwS5zI="}],"size":1965,"noattachment":false,"key":"/ray-sphere-intersection/-/ray-sphere-intersection-1.0.0.tgz"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"directories":{},"publish_time":1431697468833,"_cnpm_publish_time":1431697468833}},"readme":"# ray-sphere-intersection\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nTest whether a ray intersects with a sphere.\n\n```js\nvar intersect = require('ray-sphere-intersection')\n\nvar origin = [0, 0, 4], \n    direction = [0, 0, -1], \n    center = [0, 0, 0], \n    radius = 1\n\nvar hit = intersect([], origin, direction, center, radius)\n\nif (hit) {\n  console.log(hit) // [0, 0, 1]\n}\n```\n\nAdapted from [LibGDX](https://github.com/libgdx/libgdx/blob/9eba80c6694160c743e43d4c3a5d60a5bad06f30/gdx/src/com/badlogic/gdx/math/Intersector.java). PRs for optimizations/etc welcome.\n\n## Usage\n\n[![NPM](https://nodei.co/npm/ray-sphere-intersection.png)](https://www.npmjs.com/package/ray-sphere-intersection)\n\n#### `out = intersect(out, origin, direction, center, radius)`\n\nDetermines if the 3D ray `(origin, direction)` intersects with the 3D sphere `(center, radius)`. \n\nIf no intersection occurs, returns `null`. Otherwise, the intersection point is stored in `out` and then returned.\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/ray-sphere-intersection/blob/master/LICENSE.md) for details.\n","_attachments":{},"homepage":"https://github.com/mattdesl/ray-sphere-intersection","bugs":{"url":"https://github.com/mattdesl/ray-sphere-intersection/issues"},"license":"MIT"}