{"_id":"hachure-fill","_rev":"4127087","name":"hachure-fill","description":"Fill a polygon with lines ","dist-tags":{"latest":"0.5.2"},"maintainers":[{"name":"shihn","email":""}],"time":{"modified":"2026-03-01T18:25:33.000Z","created":"2020-05-01T01:47:22.343Z","0.5.2":"2023-09-27T00:57:38.699Z","0.5.1":"2023-09-27T00:53:53.608Z","0.5.0":"2023-09-27T00:47:47.332Z","0.4.0":"2023-05-31T22:52:06.190Z","0.3.0":"2023-05-31T22:37:40.632Z","0.2.0":"2020-05-01T04:09:37.803Z","0.1.0":"2020-05-01T01:47:22.343Z"},"users":{},"author":{"name":"Preet Shihn"},"repository":{"type":"git","url":"git+https://github.com/pshihn/hachure-fill.git"},"versions":{"0.5.2":{"name":"hachure-fill","version":"0.5.2","description":"Fill a polygon with lines ","main":"bin/hachure.js","types":"bin/hachure.d.ts","type":"module","scripts":{"build":"npm run lint && npm run build-ts","build-ts":"rm -rf bin && tsc","lint":"eslint --ext ts src"},"repository":{"type":"git","url":"git+https://github.com/pshihn/hachure-fill.git"},"keywords":["hachure","lines","polygon","plotter"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/hachure-fill/issues"},"homepage":"https://github.com/pshihn/hachure-fill#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.59.0","@typescript-eslint/parser":"^5.59.0","esbuild":"^0.17.18","eslint":"^8.39.0","typescript":"^5.0.4"},"gitHead":"2083be6f7e6c814dc6a8c2c88a7823827566504e","_id":"hachure-fill@0.5.2","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"shasum":"d19bc4cc8750a5962b47fb1300557a85fcf934cc","size":3314,"noattachment":false,"key":"/hachure-fill/-/hachure-fill-0.5.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/hachure-fill/download/hachure-fill-0.5.2.tgz"},"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"maintainers":[{"name":"shihn","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hachure-fill_0.5.2_1695776258483_0.34836298691209255"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-09-27T00:57:38.699Z","publish_time":1695776258699,"_source_registry_name":"default","_cnpm_publish_time":1695776258699},"0.5.1":{"name":"hachure-fill","version":"0.5.1","description":"Fill a polygon with lines ","main":"bin/hachure.js","types":"bin/hachure.d.ts","type":"module","scripts":{"build":"npm run lint && npm run build-ts","build-ts":"rm -rf bin && tsc","lint":"eslint --ext ts src"},"repository":{"type":"git","url":"git+https://github.com/pshihn/hachure-fill.git"},"keywords":["hachure","lines","polygon","plotter"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/hachure-fill/issues"},"homepage":"https://github.com/pshihn/hachure-fill#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.59.0","@typescript-eslint/parser":"^5.59.0","esbuild":"^0.17.18","eslint":"^8.39.0","typescript":"^5.0.4"},"gitHead":"2083be6f7e6c814dc6a8c2c88a7823827566504e","_id":"hachure-fill@0.5.1","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"shasum":"9fe747492cfd6d4e0c5fa66ed1833a48b29b2516","size":3303,"noattachment":false,"key":"/hachure-fill/-/hachure-fill-0.5.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/hachure-fill/download/hachure-fill-0.5.1.tgz"},"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"maintainers":[{"name":"shihn","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hachure-fill_0.5.1_1695776033320_0.6857057177176551"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-09-27T00:53:53.608Z","publish_time":1695776033608,"_source_registry_name":"default","_cnpm_publish_time":1695776033608},"0.5.0":{"name":"hachure-fill","version":"0.5.0","description":"Fill a polygon with lines ","main":"bin/hachure.js","types":"bin/hachure.d.ts","type":"module","scripts":{"build":"npm run lint && npm run build-ts","build-ts":"rm -rf bin && tsc","lint":"eslint --ext ts src"},"repository":{"type":"git","url":"git+https://github.com/pshihn/hachure-fill.git"},"keywords":["hachure","lines","polygon","plotter"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/hachure-fill/issues"},"homepage":"https://github.com/pshihn/hachure-fill#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.59.0","@typescript-eslint/parser":"^5.59.0","esbuild":"^0.17.18","eslint":"^8.39.0","typescript":"^5.0.4"},"gitHead":"570435fabaff93b88524852604e00cbc93dad8c6","_id":"hachure-fill@0.5.0","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"shasum":"85329d42c77713ca8e55d1dad526dcf2373206b8","size":3298,"noattachment":false,"key":"/hachure-fill/-/hachure-fill-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hachure-fill/download/hachure-fill-0.5.0.tgz"},"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"maintainers":[{"name":"shihn","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hachure-fill_0.5.0_1695775667108_0.9374372281736336"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-09-27T00:47:47.332Z","publish_time":1695775667332,"_source_registry_name":"default","_cnpm_publish_time":1695775667332},"0.4.0":{"name":"hachure-fill","version":"0.4.0","description":"Fill a polygon with lines ","main":"bin/hachure.js","types":"bin/hachure.d.ts","type":"module","scripts":{"build":"npm run lint && npm run build-ts","build-ts":"rm -rf bin && tsc","lint":"eslint --ext ts src"},"repository":{"type":"git","url":"git+https://github.com/pshihn/hachure-fill.git"},"keywords":["hachure","lines","polygon","plotter"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/hachure-fill/issues"},"homepage":"https://github.com/pshihn/hachure-fill#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.59.0","@typescript-eslint/parser":"^5.59.0","esbuild":"^0.17.18","eslint":"^8.39.0","typescript":"^5.0.4"},"gitHead":"5a38746222178e82af2b3951acd9679be526e8f3","_id":"hachure-fill@0.4.0","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"shasum":"5684c5268261cb7ea71f11e49696fb7b12a8a5aa","size":3270,"noattachment":false,"key":"/hachure-fill/-/hachure-fill-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hachure-fill/download/hachure-fill-0.4.0.tgz"},"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"maintainers":[{"name":"shihn","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hachure-fill_0.4.0_1685573525994_0.004145882894836639"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-31T22:52:06.190Z","publish_time":1685573526190,"_source_registry_name":"default","_cnpm_publish_time":1685573526190},"0.3.0":{"name":"hachure-fill","version":"0.3.0","description":"Fill a polygon with lines ","main":"bin/hachure.js","types":"bin/hachure.d.ts","type":"module","scripts":{"build":"npm run lint && npm run build-ts","build-ts":"rm -rf bin && tsc","lint":"eslint --ext ts src"},"repository":{"type":"git","url":"git+https://github.com/pshihn/hachure-fill.git"},"keywords":["hachure","lines","polygon","plotter"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/hachure-fill/issues"},"homepage":"https://github.com/pshihn/hachure-fill#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.59.0","@typescript-eslint/parser":"^5.59.0","esbuild":"^0.17.18","eslint":"^8.39.0","typescript":"^5.0.4"},"gitHead":"a2d6dd512e8936b06493a3cfb7b18dde07c3fc09","_id":"hachure-fill@0.3.0","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"shasum":"54ee8b881c7e27575c0baca7b40656433fc3dd6a","size":3245,"noattachment":false,"key":"/hachure-fill/-/hachure-fill-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hachure-fill/download/hachure-fill-0.3.0.tgz"},"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"maintainers":[{"name":"shihn","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hachure-fill_0.3.0_1685572660468_0.3497322787554229"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-31T22:37:40.632Z","publish_time":1685572660632,"_source_registry_name":"default","_cnpm_publish_time":1685572660632},"0.2.0":{"name":"hachure-fill","version":"0.2.0","description":"Fill a polygon with lines ","main":"index.js","module":"index.js","types":"index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/pshihn/hachure-fill.git"},"keywords":["hachure","lines","polygon","plotter"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/hachure-fill/issues"},"homepage":"https://github.com/pshihn/hachure-fill#readme","gitHead":"b17b498c361343a16d2035db669fe273c2ba13ea","_id":"hachure-fill@0.2.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"93b237be94c01adb2468e64eac26a1381cea3c97","size":2305,"noattachment":false,"key":"/hachure-fill/-/hachure-fill-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hachure-fill/download/hachure-fill-0.2.0.tgz"},"maintainers":[{"name":"shihn","email":""}],"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hachure-fill_0.2.0_1588306177682_0.8713217061451868"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-24T21:48:23.833Z","publish_time":1588306177803,"_cnpm_publish_time":1588306177803},"0.1.0":{"name":"hachure-fill","version":"0.1.0","description":"Fill a polygon with lines ","main":"index.js","module":"index.js","types":"index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/pshihn/hachure-fill.git"},"keywords":["hachure","lines","polygon","plotter"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/hachure-fill/issues"},"homepage":"https://github.com/pshihn/hachure-fill#readme","gitHead":"a7383400191ce55c7581dd8aca318a74f894b7dc","_id":"hachure-fill@0.1.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"be4dedc91e853ded46e00931a0bc91c687b4499c","size":2233,"noattachment":false,"key":"/hachure-fill/-/hachure-fill-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hachure-fill/download/hachure-fill-0.1.0.tgz"},"maintainers":[{"name":"shihn","email":""}],"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hachure-fill_0.1.0_1588297642251_0.8165836977109713"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-24T21:48:23.495Z","publish_time":1588297642343,"_cnpm_publish_time":1588297642343}},"readme":"# hachure-fill\n\n[Demo](https://hachure-fill.pages.dev/)\n\nThis package calculates the hachure lined to fill a polygon. The **angle** of the lines and the **gap** between lines can be configured.\n\nThe algorithm works on convex, concave, simple, complex polygons, and polygons with holes. \n\n![preview of a polygon](https://user-images.githubusercontent.com/833927/242424090-90e60c00-c87b-4033-ae63-c0f38fa5d291.png)\n\n\n## Install\n\nFrom npm\n\n```\nnpm install --save hachure-fill\n```\n\nThe package is distributed as an ES6 module. \n\n## Usage\n\n### hachureFill(points: Point[], angle: number, gap: number): Line[];\n\nThe function takes in a polygon, which is represented as an array of points (each point being a an array of 2 numbers `[x, y]`). \n\nThe **angle** sets the angle of the hachure lines in degrees. \n\nThe  **gap** arguments sets the distance between each hachure line. \n\nThe function returns an array of lines. Each line is an array of two points. \n\n```javascript\nimport { hachureFill } from 'hachure-fill';\n\n// Polygon vertices\nconst vertices = [\n  [10, 10],\n  [200, 10],\n  [100, 100],\n  [300, 100],\n  [60, 200]\n];\n\n// Lines filling the polygon \n// at an angle of 45 degrees. \n// Lines are 10px apart.\nconst lines = hachureFill(vertices, 45, 10);\n\n// Draw lines...\n```\n\n### hachureFill(points: Point[][], angle: number, gap: number): Line[];\n\nWhen dealing with Polygon with holes, you can provide an array of polygons. The outer polygon, and polygones represented each of the holes. \nThe polygons need not be nested, but if they are, even-odd rules apply to fill the shape. \n","_attachments":{},"homepage":"https://github.com/pshihn/hachure-fill#readme","bugs":{"url":"https://github.com/pshihn/hachure-fill/issues"},"license":"MIT"}