{"_id":"2d-geometry","_rev":"7-65cd77e7875db04cb938c6975985e39e","name":"2d-geometry","description":"Performant & ergonomic 2D geometry in typescript","dist-tags":{"latest":"3.0.0"},"versions":{"0.2.0":{"name":"2d-geometry","version":"0.2.0","keywords":["geometry","2d","algorithms","shape","polygon","distance","intersection","relation","point in polygon","spatial search","affine transformations","boolean operations","polygon clipping","dimensionally extended 9-intersections model"],"author":{"url":"https://github.com/romgrk","name":"romgrk"},"license":"MIT","_id":"2d-geometry@0.2.0","maintainers":[{"name":"romgrk","email":"romgrk.cc@gmail.com"}],"homepage":"https://github.com/romgrk/2d-geometry","bugs":{"url":"https://github.com/romgrk/2d-geometry/issues"},"dist":{"shasum":"91c52480e0c53ce80b39e585ead3510c6a2f051d","tarball":"https://registry.npmjs.org/2d-geometry/-/2d-geometry-0.2.0.tgz","fileCount":192,"integrity":"sha512-UcJWsvKSncw7WMBLgTUEVHSMqhhxNQjnMy/pMF5QvVE52DUS6I5bpY8Pq6XRa8cp5/cbT8pz+NE537hIolRitw==","signatures":[{"sig":"MEUCIAPkz+byY8aYFXet+pImBx+JrdziRoWmGNGBFDxjQAT4AiEAk/xti/kWYutCo5sU+qUu6VconD17sIRLw3SnU0O1/dw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1075618},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=4.2.4"},"gitHead":"a13c100c233b9b7c2b1920a7051e6daa5530da44","scripts":{"test":"cross-env NODE_ENV=test nyc --reporter=text --reporter=html mocha --recursive","build":"tsc","start":"tsc -w","prepare":"npm run build","publish-npm":"npm publish --access public","create-patch":"npm version patch && git push —-tags origin master","generate-docs":"jsdoc -c ./.jsdoc.json --verbose"},"_npmUser":{"name":"romgrk","email":"romgrk.cc@gmail.com"},"repository":{"url":"git+https://github.com/romgrk/2d-geometry.git","type":"git"},"_npmVersion":"10.2.3","description":"Javascript library for 2d geometry","directories":{},"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.2.0","jsdoc":"^3.6.3","mocha":"^8.2.1","minami":"^1.2.3","rollup":"^3.25.1","coveralls":"^3.0.3","cross-env":"^5.2.0","@babel/cli":"^7.2.3","typescript":"^5.2.2","@babel/core":"^7.22.9","@babel/node":"^7.2.2","@babel/register":"^7.18.9","@babel/preset-env":"^7.3.1","babel-plugin-istanbul":"^5.1.1","@rollup/plugin-node-resolve":"^15.1.0"},"_npmOperationalInternal":{"tmp":"tmp/2d-geometry_0.2.0_1711812518226_0.5359434513096191","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"2d-geometry","version":"2.0.0","keywords":["geometry","2d","algorithms","shape","polygon","distance","intersection","relation","point in polygon","spatial search","affine transformations","boolean operations","polygon clipping","dimensionally extended 9-intersections model"],"author":{"url":"https://github.com/romgrk","name":"romgrk"},"license":"MIT","_id":"2d-geometry@2.0.0","maintainers":[{"name":"romgrk","email":"romgrk.cc@gmail.com"}],"homepage":"https://github.com/romgrk/2d-geometry","bugs":{"url":"https://github.com/romgrk/2d-geometry/issues"},"dist":{"shasum":"753f9c029bc05be67beecea0064b51aa3e7dc127","tarball":"https://registry.npmjs.org/2d-geometry/-/2d-geometry-2.0.0.tgz","fileCount":192,"integrity":"sha512-GVLv/oNHVs8Ahm++wRRu3z4FMxvz/1glk5cCRykW4AZu/RbEgshBWHvrAc5JGr3h8W5T9O9C1+VfyPhQs39iXg==","signatures":[{"sig":"MEYCIQCXHabEipg9ggcxMG/r7tvZV6OI5XrAksTYchrqKgFJ9AIhAJoJY0xN7B8nEDNbyrfS3rRHyaxRQF4/eVheQXJatq5T","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1074951},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=4.2.4"},"gitHead":"1a657326f768fc23e22f1a8cd35dbd020f92e406","scripts":{"test":"cross-env NODE_ENV=test nyc --reporter=text --reporter=html mocha --recursive","build":"tsc","start":"tsc -w","prepare":"npm run build","publish-npm":"npm publish --access public","create-patch":"npm version patch && git push —-tags origin master","generate-docs":"jsdoc -c ./.jsdoc.json --verbose"},"_npmUser":{"name":"romgrk","email":"romgrk.cc@gmail.com"},"repository":{"url":"git+https://github.com/romgrk/2d-geometry.git","type":"git"},"_npmVersion":"10.2.3","description":"Javascript library for 2d geometry","directories":{},"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.2.0","jsdoc":"^3.6.3","mocha":"^8.2.1","minami":"^1.2.3","rollup":"^3.25.1","coveralls":"^3.0.3","cross-env":"^5.2.0","@babel/cli":"^7.2.3","typescript":"^5.2.2","@babel/core":"^7.22.9","@babel/node":"^7.2.2","@babel/register":"^7.18.9","@babel/preset-env":"^7.3.1","babel-plugin-istanbul":"^5.1.1","@rollup/plugin-node-resolve":"^15.1.0"},"_npmOperationalInternal":{"tmp":"tmp/2d-geometry_2.0.0_1711812843597_0.43529523601690845","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"2d-geometry","version":"2.0.1","keywords":["geometry","2d","algorithms","shape","polygon","distance","intersection","relation","point in polygon","spatial search","affine transformations","boolean operations","polygon clipping","dimensionally extended 9-intersections model"],"author":{"url":"https://github.com/romgrk","name":"romgrk"},"license":"MIT","_id":"2d-geometry@2.0.1","maintainers":[{"name":"romgrk","email":"romgrk.cc@gmail.com"}],"homepage":"https://github.com/romgrk/2d-geometry","bugs":{"url":"https://github.com/romgrk/2d-geometry/issues"},"dist":{"shasum":"b254c9aac3a6cea04afbdfc7d82c10657434c5a1","tarball":"https://registry.npmjs.org/2d-geometry/-/2d-geometry-2.0.1.tgz","fileCount":212,"integrity":"sha512-s5hQ+MFPknm52AcA9+uXLlu4Ufv5DhWjHL+bVdOazUVFr4grvvyQ4YzFUQaUYBs7tCylADA+vjNDParJrsWz2A==","signatures":[{"sig":"MEUCIQD7PriFJASegT62KTzEDsQbJ6Wzc1Ktz63DLMzpocyv4gIgQTweg/w2NHDNfrO2+nAS6379PtiGCK9P/1qTPOWqqHE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1125676},"main":"dist/index.js","type":"module","_from":"file:2d-geometry-2.0.1.tgz","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=4.2.4"},"scripts":{"test":"cross-env NODE_ENV=test nyc --reporter=text --reporter=html mocha --recursive","build":"tsc","start":"tsc -w","publish-npm":"npm publish --access public","create-patch":"npm version patch && git push —-tags origin master","generate-docs":"jsdoc -c ./.jsdoc.json --verbose"},"_npmUser":{"name":"romgrk","email":"romgrk.cc@gmail.com"},"_resolved":"/tmp/f9149213cd0d3097fa18f1089e89bbc1/2d-geometry-2.0.1.tgz","_integrity":"sha512-s5hQ+MFPknm52AcA9+uXLlu4Ufv5DhWjHL+bVdOazUVFr4grvvyQ4YzFUQaUYBs7tCylADA+vjNDParJrsWz2A==","repository":{"url":"git+https://github.com/romgrk/2d-geometry.git","type":"git"},"_npmVersion":"10.2.3","description":"Performant & ergonomic 2D geometry in typescript","directories":{},"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.2.0","jsdoc":"^3.6.3","mocha":"^8.2.1","minami":"^1.2.3","rollup":"^3.25.1","coveralls":"^3.0.3","cross-env":"^5.2.0","@babel/cli":"^7.2.3","typescript":"^5.2.2","@babel/core":"^7.22.9","@babel/node":"^7.2.2","@babel/register":"^7.18.9","@babel/preset-env":"^7.3.1","babel-plugin-istanbul":"^5.1.1","@rollup/plugin-node-resolve":"^15.1.0"},"_npmOperationalInternal":{"tmp":"tmp/2d-geometry_2.0.1_1711925147600_0.896118553545378","host":"s3://npm-registry-packages"}},"2.1.0":{"name":"2d-geometry","version":"2.1.0","keywords":["geometry","2d","algorithms","shape","polygon","distance","intersection","relation","point in polygon","spatial search","affine transformations","boolean operations","polygon clipping","dimensionally extended 9-intersections model"],"author":{"url":"https://github.com/romgrk","name":"romgrk"},"license":"MIT","_id":"2d-geometry@2.1.0","maintainers":[{"name":"romgrk","email":"romgrk.cc@gmail.com"}],"homepage":"https://github.com/romgrk/2d-geometry","bugs":{"url":"https://github.com/romgrk/2d-geometry/issues"},"dist":{"shasum":"f0395029109b0c4ba2562048118631acaea39eed","tarball":"https://registry.npmjs.org/2d-geometry/-/2d-geometry-2.1.0.tgz","fileCount":212,"integrity":"sha512-KzSmuqytd2NVuj6T92hhQyBkaMB314tF5tu+QuFv7N0rbOECzXGllU2BT5+gNfVPGt7f4H33Gu2RRvqDRIhwaA==","signatures":[{"sig":"MEQCIFCEs8N63k2iGP8acbl0537iLFXTDGeWHu0XNDJNEkpkAiAeuyuLTYiqWr25h8dqvhbCJZrz43M9UJ9tKJQlfhAvYA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1129175},"main":"dist/index.js","type":"module","_from":"file:2d-geometry-2.1.0.tgz","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=4.2.4"},"scripts":{"test":"cross-env NODE_ENV=test nyc --reporter=text --reporter=html mocha --recursive","build":"tsc","start":"tsc -w","publish-npm":"npm publish --access public","create-patch":"npm version patch && git push —-tags origin master","generate-docs":"jsdoc -c ./.jsdoc.json --verbose"},"_npmUser":{"name":"romgrk","email":"romgrk.cc@gmail.com"},"_resolved":"/tmp/8a2f8834e963218b62cabe0687b94042/2d-geometry-2.1.0.tgz","_integrity":"sha512-KzSmuqytd2NVuj6T92hhQyBkaMB314tF5tu+QuFv7N0rbOECzXGllU2BT5+gNfVPGt7f4H33Gu2RRvqDRIhwaA==","repository":{"url":"git+https://github.com/romgrk/2d-geometry.git","type":"git"},"_npmVersion":"10.2.3","description":"Performant & ergonomic 2D geometry in typescript","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.2.0","jsdoc":"^3.6.3","mocha":"^8.2.1","minami":"^1.2.3","rollup":"^3.25.1","coveralls":"^3.0.3","cross-env":"^5.2.0","@babel/cli":"^7.2.3","typescript":"^5.2.2","@babel/core":"^7.22.9","@babel/node":"^7.2.2","@babel/register":"^7.18.9","@babel/preset-env":"^7.3.1","babel-plugin-istanbul":"^5.1.1","@rollup/plugin-node-resolve":"^15.1.0"},"_npmOperationalInternal":{"tmp":"tmp/2d-geometry_2.1.0_1712020140155_0.48555051810087213","host":"s3://npm-registry-packages"}},"3.0.0-rc.1":{"name":"2d-geometry","version":"3.0.0-rc.1","keywords":["geometry","2d","algorithms","shape","polygon","distance","intersection","relation","point in polygon","spatial search","affine transformations","boolean operations","polygon clipping","dimensionally extended 9-intersections model"],"author":{"url":"https://github.com/romgrk","name":"romgrk"},"license":"MIT","_id":"2d-geometry@3.0.0-rc.1","maintainers":[{"name":"romgrk","email":"romgrk.cc@gmail.com"}],"homepage":"https://github.com/romgrk/2d-geometry","bugs":{"url":"https://github.com/romgrk/2d-geometry/issues"},"dist":{"shasum":"abd8f6c66633e3ef0e2a8852f185c8e207c5baf3","tarball":"https://registry.npmjs.org/2d-geometry/-/2d-geometry-3.0.0-rc.1.tgz","fileCount":260,"integrity":"sha512-lXqMyBGMIpafw5b0A5ZCJAZ4oiIDdoUgVB6AZij+HArl1cXQ8HReM19RACz1ZKIQ6Si6sAZi6yDx2PRTUTY/Pg==","signatures":[{"sig":"MEYCIQDabHAEdvnXnzb0bhmsqsFS4L4ROBseMaFhzK/a2P757gIhAOJ4LhPgpdxGj0m7E/QFdwMVD8Qqyoiqu7UYVsEteEYV","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1201538},"main":"index.js","type":"module","_from":"file:2d-geometry-3.0.0-rc.1.tgz","types":"index.d.ts","module":"index.js","engines":{"node":">=4.2.4"},"exports":{".":"./dist/index.js","./svg":"./dist/svg/index.js"},"scripts":{"test":"cross-env NODE_ENV=test nyc --reporter=text --reporter=html mocha --recursive --experimental-modules --es-module-specifier-resolution=node","build":"tsc","start":"tsc -w","publish-npm":"npm publish --access public","create-patch":"npm version patch && git push —-tags origin master","generate-docs":"jsdoc -c ./.jsdoc.json --verbose"},"_npmUser":{"name":"romgrk","email":"romgrk.cc@gmail.com"},"_resolved":"/tmp/cf8011ee6e15e2fa802b4a70c7901ad5/2d-geometry-3.0.0-rc.1.tgz","_integrity":"sha512-lXqMyBGMIpafw5b0A5ZCJAZ4oiIDdoUgVB6AZij+HArl1cXQ8HReM19RACz1ZKIQ6Si6sAZi6yDx2PRTUTY/Pg==","repository":{"url":"git+https://github.com/romgrk/2d-geometry.git","type":"git"},"_npmVersion":"10.2.3","description":"Performant & ergonomic 2D geometry in typescript","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.2.0","jsdoc":"^3.6.3","mocha":"^8.2.1","minami":"^1.2.3","rollup":"^3.25.1","coveralls":"^3.0.3","cross-env":"^5.2.0","@babel/cli":"^7.2.3","typescript":"^5.2.2","@babel/core":"^7.22.9","@babel/node":"^7.2.2","@biomejs/biome":"1.6.4","@babel/register":"^7.18.9","@babel/preset-env":"^7.3.1","babel-plugin-istanbul":"^5.1.1","@rollup/plugin-node-resolve":"^15.1.0"},"_npmOperationalInternal":{"tmp":"tmp/2d-geometry_3.0.0-rc.1_1712724365042_0.08937378827262354","host":"s3://npm-registry-packages"}},"3.0.0-rc.2":{"name":"2d-geometry","version":"3.0.0-rc.2","keywords":["geometry","2d","algorithms","shape","polygon","distance","intersection","relation","point in polygon","spatial search","affine transformations","boolean operations","polygon clipping","dimensionally extended 9-intersections model"],"author":{"url":"https://github.com/romgrk","name":"romgrk"},"license":"MIT","_id":"2d-geometry@3.0.0-rc.2","maintainers":[{"name":"romgrk","email":"romgrk.cc@gmail.com"}],"homepage":"https://github.com/romgrk/2d-geometry","bugs":{"url":"https://github.com/romgrk/2d-geometry/issues"},"dist":{"shasum":"969ce16285801d340c57fd2d304e90b4bc86dee7","tarball":"https://registry.npmjs.org/2d-geometry/-/2d-geometry-3.0.0-rc.2.tgz","fileCount":260,"integrity":"sha512-M9zZUfMmaenkBDTtcAMcJEInDQjCqJG7bO2fDdVUZobWDxcxiH81ztysIwQt5qsk4tgc+9WRT1G/TdeQgNZoWw==","signatures":[{"sig":"MEYCIQD17XkfWmedOZy5GX10D4dJWjqLtESWcNQa1YSu+n3CuAIhAIxf4du5fOYBcs8ck7Yk9G7hQZgvWFCUliZFg/d9tFIj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1202383},"main":"index.js","type":"module","_from":"file:2d-geometry-3.0.0-rc.2.tgz","types":"index.d.ts","module":"index.js","engines":{"node":">=4.2.4"},"exports":{".":"./dist/index.js","./svg":"./dist/svg/index.js"},"scripts":{"test":"cross-env NODE_ENV=test nyc --reporter=text --reporter=html mocha --recursive --experimental-modules --es-module-specifier-resolution=node","build":"tsc","start":"tsc -w","publish-npm":"npm publish --access public","create-patch":"npm version patch && git push —-tags origin master","generate-docs":"jsdoc -c ./.jsdoc.json --verbose"},"_npmUser":{"name":"romgrk","email":"romgrk.cc@gmail.com"},"_resolved":"/tmp/9f1231f4fd4e76b46681c81f0b42b937/2d-geometry-3.0.0-rc.2.tgz","_integrity":"sha512-M9zZUfMmaenkBDTtcAMcJEInDQjCqJG7bO2fDdVUZobWDxcxiH81ztysIwQt5qsk4tgc+9WRT1G/TdeQgNZoWw==","repository":{"url":"git+https://github.com/romgrk/2d-geometry.git","type":"git"},"_npmVersion":"10.2.3","description":"Performant & ergonomic 2D geometry in typescript","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.2.0","jsdoc":"^3.6.3","mocha":"^8.2.1","minami":"^1.2.3","rollup":"^3.25.1","coveralls":"^3.0.3","cross-env":"^5.2.0","@babel/cli":"^7.2.3","typescript":"^5.2.2","@babel/core":"^7.22.9","@babel/node":"^7.2.2","@biomejs/biome":"1.6.4","@babel/register":"^7.18.9","@babel/preset-env":"^7.3.1","babel-plugin-istanbul":"^5.1.1","@rollup/plugin-node-resolve":"^15.1.0"},"_npmOperationalInternal":{"tmp":"tmp/2d-geometry_3.0.0-rc.2_1712779254534_0.11724101777601792","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"2d-geometry","version":"3.0.0","description":"Performant & ergonomic 2D geometry in typescript","main":"index.js","module":"index.js","types":"index.d.ts","type":"module","sideEffects":false,"exports":{".":"./dist/index.js","./svg":"./dist/svg/index.js"},"repository":{"type":"git","url":"git+https://github.com/romgrk/2d-geometry.git"},"keywords":["geometry","2d","algorithms","shape","polygon","distance","intersection","relation","point in polygon","spatial search","affine transformations","boolean operations","polygon clipping","dimensionally extended 9-intersections model"],"author":{"name":"romgrk","url":"https://github.com/romgrk"},"license":"MIT","bugs":{"url":"https://github.com/romgrk/2d-geometry/issues"},"homepage":"https://github.com/romgrk/2d-geometry","engines":{"node":">=4.2.4"},"devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.22.9","@babel/node":"^7.2.2","@babel/preset-env":"^7.3.1","@babel/register":"^7.18.9","@biomejs/biome":"1.6.4","@rollup/plugin-node-resolve":"^15.1.0","babel-plugin-istanbul":"^5.1.1","chai":"^4.2.0","coveralls":"^3.0.3","cross-env":"^5.2.0","jsdoc":"^3.6.3","minami":"^1.2.3","mocha":"^8.2.1","nyc":"^15.1.0","rollup":"^3.25.1","typescript":"^5.2.2"},"scripts":{"start":"tsc -w","build":"tsc","test":"cross-env NODE_ENV=test nyc --reporter=text --reporter=html mocha --recursive --experimental-modules --es-module-specifier-resolution=node","generate-docs":"jsdoc -c ./.jsdoc.json --verbose","create-patch":"npm version patch && git push —-tags origin master","publish-npm":"npm publish --access public"},"_id":"2d-geometry@3.0.0","_integrity":"sha512-6yF9p89QaGywFsC70LJgvFTBjS3O7aq3EV43of+m7QbF+Z/wMiIST6i5UFpZ+iT1mWSiSzoXzOq0yp42idWX8g==","_resolved":"/tmp/35a70b1c7f210081599687c6c7104f1b/2d-geometry-3.0.0.tgz","_from":"file:2d-geometry-3.0.0.tgz","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-6yF9p89QaGywFsC70LJgvFTBjS3O7aq3EV43of+m7QbF+Z/wMiIST6i5UFpZ+iT1mWSiSzoXzOq0yp42idWX8g==","shasum":"4e93e3a3f613650bac707ba2d6a4901639eaa015","tarball":"https://registry.npmjs.org/2d-geometry/-/2d-geometry-3.0.0.tgz","fileCount":227,"unpackedSize":1125329,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsieXmJBeH4JFIwpPTxh2T8KNU5J4Waf1v7VfNMoRXyQIhAPVvFhMcjTPt5SeDhc12/ji0RAKI4HS2R+EhXFlYNfbS"}]},"_npmUser":{"name":"romgrk","email":"romgrk.cc@gmail.com"},"directories":{},"maintainers":[{"name":"romgrk","email":"romgrk.cc@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2d-geometry_3.0.0_1717869210116_0.12083865068637567"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-30T15:28:38.225Z","modified":"2024-06-08T17:53:30.515Z","0.2.0":"2024-03-30T15:28:38.521Z","2.0.0":"2024-03-30T15:34:03.848Z","2.0.1":"2024-03-31T22:45:47.823Z","2.1.0":"2024-04-02T01:09:00.443Z","3.0.0-rc.1":"2024-04-10T04:46:05.277Z","3.0.0-rc.2":"2024-04-10T20:00:54.733Z","3.0.0":"2024-06-08T17:53:30.351Z"},"maintainers":[{"name":"romgrk","email":"romgrk.cc@gmail.com"}],"author":{"name":"romgrk","url":"https://github.com/romgrk"},"repository":{"type":"git","url":"git+https://github.com/romgrk/2d-geometry.git"},"keywords":["geometry","2d","algorithms","shape","polygon","distance","intersection","relation","point in polygon","spatial search","affine transformations","boolean operations","polygon clipping","dimensionally extended 9-intersections model"],"license":"MIT","homepage":"https://github.com/romgrk/2d-geometry","bugs":{"url":"https://github.com/romgrk/2d-geometry/issues"},"readme":"# 2d-geometry\n\n**2d-geometry** is a fork of [flatten-js](https://github.com/alexbol99/flatten-js) focused on performance, ergonomics and Typescript.\n\nThis library is meant to be a complete solution for manipulating abstract geometrical shapes like point, vector and circles. It also provides a lot of useful methods and algorithms like finding intersections, checking inclusion, calculating distance, applying affine transformations, performing boolean operations and more.\n\n### Why fork?\n\nThe original library is **great** from a feature-set and mathematical point of view, but Typescript support is mediocre, and some very useful primitives are not available. This library adds the very needed `Quadratic`, `Bezier` and `Path` (sequence of `Arc`, `Segment`, `Quadratic` and `Bezier`), which make working with SVG and Canvas a breeze.\n\nThe original is also written in a way that's hard to optimize for JS engines, and impossible to tree-shake for bundlers. This fork will break API with a new major at some point to split some features (notably intersection & distance algorithms) and optimize bundle size.\n\n## Installation\n\n```\npnpm install --save 2d-geometry\n```\n\n## Usage\n\n```javascript\nimport {\n    Point,\n    Vector,      // Oriented vector starting at (0, 0)\n    Line,        // Infinite line\n    Ray,         // Semi-infinite line (starts at a point, doesn't end)\n    Segment,     // Finite line (starts and ends at a point)\n    Arc,         // Circular arc only, no ellipses\n    Circle,\n    Box,         // A bounding box, not a Rect!\n    Bezier,      // Cubic bezier\n    Quadratic,   // Quadratic bezier\n    Path,        // Sequence of Arc, Segment, Quadratic and Bezier\n    Polygon,\n    Rect,        // Child class of Polygon\n    RoundedRect, // Child class of Polygon\n    Matrix,      // 2d affine transformation matrix\n} from '2d-geometry';\n```\n\nEvery shape is a child class of the abstract `Shape` class, which contains props like `.box` and `.center`, and methods like `.translate()` or `.rotate()`.\n\nSome classes have shortcuts to avoid calling with `new`, for example:\n```javascript\nimport { point, circle, segment } from '2d-geometry';\n\nconst s1 = segment(10, 10, 200, 200);\nconst s2 = segment(10, 160, 200, 30);\nconst c = circle(point(200, 110), 50);\n```\n\nThe objects are immutable by default, and create new copies of their content:\n```javascript\nimport { Point } from '2d-geometry';\n\nconst a = Point.EMPTY // contains a frozen `new Point(0, 0)`\nconst b = a.translate(50, 100)\n```\n\nSome methods have mutable equivalents however, for high-performance cases where avoiding allocations is desirable. They will be marked with the `Mut` suffix:\n```javascript\nimport { Matrix } from '2d-geometry';\n\nconst a = new Matrix()\nconst b = Matrix.fromTransform(0, 0, 0, 2) // x, y, rotation, scale\na.multiplyMut(b) // a is mutated directly\n```\n\nThe core library is abstract, but some SVG utils are exported separately (to avoid the bundle size cost). You may use them as such:\n```javascript\nimport { Circle } from '2d-geometry'\nimport { parsePath, stringify } from '2d-geometry/svg'\n\nconst svgString = stringify(new Circle(100, 100, 50), { fill: 'red' })\nconst path = parsePath('M0,0 L100,0 L100,100 L0,100 Z') // returns a `Path` instance\n```\n\nThis project adheres to the [Tau manifesto](https://tauday.com/tau-manifesto) and exports the circle constant as `TAU`, which is equivalent to `2 * Math.PI`:\n```javascript\nimport { TAU } from '2d-geometry'\n```\n\n## High-performance use-cases\n\nIf you're rendering with this library, you may need to match on the type of object. You may use the `shape.tag` discriminant for that, which is an integer enum.\n\n```javascript\nimport { ShapeTag, Segment, Circle } from '2d-geometry'\n\nconst shape = graphicNode.shape\n\n// NO\nif (shape instanceof Segment) {\n  drawSegment(shape as Segment)\n} else if (shape instanceof Circle) {\n  drawCircle(shape as Circle)\n}\n// ...\n\n// YES\nswitch (shape.tag) {\n  case ShapeTag.Segment: {\n    drawSegment(shape as Segment); break\n  }\n  case ShapeTag.Circle: {\n    drawCircle(shape as Circle); break\n  }\n  // ...\n}\n```\n\nYou can also use the `shape._data` field for your own purposes, for examples caching rendered data.\n\n## Content of the library\n\n### Polygon\n\n[Polygon](https://alexbol99.github.io/2d-geometry/Polygon.html) in **2d-geometry** library is actually a multi-polygon.\nPolygon is a collection of faces - \nclosed oriented chains of edges, which may be of type Segment or Arc. The most external face\ncalled island, a face included into it is called hole. Holes in turn may have inner islands,\nnumber of inclusion levels is unlimited.\n \nOrientation of islands and holes is matter for calculation\nof relationships and boolean operations, holes should have orientation opposite to islands.\nIt means that for proper results faces in a polygon should be **orientable**: they should not have self-intersections.\nFaces also should not overlap each other. Method ```isValid()``` checks if polygon fit these rules.\n\nConstructor of the polygon object accept various inputs:\n* Array of shapes (instances of Flatten.Segment or Flatten.Arc) that represent closed chains\n* Array of shapes as json objects that represent closed chains \n* Array of points (Flatten.Point) that represent vertices of the polygon\n* Array of numeric pairs [x,y] that represent vertices of the polygon\n* Instances of Circle or Box\n\nPolygon provides various useful methods:\n* ```area``` - calculate area of a polygon\n* ```addFace``` - add a new face to polygon\n* ```deleteFace``` - removes face from polygon\n* ```addVertex``` - split an edge of polygon adn create new vertex\n* ```cut``` - cut polygon with multiline into sub-polygons\n* ```findEdgeByPoint``` - find edge in polygon\n* ```contains``` - test if polygon contains shape (point, segment or arc)\n* ```transform``` - transform polygon using affine transformation matrix\n* ```reverse``` - revert orientation of faces\n* ````splitToIslands```` - split to array of islands with holes\n\n### Multiline\n\nMultiline represent an unclosed chain of edges of type Segment or Arc\n\n### Planar Set\n\nPlanar Set is a container of shapes that enables spatial seach by rectangular query.\n\n### Transformations\n\nAll the classes have methods ```translate```, ```rotate``` and ```scale``` \nwhich may be chained. \n<br/>Example:\n```javascript\n// Rotate segment by 45 deg around its center\nlet {point,segment,matrix} = Flatten;\nlet s = segment(point(20,30), point(60,70));\nlet center = s.box.center;\nlet angle = 45.*Math.PI/180.;\nlet rotated_segment = s.rotate(angle, center)\n```\n### Intersection points\n\nAll classes have method ```intersect(otherShape)``` that return array of intersection points,\nif two shapes intersect each other, or empty array otherwise. The is no predefined order\nof intersection points in the array.\n\nPlease don't be confused, there are another two methods ```BooleanOperations.intersect()```\nthat performs boolean intersection of polygons and logical predicate ```Relations.intersect()```\nthat check if two shapes intersected or not. \n\n### Distance between shapes\n\nAll basic classes and polygon have method ```distanceTo(othershape)``` \nthat calculate distance to other shape. Together with the distance function returns the shortest segment\nbetween two shapes - segment between two closest point, where the first point lays\non ```this``` shape, and the second - on the other shape, see example:\n```javascript\nlet s = segment(point(10,30), point(150, 40));\nlet c = circle(point(75,75),10);\nlet [dist,shortest_segment] = s.distanceTo(c);\n```\n\n### Intersection model (DE-9IM) \n\nThe Dimensionally Extended nine-Intersection Model\n ([DE-9IM](https://en.wikipedia.org/wiki/DE-9IM)) is a topological model and a standard\n used to describe the spatial relations of two geometries in 2-dimensional plane.\n \n First, for every shape we define:\n * An interior\n * A boundary\n * An exterior\n \n For polygons, the interior, boundary and exterior are obvious, other types have some exclusions:\n * Point has no interior\n * Line has no boundary\n \n The DE-9IM model based on a 3×3 intersection matrix with the form:\n ```\n          [ I(a) ^ I(b)   B(a) ^ I(b)   E(a) ^ I(b)\n de9im =    I(a) ^ B(b)   B(a) ^ B(b)   E(a) ^ B(b)\n            I(a) ^ E(b)   B(a) ^ E(b)   E(a) ^ E(b)  ]\n```\n\nwhere ```a```and  ```b``` are two shapes (geometries), \n\n```I(), B(), E()``` denotes interior, boundary and exterior operator and\n\n```^``` denotes operation of intersection. \nDimension of intersection result depends on the dimension of shapes, for example,\n* intersection between an interior of the line and an interior of the polygon is an\n array of segments\n* intersection between an interior of the line and boundary polygon is \nan array of points (may include segments in case of touching)\n* intersection between interiors of two polygons (if exists) will be\na polygon. \n\nDE-9IM matrix describes any possible relationships between two shapes on the plane.\n\nDE-9IM matrix is available via method ```relate``` under namespace ```Relations```.\n\nEach element of DE-9IM matrix is an array of the objects representing corresponding intersection.\nEmpty array represents case of no intersection.\nIf intersection is not applicable (i.e. intersection with a boundary for a line which has no boundary),\ncorrespondent cell left undefined.\n\nIntersection between two exteriors not calculated because usually it is meaningless.\n\n```javascript\nlet {relate} = Relations;\n// \n// define two shapes: polygon1, polygon2\n//\nlet de9im = relate(polygon1, polygon2);\n//\n// explore 8 of 9 fields of the de9im matrix:\n// de9im.I2I  de9im.B2I  de9im.E2I\n// de9im.I2B  de9im.B2B  de9im.E2B\n// de9im.I2E  de9im.B2E     N/A\n```\n\nAnother common way to represent DE-9IM matrix is a string where \n* ```T``` represent intersection where array is not impty\n* ```F``` represent intersection where array is empty\n* ```.``` means not relevant or not applicable\n\nString may be obtained with ```de9im.toString()``` method.\n\n### Relationship predicates\n\nThe spatial relationships between two shapes exposed via namespace `Relations`.\nThe spatial predicates return `true` if relationship match and `false` otherwise.\n```javascript\nlet {intersect, disjoint, equal, touch, inside, contain, covered, cover} = Relations;\n// define shape a and shape b\nlet p = intersect(a, b);\nconsole.log(p)             // true / false\n```\n* ```intersect``` - shapes a and b have at least one common point\n* ```disjoint``` -  opposite to ```intersect```\n* `equal` - shapes a and b are topologically equal\n* `touch` - shapes a and b have at least one point in common but their interiors not intersect\n* `inside` - shape a lies in the interior of shape b\n* `contain` - shape b lies in the interior of shape b\n* `covered` - every point of a lies or in the interior or on the boundary of shape b\n* `covered` - every point of b lies or in the interior or on the boundary of shape a\n\n### Boolean operations\n\nBoolean operations on polygons available via namespace **BooleanOperations**.\nPolygons in boolean operation should be valid: both operands should have same meaning of face orientation,\nfaces should not overlap each other and should not have self-intersections.\n\nUser is responsible to provide valid polygons, boolean operation methods do not check validity.\n\n```javascript\nlet {unify, subtract, intersect, innerClip, outerClip} = BooleanOperations;\n```\n* `unify` - unify two polygons and return resulted polygon\n* `subtract` - subtract second polygon from the first and return resulted polygon\n* `intersect` - intersect two polygons and return resulted polygon\n* `innerClip` - intersect two polygons and return boundary of intersection as 2 arrays.\n The first aray contains edges of the first polygon, the second - the edges of the second\n* `outerClip` - clip boundary of the first polygon with the interior of the second polygon\n\nImplementation based on Weiler-Atherton clipping algorithm,\ndescribed in the article [Hidden Surface Removal Using Polygon Area Sorting](https://www.cs.drexel.edu/~david/Classes/CS430/HWs/p214-weiler.pdf)\n\n### Serialization\n\nAll **2d-geometry** shape objects may be serialized using `JSON.stringify()` method.\n`JSON.stringify` transforms object to string using `.toJSON()` formatter implemented in the class. \n`JSON.parse` restore object from a string, and then constructor can use this object to create Flatten object.\n \n```javascript\nlet l = line(point(4, 0), point(0, 4));\n// Serialize\nlet str = JSON.stringify(l);  \n// Parse and reconstruct\nlet l_json = JSON.parse(str);\nlet l_parsed = line(l_json);\n```\n","readmeFilename":"README.md"}