{"_id":"sat","_rev":"17-e407601fac29daca8d218c879e694852","name":"sat","description":"Library for performing 2D collision detection","dist-tags":{"latest":"0.9.0"},"versions":{"0.4.1":{"name":"sat","description":"Library for performing 2D collision detection","version":"0.4.1","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["collision detection","sat","game"],"license":{"type":"MIT","url":"http://github.com/jriecken/sat-js/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/jriecken/sat-js.git"},"bugs":{"url":"http://github.com/jriecken/sat-js/issues"},"main":"SAT.js","gitHead":"b5fef71f2b88f39674da7c4ae6a87933c97d1a49","homepage":"https://github.com/jriecken/sat-js","_id":"sat@0.4.1","scripts":{},"_shasum":"aadf128dba259f5cc6273cbdfb48821e127256fa","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"dist":{"shasum":"aadf128dba259f5cc6273cbdfb48821e127256fa","tarball":"https://registry.npmjs.org/sat/-/sat-0.4.1.tgz","integrity":"sha512-Bw7DSpDaoVKgXImjZQdA2nGdd+P7Vv+0ZZ9NOIYbBgodfKpM55SPK/TednVn5cKkolXgGIU06ZhQY5eBYOaO2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFqJBuqFifWkpbLAp085fiOBstyh5lyhj7FMpWfMG5NQIgC4wHe51xGK5UpYclsW0k6cz5s09WsMIfMzyPR1UDhEQ="}]},"directories":{}},"0.5.0":{"name":"sat","description":"Library for performing 2D collision detection","version":"0.5.0","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["collision detection","sat","game"],"license":{"type":"MIT","url":"http://github.com/jriecken/sat-js/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/jriecken/sat-js.git"},"bugs":{"url":"http://github.com/jriecken/sat-js/issues"},"main":"SAT.js","gitHead":"91d474629862bcca1079cec1bc60d1f9fa344a0e","homepage":"https://github.com/jriecken/sat-js","_id":"sat@0.5.0","scripts":{},"_shasum":"f74940d2c8aefdaff570798d4ecd802e5aceaac1","_from":".","_npmVersion":"2.1.14","_nodeVersion":"0.10.35","_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"dist":{"shasum":"f74940d2c8aefdaff570798d4ecd802e5aceaac1","tarball":"https://registry.npmjs.org/sat/-/sat-0.5.0.tgz","integrity":"sha512-Oq8fK0G6D3PvYC80i1RALj+2G+WELDSfTZobXMmloCe4vRiCwD86yotcj87Rhq6QYwncf/63uHRR3j/TL74yfg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGiBgrYjpbHf1GYOLbAFqPrGYgffGQnDilApNw3I49yIAiEA2yw5iPe6C5o0qIkL0EiuvuU3iPV4mDqDzTB2/CalLjw="}]},"directories":{}},"0.6.0":{"name":"sat","description":"Library for performing 2D collision detection","version":"0.6.0","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["collision detection","sat","game"],"license":{"type":"MIT","url":"http://github.com/jriecken/sat-js/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/jriecken/sat-js.git"},"bugs":{"url":"http://github.com/jriecken/sat-js/issues"},"scripts":{"test":"mocha"},"main":"SAT.js","devDependencies":{"mocha":"^2.1.0"},"gitHead":"c397cbf874840ec5eb08b56b2208f5495b8276f3","homepage":"https://github.com/jriecken/sat-js#readme","_id":"sat@0.6.0","_shasum":"359bf022d765d7b96be7e08c74375791d8df3784","_from":".","_npmVersion":"2.14.9","_nodeVersion":"0.12.9","_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"dist":{"shasum":"359bf022d765d7b96be7e08c74375791d8df3784","tarball":"https://registry.npmjs.org/sat/-/sat-0.6.0.tgz","integrity":"sha512-cdaIgHfjxVtVJXWiNnqqgKl3sG4qqJGGjLRZNR4WRj6MRfaM0iZzstycF4wC5kynwyEeUjd7PCVmjTP3EmgPsg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCn6eZJFFrNNi+mg2FCgr55djMtIlLH2JTVi1zUk8K84AIgWC1+cNsiPlUtyh6dFMyysh0PadRGL5Z0qoW5jDeKKmQ="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/sat-0.6.0.tgz_1473613715913_0.38690165081061423"},"directories":{}},"0.7.0":{"name":"sat","description":"Library for performing 2D collision detection","version":"0.7.0","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["collision detection","sat","game"],"license":{"type":"MIT","url":"http://github.com/jriecken/sat-js/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/jriecken/sat-js.git"},"bugs":{"url":"http://github.com/jriecken/sat-js/issues"},"scripts":{"test":"mocha"},"main":"SAT.js","devDependencies":{"mocha":"^2.1.0"},"gitHead":"e521cecf3c99093e9d9d85ecc74c07b52ce86059","homepage":"https://github.com/jriecken/sat-js#readme","_id":"sat@0.7.0","_npmVersion":"5.5.1","_nodeVersion":"6.11.5","_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"dist":{"integrity":"sha512-5bwee+SsMLErsQUFZefoEwGFpuKC4QdV5cS/W6r4JEbhcFFnDnSMVCguVd+6J7eaAlEN80oUX1P2KFIcSx9WUQ==","shasum":"1efbae96a5e4d360b429107ea126fe4f0c96c687","tarball":"https://registry.npmjs.org/sat/-/sat-0.7.0.tgz","fileCount":10,"unpackedSize":71049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCt/tzRqbgduPLVw+Trk9/unzFPin4aDNH/IM6h1qQkZQIhAPwSm860SbX7QS/04M/iDDtWG7FJE95mlXDrVdnm0YZs"}]},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sat_0.7.0_1518894819559_0.2976607445651569"},"_hasShrinkwrap":false},"0.7.1":{"name":"sat","description":"Library for performing 2D collision detection","version":"0.7.1","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["collision detection","sat","game"],"license":{"type":"MIT","url":"http://github.com/jriecken/sat-js/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/jriecken/sat-js.git"},"bugs":{"url":"http://github.com/jriecken/sat-js/issues"},"scripts":{"test":"mocha"},"main":"SAT.js","devDependencies":{"mocha":"^2.1.0"},"gitHead":"fa149e91eb5a10b9b5ce3b328a22f0be1ff0e539","homepage":"https://github.com/jriecken/sat-js#readme","_id":"sat@0.7.1","_npmVersion":"5.8.0","_nodeVersion":"8.10.0","_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"dist":{"integrity":"sha512-YFkI+KMARdAxqIVSS79TaTdPLOWFWeWe/J+A7Rc4xBNn7lxuqWGJs9YmZURaipMjWAM9FLK3s4W1+yEdFu3/5w==","shasum":"fe1806b2c677fc2eec9943649ad187871f18f9ea","tarball":"https://registry.npmjs.org/sat/-/sat-0.7.1.tgz","fileCount":10,"unpackedSize":72016,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBiBiCRA9TVsSAnZWagAA30cP/iOeGFuPYfUzh4r4T7QK\nm+AqXCw5nOJPxy2uswV1jy0wHEgAkyRIJZ1sanzOmphZHQXcOTboDzlqdVwL\nBjZKBxxZYB8hfYqBkOmgvUANhY3060dUMWP9hFcuFQI5TEbpQZXJchqHC6Mr\n6V6qB2FL2EnPJye7QZbPbOW787soRQKXC5tuQOVcYugfTZL19O5OHRheFF4W\nO7e3Ob9kZXYlZkVPJ7JGdlo72wRBv9aAucDD4OpdufLgZiprFGTvLgTCC/8O\nD74L90RdBHWTomlYKWO0AkFwx6WbdHjjTD0rpX0VUYInoYPQ9+PZ37dOfuG9\nSDo2uamYJEwpVFr0h3yoIQ1sLbhf2258pHqKL1suEyoggFD2xX2Wq2S/HiDm\nFuvBwhjT0iRo9zXoICw7MqKSQWkr26vRQXOAzQQOODYQUQfppI1TLUV37cIh\ngiQxn0INFljq9uU5OGEcpWEkIcBncDT+iO14WMWNiqdU1hYmnyiQs9dDb1Ck\nBoQnCZ7TqbEI4VZvjyf83NxALxSpGfJ1BnOOO+xf9y3fX915sp3wMMejCchZ\n6IP6A/lpYr843NW21xM3tfFRnMW+/DewByIF9utYsJVyxCloQa91pHMkO0rD\nXEJpdv0ncjHPdUVArpIF3dAN4vv3I67PQMJp+k+aipVfNuZG9u4CtFmn/KW9\nAmTo\r\n=r1TT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD6B/JH2hdtyLqxCiyuiqOMbbtMD31AvPfrlkVPW44bKgIgUFX4kw8wpFMIbDMjKs7d62420KSl71bWKtB24DhDSfo="}]},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sat_0.7.1_1527128160863_0.8948155001688669"},"_hasShrinkwrap":false},"0.8.0":{"name":"sat","description":"Library for performing 2D collision detection","version":"0.8.0","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["collision detection","sat","game"],"license":"MIT","repository":{"type":"git","url":"git://github.com/jriecken/sat-js.git"},"bugs":{"url":"http://github.com/jriecken/sat-js/issues"},"scripts":{"test":"mocha"},"main":"SAT.js","devDependencies":{"mocha":"^2.1.0"},"gitHead":"f45fc59a687c144d4130dd80d4e0565c4f9b4f1a","homepage":"https://github.com/jriecken/sat-js#readme","_id":"sat@0.8.0","_nodeVersion":"10.16.3","_npmVersion":"6.11.3","dist":{"integrity":"sha512-W0iWln+43pb+74lxcYW24BrueFMMefdqHvHxGQ/W0NemnyBXrV0oE23kGNjPRgwIoTuodYIH3ul2jqLrf4VGSA==","shasum":"eae1e36c96551f7b2fb884eee8ffb4d0e895a667","tarball":"https://registry.npmjs.org/sat/-/sat-0.8.0.tgz","fileCount":9,"unpackedSize":68441,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdc9jeCRA9TVsSAnZWagAAkiYP/1+WxMfay6iVgqflFBid\nFdwySjPYRLf6SQHqMBb3bH3uFE8sUWPIj2Mb69Cx4SRbfpiuyFV2puXZQPpZ\nUnoEtO7khkQkvI8KADxmzMkGswt1CFi8yI3zj+ynSSusczcqUUDO73XmpccI\noZma9E7hQ9A+kC1oJ+MQ7UIiYQs4TQZfNpbrLQ0McLjWEv6g2xD8vJc1zEet\nj0e8rs2r7sZca/NWmBA6/K9SBcn1n6hqvfOM/eRh//uU1p6bG2UmyLGFZWj+\ndUzydVyj6pCS7u0f13BShNW3qXukSFitPbhMeWxSkVDU6g5DyT8wbd05/LzS\nxI9mrmJvx7Ax3QNayYJuDn/onSFtabyjWyQFZ9+65wko9Ob4MoNAT8zFqlVP\nEKLUr7V8h0dKL42n6hjH3KBYvCXrKcmfjFqnv0WAI7mT9ZkbKJXAnT/TUW+/\nRM5LU9e6oCbBelhGr6ddHqTcIoaHaaRSA6El+RxTklMmjt34vvzDcV0kx6DB\noTDJrR87anIVRCQe+XaX/7eiuw39AYO4GhxBfVKTpYSZXgxe65LMXNRVKm5t\nTxwwyCVNHOTecaVkrI/sPnKQefn8O/7HHCdeyBsGmVAvic32LkMvii3yJfGq\ni8axMrpDgkKjzMH6LHEXGa8FCIVk++ET9/7gv3cqRl9qo113HFVZCU3+6V53\nO2/Z\r\n=HE4l\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBzVh8cK06ZYhlE7VZ97CPKAYHu73Mn+OpgDBxQdfQCBAiEA41EP4y4X4ddVq5kUjNwOUSHiczMX+lUcwmX+JWaQrf0="}]},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sat_0.8.0_1567873246094_0.44898573881935855"},"_hasShrinkwrap":false},"0.9.0":{"name":"sat","description":"Library for performing 2D collision detection","version":"0.9.0","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["collision detection","sat","game"],"license":"MIT","repository":{"type":"git","url":"git://github.com/jriecken/sat-js.git"},"bugs":{"url":"http://github.com/jriecken/sat-js/issues"},"scripts":{"test":"mocha"},"main":"SAT.js","devDependencies":{"mocha":"^2.1.0"},"gitHead":"20e612681d1f9eabc9ea34dc98c4d27f985ffec6","homepage":"https://github.com/jriecken/sat-js#readme","_id":"sat@0.9.0","_nodeVersion":"14.16.0","_npmVersion":"7.6.0","dist":{"integrity":"sha512-mxdv5RZJO4tdMnUURGU3gAMcnDUEwcNJwE+lPO0/V+rBeDvFLH3wEZEOR0fH7cTN0zQaNxBEbHnyQL9DzupwQQ==","shasum":"02091260513c8f2482da7db9377ddfeca80f5982","tarball":"https://registry.npmjs.org/sat/-/sat-0.9.0.tgz","fileCount":9,"unpackedSize":69684,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgaofpCRA9TVsSAnZWagAAm2gP/2ezcO0XBkBuKgwpOZdB\nfN30g1Ld3pZpMreeFe9BfS3KLG4n8nfHTHIqhq9Z3kUkOsVWCpMRnH5agb8v\nWD27XXBJsRPuqIiddSeU16lJGGj7zO+OpCHPMvOVe/QRowt/9VNWpXnnwVMd\nzc05jLGEdbIHznonPA06nnpXwPpId3JAGMc4D8UnHG8w6oTbS3wMldnNYOjW\nHxe+zWboR4/BWE79qTlp/K+Bn0q/1/JbR+N7J/kjIA192QBvlftO2z1fTlGT\n70Sna6MmzOo50exUGpl1SxbHF/7Oz2HJD9Qqs7nSfLBwRohh2NbNfyfXWMnC\nNXM2v1nw1RmGTJXhQkDkJ8QoGwCKlSttIricmp3H8rB3F8Bhu9VNP+whXwTm\ndUbv+AKKNQe9q1uF9ts+F8gFqFMFuTaNUJ9TInHwcx7rp1GX1nV3EQrEf9iK\ntq7Zjqe7U9yXa/L4P1rOTSqjPUuav9pip0rPRHrYptWIikPQheYviasbnonH\nWRuk0NubWxNXozW4bhqjxl75xm+Sb2/tI7LisfRe7FlL593J1hof+KKv/7U4\nDYs16ZOAsInH62hax0yYMs1K0i+Z8GqWjh5dINH8T9Ht8xyRLUFF6KOKvV5h\nWA5LuDxIlZSYmXrSBpv1mTMQwzBYl+hJG4JTby8fOE0/oy1KLnPD+G7ViD5x\nJ9qF\r\n=z3lg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICt5jGPt/cyQgfB+lI1Rjpx+3hDOb6h0nuSJAQDQYgYcAiEA+kmx+CHqzVMh695K5jhWyP/Be3V3gQ9aWyuGWqpGKfk="}]},"_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"directories":{},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sat_0.9.0_1617594344861_0.6890213945623498"},"_hasShrinkwrap":false}},"readme":"# SAT.js\n\n - [Classes](#classes)\n - [Collision Tests](#collision-tests)\n - [Examples](#examples)\n\n## About\n\nSAT.js is a simple JavaScript library for performing collision detection (and projection-based collision response) of simple 2D shapes.  It uses the [Separating Axis Theorem](http://en.wikipedia.org/wiki/Hyperplane_separation_theorem) (hence the name)\n\nIt supports detecting collisions between:\n - Circles (using Voronoi Regions.)\n - Convex Polygons (and simple Axis-Aligned Boxes, which are of course, convex polygons.)\n\nIt also supports checking whether a point is inside a circle or polygon.\n\nIt's released under the [MIT](http://en.wikipedia.org/wiki/MIT_License) license.\n\nCurrent version: `0.9.0`.\n\nNicely compresses with the [Google Closure Compiler](https://developers.google.com/closure/compiler/) in **Advanced** mode to about 6KB (2KB gzipped)\n\nTo use it in node.js, you can run `npm install sat` and then use it with `var SAT = require('sat');`\n\n## Classes\n\nSAT.js contains the following JavaScript classes:\n\n### SAT.Vector (aliased as SAT.V)\n\nThis is a simple 2D vector/point class.  It is created by calling:\n```javascript\n// Create the vector (10,10) - If (x,y) not specified, defaults to (0,0).\nvar v = new SAT.Vector(10, 10)\n```\n\nIt has the following properties:\n\n - `x` - The x-coordinate of the Vector.\n - `y` - The y-coordinate of the Vector.\n\nIt contains the following methods:\n\n - `copy(other)` - Copy the value of another Vector to this one.\n - `clone()` - Return a new vector with the same coordinates as this one.\n - `perp()` - Change this vector to be perpendicular to what it was before.\n - `rotate(angle)` - Rotate this vector counter-clockwise by the specified number of radians.\n - `reverse()` - Reverse this Vector.\n - `normalize()` - Make the Vector unit-lengthed.\n - `add(other)` - Add another Vector to this one.\n - `sub(other)` - Subtract another Vector from this one.\n - `scale(x,y)` - Scale this Vector in the X and Y directions.\n - `project(other)` - Project this Vector onto another one.\n - `projectN(other)` - Project this Vector onto a unit Vector.\n - `reflect(axis)` - Reflect this Vector on an arbitrary axis Vector.\n - `reflectN(axis)` - Reflect this Vector on an arbitrary axis unit Vector.\n - `dot(other)` - Get the dot product of this Vector and another.\n - `len2()` - Get the length squared of this Vector.\n - `len()` - Get the length of this Vector\n\n### SAT.Circle\n\nThis is a simple circle with a center position and a radius.  It is created by calling:\n```javascript\n// Create a circle whose center is (10,10) with radius of 20\nvar c = new SAT.Circle(new SAT.Vector(10,10), 20);\n```\n\nIt has the following properties:\n\n - `pos` - A Vector representing the center of the circle.\n - `r` - The radius of the circle\n - `offset` - Offset of center of circle from `pos`.\n\n It has the following methods:\n\n - `setOffset(offset)` - Set the current offset\n - `getAABB()` - Compute the axis-aligned bounding box. Returns a new Polygon every time it is called.\n - `getAABBAsBox()` - Compute the axis-aligned bounding box. Returns a new Box every time it is called.\n\n### SAT.Polygon\n\nThis is a **convex** polygon, whose points are specified in a counter-clockwise fashion.  It is created by calling:\n```javascript\n// Create a triangle at (0,0)\nvar p = new SAT.Polygon(new SAT.Vector(), [\n  new SAT.Vector(),\n  new SAT.Vector(100,0),\n  new SAT.Vector(50,75)\n]);\n```\n\nNote: The points are counter-clockwise *with respect to the coordinate system*. If you directly draw the points on a screen that has the origin at the top-left corner it will _appear_ visually that the points are being specified clockwise. This is just because of the inversion of the Y-axis when being displayed.\n\nYou can create a line segment by creating a `Polygon` that contains only 2 points.\n\nAny identical consecutive points will be combined. (this can happen if you convert a `Box` with zero width or height into a `Polygon`)\n\nIt has the following properties:\n\n - `pos` - The position of the polygon (all points are relative to this).\n - `points` - Array of vectors representing the original points of the polygon.\n - `angle` - Angle to rotate the polgon (affects `calcPoints`)\n - `offset` - Translation to apply to the polygon before the `angle` rotation (affects `calcPoints`)\n - `calcPoints` - (Calculated) The collision polygon - effectively `points` with `angle` and `offset` applied.\n - `edges` - (Calculated) Array of Vectors representing the edges of the calculated polygon\n - `normals` - (Calculated) Array of Vectors representing the edge normals of the calculated polygon (perpendiculars)\n\nYou should _not_ manually change any of the properties except `pos` - use the `setPoints`, `setAngle`, and `setOffset` methods to ensure that the calculated properties are updated correctly.\n\nIt has the following methods:\n\n - `setPoints(points)` - Set the original points\n - `setAngle(angle)` - Set the current rotation angle (in radians)\n - `setOffset(offset)` - Set the current offset\n - `rotate(angle)` - Rotate the original points of this polygon counter-clockwise (around its local coordinate system) by the specified number of radians. The `angle` rotation will be applied on top of this rotation.\n - `translate(x, y)` - Translate the original points of this polygon (relative to the local coordinate system) by the specified amounts. The `offset` translation will be applied on top of this translation.\n - `getAABB()` - Compute the axis-aligned bounding box. Returns a new Polygon every time it is called. Is performed based on the `calcPoints`.\n - `getAABBAsBox()` - Compute the axis-aligned bounding box. Returns a new Box every time it is called. Is performed based on the `calcPoints`.\n - `getCentroid()` - Compute the [Centroid](https://en.wikipedia.org/wiki/Centroid#Centroid_of_a_polygon) of the polygon. Is performed based on the `calcPoints`.\n\n### SAT.Box\n\nThis is a simple Box with a position, width, and height.  It is created by calling:\n```javascript\n// Create a box at (10,10) with width 20 and height 40.\nvar b = new SAT.Box(new SAT.Vector(10,10), 20, 40);\n```\n\nIt has the following properties:\n\n - `pos` - The bottom-left coordinate of the box (i.e the smallest `x` value and the smallest `y` value).\n - `w` - The width of the box.\n - `h` - The height of the box.\n\nIt has the following methods:\n\n - `toPolygon()` - Returns a new Polygon whose edges are the edges of the box.\n\n### SAT.Response\n\nThis is the object representing the result of a collision between two objects.  It just has a simple `new Response()` constructor.\n\nIt has the following properties:\n\n - `a` - The first object in the collision.\n - `b` - The second object in the collison.\n - `overlap` - Magnitude of the overlap on the shortest colliding axis.\n - `overlapN` - The shortest colliding axis (unit-vector)\n - `overlapV` - The overlap vector (i.e. `overlapN.scale(overlap, overlap)`).  If this vector is subtracted from the position of `a`, `a` and `b` will no longer be colliding.\n - `aInB` - Whether the first object is completely inside the second.\n - `bInA` - Whether the second object is completely inside the first.\n\nIt has the following methods:\n\n- `clear()` - Clear the response so that it is ready to be reused for another collision test.\n\nNote: The `clear`ed value for a `Response` has what may seem to be strange looking values:\n\n```javascript\n{\n  a: null,\n  b: null,\n  overlap: 1.7976931348623157e+308,\n  overlapV: Vector(0, 0),\n  overlapN: Vector(0, 0),\n  aInB: true,\n  bInA: true\n}\n```\n\nThese just make calculating the response simpler in the collision tests. If the collision test functions return `false` the values that are in the response should not be examined, and `clear()` should be called before using it for another collision test.\n\n## Collision Tests\n\nSAT.js contains the following collision tests:\n\n### `SAT.pointInCircle(p, c)`\n\nChecks whether a given point is inside the specified circle.\n\n### `SAT.pointInPolygon(p, poly)`\n\nChecks whether a given point is inside a specified convex polygon.\n\n### `SAT.testCircleCircle(a, b, response)`\n\nTests for a collision between two `Circle`s, `a`, and `b`.  If a response is to be calculated in the event of collision, pass in a `clear`ed `Response` object.\n\nReturns `true` if the circles collide, `false` otherwise.\n\nIf it returns `false` you should not use any values that are in the `response` (if one is passed in)\n\n### `SAT.testPolygonCircle(polygon, circle, response)`\n\nTests for a collision between a `Polygon` and a `Circle`.  If a response is to be calculated in the event of a collision, pass in a `clear`ed `Response` object.\n\nReturns `true` if there is a collision, `false` otherwise.\n\nIf it returns `false` you should not use any values that are in the `response` (if one is passed in)\n\n### `SAT.testCirclePolygon(circle, polygon, response)`\n\nThe same thing as `SAT.testPolygonCircle`, but in the other direction.\n\nReturns `true` if there is a collision, `false` otherwise.\n\nIf it returns `false` you should not use any values that are in the `response` (if one is passed in)\n\n*Note: This is slightly slower than `SAT.testPolygonCircle` as it just calls that and reverses the result*\n\n### `SAT.testPolygonPolygon(a, b, response)`\n\nTests whether two polygons `a` and `b` collide. If a response is to be calculated in the event of collision, pass in a `clear`ed `Response` object.\n\nReturns `true` if there is a collision, `false` otherwise.\n\nIf it returns `false` you should not use any values that are in the `response` (if one is passed in)\n\n*Note: If you want to detect a collision between `Box`es, use the `toPolygon()` method*\n\n## Examples\n\nTest two circles\n```javascript\nvar V = SAT.Vector;\nvar C = SAT.Circle;\n\nvar circle1 = new C(new V(0,0), 20);\nvar circle2 = new C(new V(30,0), 20);\nvar response = new SAT.Response();\nvar collided = SAT.testCircleCircle(circle1, circle2, response);\n\n// collided => true\n// response.overlap => 10\n// response.overlapV => (10, 0)\n```\n\nTest a circle and a polygon\n```javascript\nvar V = SAT.Vector;\nvar C = SAT.Circle;\nvar P = SAT.Polygon;\n\nvar circle = new C(new V(50,50), 20);\n// A square\nvar polygon = new P(new V(0,0), [\n  new V(0,0), new V(40,0), new V(40,40), new V(0,40)\n]);\nvar response = new SAT.Response();\nvar collided = SAT.testPolygonCircle(polygon, circle, response);\n\n// collided => true\n// response.overlap ~> 5.86\n// response.overlapV ~> (4.14, 4.14) - i.e. on a diagonal\n```\n\nTest two polygons\n```javascript\nvar V = SAT.Vector;\nvar P = SAT.Polygon;\n\n// A square\nvar polygon1 = new P(new V(0,0), [\n  new V(0,0), new V(40,0), new V(40,40), new V(0,40)\n]);\n// A triangle\nvar polygon2 = new P(new V(30,0), [\n  new V(0,0), new V(30, 0), new V(0, 30)\n]);\nvar response = new SAT.Response();\nvar collided = SAT.testPolygonPolygon(polygon1, polygon2, response);\n\n// collided => true\n// response.overlap => 10\n// response.overlapV => (10, 0)\n```\n\nNo collision between two Boxes\n```javascript\nvar V = SAT.Vector;\nvar B = SAT.Box;\n\nvar box1 = new B(new V(0,0), 20, 20).toPolygon();\nvar box2 = new B(new V(100,100), 20, 20).toPolygon();\nvar collided = SAT.testPolygonPolygon(box1, box2);\n\n// collided => false\n```\n\nHit testing a circle and polygon\n```javascript\nvar V = SAT.Vector;\nvar C = SAT.Circle;\nvar P = SAT.Polygon;\n\nvar triangle = new P(new V(30,0), [\n  new V(0,0), new V(30, 0), new V(0, 30)\n]);\nvar circle = new C(new V(100,100), 20);\n\nSAT.pointInPolygon(new V(0,0), triangle); // false\nSAT.pointInPolygon(new V(35, 5), triangle); // true\nSAT.pointInCircle(new V(0,0), circle); // false\nSAT.pointInCircle(new V(110,110), circle); // true\n```\n\n## Tests\n\nTo run the tests from your console:\n\n```\nnpm install\nnpm run test\n```\n","maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"time":{"modified":"2022-06-26T16:09:16.880Z","created":"2014-07-08T03:08:49.644Z","0.4.1":"2014-07-08T03:08:49.644Z","0.5.0":"2014-12-26T23:01:04.216Z","0.6.0":"2016-09-11T17:08:38.617Z","0.7.0":"2018-02-17T19:13:39.662Z","0.7.1":"2018-05-24T02:16:00.924Z","0.8.0":"2019-09-07T16:20:46.249Z","0.9.0":"2021-04-05T03:45:44.986Z"},"homepage":"https://github.com/jriecken/sat-js#readme","keywords":["collision detection","sat","game"],"repository":{"type":"git","url":"git://github.com/jriecken/sat-js.git"},"author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"bugs":{"url":"http://github.com/jriecken/sat-js/issues"},"license":"MIT","readmeFilename":"README.md","users":{"kael":true,"kevzettler":true,"asfktz":true,"raymond-h":true,"fearnbuster":true}}