{"_id":"@davepagurek/p5.csg","_rev":"2-008aec1e99fc6d72a572014ddeb02f01","name":"@davepagurek/p5.csg","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@davepagurek/p5.csg","version":"0.0.1","main":"build/p5.csg.js","author":{"name":"Dave Pagurek","email":"dave@davepagurek.com"},"license":"MIT","types":"build/p5.csg.d.ts","repository":{"type":"git","url":"git+https://github.com/davepagurek/p5.csg.git"},"bugs":{"url":"https://github.com/davepagurek/p5.csg/issues"},"homepage":"https://github.com/davepagurek/p5.csg","dependencies":{"@types/p5":"^1.7.6","csg":"^1.0.1","p5":"^1.9.0"},"devDependencies":{"@types/node":"^15.12.5","gh-pages":"^3.2.3","ts-loader":"^9.2.3","ts-node":"^10.0.0","typescript":"^4.3.4","webpack":"^5.41.1","webpack-cli":"^4.7.2"},"scripts":{"build":"yarn generate:js","generate:js":"yarn run webpack","deploy":"yarn build && yarn run gh-pages -d .","publish":"npm publish --access public"},"gitHead":"3abf78d4c6cbcd18eb2dd185be716fc25774222a","description":"This is a library for doing <a href=\"https://en.wikipedia.org/wiki/Constructive_solid_geometry\">constructive solid geometry (CSG)</a> in p5.js. It is powered under the hood by <a href=\"https://github.com/evanw/csg.js/\">csg.js</a> by Evan Wallace, augmente","_id":"@davepagurek/p5.csg@0.0.1","_nodeVersion":"16.14.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-bheBmLOAF9AHeQUsNcahjH8pEqh8Bj7cRwvAPXjMqZNG4VVCPsUFnn95VhJ+FngJhRkamR9jutQGxFg7baj2nw==","shasum":"1c740c3645fbed573a02737cd5f2d29c59d46993","tarball":"https://registry.npmjs.org/@davepagurek/p5.csg/-/p5.csg-0.0.1.tgz","fileCount":5,"unpackedSize":14078,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXGHyiIfrsAgoWTrF9Kn/s73IlmMWkR14vOa5ki/IeOgIhANwLFZ8vHZDaWTLr9MZphgg8H60yLHEIU+D5BuwWIIx7"}]},"_npmUser":{"name":"davepagurek","email":"davepagurek@gmail.com"},"directories":{},"maintainers":[{"name":"davepagurek","email":"davepagurek@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p5.csg_0.0.1_1702859920067_0.7005519409998398"},"_hasShrinkwrap":false},"0.0.2":{"name":"@davepagurek/p5.csg","version":"0.0.2","main":"build/p5.csg.js","author":{"name":"Dave Pagurek","email":"dave@davepagurek.com"},"license":"MIT","types":"build/p5.csg.d.ts","repository":{"type":"git","url":"git+https://github.com/davepagurek/p5.csg.git"},"bugs":{"url":"https://github.com/davepagurek/p5.csg/issues"},"homepage":"https://github.com/davepagurek/p5.csg","dependencies":{"@types/p5":"^1.7.6","csg":"^1.0.1","p5":"^1.9.0"},"devDependencies":{"@types/node":"^15.12.5","gh-pages":"^3.2.3","ts-loader":"^9.2.3","ts-node":"^10.0.0","typescript":"^4.3.4","webpack":"^5.41.1","webpack-cli":"^4.7.2"},"scripts":{"build":"yarn generate:js","generate:js":"yarn run webpack","deploy":"yarn build && yarn run gh-pages -d .","publish":"npm publish --access public"},"description":"This is a library for doing <a href=\"https://en.wikipedia.org/wiki/Constructive_solid_geometry\">constructive solid geometry (CSG)</a> in p5.js. It is powered under the hood by <a href=\"https://github.com/evanw/csg.js/\">csg.js</a> by Evan Wallace, augmente","licenseText":"MIT License\n\nCopyright (c) 2023 Dave Pagurek\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@davepagurek/p5.csg@0.0.2","dist":{"shasum":"bb5cfdceb61a921821f6c0f596b32c9352e92b4b","integrity":"sha512-8LeNGaqfnJYjdhfAXpQp+M3ByQxN6DbcIYrZP2NGDowCcmPPRmzaIxEu9U2GCnaRv+8/ofaUIhiIc/wULvA/sQ==","tarball":"https://registry.npmjs.org/@davepagurek/p5.csg/-/p5.csg-0.0.2.tgz","fileCount":7,"unpackedSize":15484,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfdHIowB/DMztbKGGVKs9S/8GaDWjMLG8q21rHUBbwhAIhAKe18VfLfmvbbvEbn1Z+AkpFDi2qznIEsfmBs94yG+gP"}]},"_npmUser":{"name":"davepagurek","email":"davepagurek@gmail.com"},"directories":{},"maintainers":[{"name":"davepagurek","email":"davepagurek@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p5.csg_0.0.2_1706289819505_0.07685667778276462"},"_hasShrinkwrap":false},"0.0.3":{"name":"@davepagurek/p5.csg","version":"0.0.3","main":"build/p5.csg.js","author":{"name":"Dave Pagurek","email":"dave@davepagurek.com"},"license":"MIT","types":"build/p5.csg.d.ts","repository":{"type":"git","url":"git+https://github.com/davepagurek/p5.csg.git"},"bugs":{"url":"https://github.com/davepagurek/p5.csg/issues"},"homepage":"https://github.com/davepagurek/p5.csg","dependencies":{"@types/p5":"^1.7.6","csg":"^1.0.1","p5":"^1.9.0"},"devDependencies":{"@types/node":"^15.12.5","gh-pages":"^3.2.3","ts-loader":"^9.2.3","ts-node":"^10.0.0","typescript":"^4.3.4","webpack":"^5.41.1","webpack-cli":"^4.7.2"},"scripts":{"build":"yarn generate:js","generate:js":"yarn run webpack","deploy":"yarn build && yarn run gh-pages -d .","publish":"npm publish --access public"},"description":"This is a library for doing <a href=\"https://en.wikipedia.org/wiki/Constructive_solid_geometry\">constructive solid geometry (CSG)</a> in p5.js. It is powered under the hood by <a href=\"https://github.com/evanw/csg.js/\">csg.js</a> by Evan Wallace, augmente","licenseText":"MIT License\n\nCopyright (c) 2023 Dave Pagurek\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@davepagurek/p5.csg@0.0.3","dist":{"shasum":"144d1afd9b692ce4bd4fd98198825b9a3b3d0669","integrity":"sha512-dxjnb9siDMFV3EvOOcCFujpDXez0YPN1/GD2Khj+YtqygUEQpksCboAadRT3idkR+MpofFj6XaZl89Q18K0JHA==","tarball":"https://registry.npmjs.org/@davepagurek/p5.csg/-/p5.csg-0.0.3.tgz","fileCount":7,"unpackedSize":15488,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDAB68BH/H+4/K6e4jScB2AwjsQUda0BLjJ3RgoOuV1QgIgGh3iL7EDlDTIbZxTjSM9eHEiED4Uo43lTWWoQrQTTtk="}]},"_npmUser":{"name":"davepagurek","email":"davepagurek@gmail.com"},"directories":{},"maintainers":[{"name":"davepagurek","email":"davepagurek@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p5.csg_0.0.3_1714835437228_0.902636590271922"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-18T00:38:39.939Z","0.0.1":"2023-12-18T00:38:40.253Z","modified":"2024-05-04T15:10:37.664Z","0.0.2":"2024-01-26T17:23:39.643Z","0.0.3":"2024-05-04T15:10:37.429Z"},"maintainers":[{"name":"davepagurek","email":"davepagurek@gmail.com"}],"description":"This is a library for doing <a href=\"https://en.wikipedia.org/wiki/Constructive_solid_geometry\">constructive solid geometry (CSG)</a> in p5.js. It is powered under the hood by <a href=\"https://github.com/evanw/csg.js/\">csg.js</a> by Evan Wallace, augmente","homepage":"https://github.com/davepagurek/p5.csg","repository":{"type":"git","url":"git+https://github.com/davepagurek/p5.csg.git"},"author":{"name":"Dave Pagurek","email":"dave@davepagurek.com"},"bugs":{"url":"https://github.com/davepagurek/p5.csg/issues"},"license":"MIT","readme":"# p5.csg\n\nThis is a library for doing <a href=\"https://en.wikipedia.org/wiki/Constructive_solid_geometry\">constructive solid geometry (CSG)</a> in p5.js. It is powered under the hood by <a href=\"https://github.com/evanw/csg.js/\">csg.js</a> by Evan Wallace, augmented to accept and return <a href=\"https://p5js.org/reference/#/p5.Geometry\">p5.Geometry.</a>\n\n## Usage\n\n### Adding the library\n\nAdd the library in a script tag:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@davepagurek/p5.csg@0.0.3\"></script>\n```\n\nOr on OpenProcessing, add the CDN link as a library:\n\n```\nhttps://cdn.jsdelivr.net/npm/@davepagurek/p5.csg@0.0.3\n```\n\nIf you're using p5 without importing it globally, you can manually set up p5.csg:\n\n```js\nimport P5 from 'p5'\nimport { setupCSG } from '@davepagurek/p5.csg'\nsetupCSG(P5)\n```\n\n### Example\n\n<table>\n<tr>\n<td>\n\n```js\nlet deathStar\n\nfunction setup() {\n  createCanvas(400, 400, WEBGL)\n\n  deathStar = csg(() => sphere(50))\n    .subtract(() => {\n      translate(40, -40)\n      sphere(25)\n    })\n    .union(() => sphere(40))\n    .done()\n}\n\nfunction draw() {\n  clear()\n  orbitControl()\n  noStroke()\n  lights()\n  model(deathStar)\n}\n```\n\n</td>\n<td>\n\n<img width=\"296\" alt=\"image\" src=\"https://github.com/davepagurek/p5.csg/assets/5315059/a18828d9-e670-4194-a449-f6bed0c883c2\">\n  \n</td>\n</tr>\n</table>\n\nLive: https://editor.p5js.org/davepagurek/sketches/f5QmdBoVI\n\n### Reference\n\nCreate a new CSG wrapper object with the `csg` function. It takes one of the following two inputs:\n\n```ts\n// Pass in an existing p5.Geometry\ncsg(geometry: p5.Geometry): CSGWrapper\n\n// Pass in an input to `buildGeometry()`, which we will automatically\n// convert into a new p5.Geometry under the hood\ncsg(buildGeometryCallback: Function): CSGWrapper\n```\n\nOnce a CSG wrapper object has been created, you can apply a Boolean operation to create a new CSG object, or call `done()` on it to get a `p5.Geometry` you can draw:\n\n```ts\n// Take the boundary of both shapes\nmyCSG.union(other: CSGInput, options?: BooleanOptions): CSGWrapper\n\n// Take a bite out of the current geometry, in the shape of the other\nmyCSG.subtract(other: CSGInput, options?: BooleanOptions): CSGWrapper\n\n// Take just the region that overlaps between two shapes\nmyCSG.intersect(other: CSGInput, options?: BooleanOptions): CSGWrapper\n\n// Flip the inside and outside of the current shape\nmyCSG.invert(): CSGWrapper\n\nmyCSG.done(): p5.Geometry\n\n// Inputs to CSG methods can be either another CSG wrapper object,\n// a p5.Geometry, or a `buildGeometry` callback function.\ntype CSGInput = CSGWrapper | p5.Geometry | Function\n\n// Optionally specify whether or not to include faces from one input\n// or another in the end result. By default, both are included, so\n// if you subtract one shape from another, you will still get a closed\n// shape as a result. If you do not include the other shape's faces,\n// the subtraction will leave a hole.\ntype BooleanOptions = {\n  includeSelfFaces?: boolean;\n  includeOtherFaces?: boolean;\n}\n```\n","readmeFilename":"README.md"}