This project is part of the @thi.ng/umbrella monorepo.
Freely customizable, iterative nD subdivision curves for open / closed geometries.
Based in principle on:
- Generating subdivision curves with L−systems on a GPU
- Clojure version of thi.ng/geom.
Supplied / implemented subdivision schemes:
- Split @ midpoints (open / closed)
- Split @ thirds (open / closed)
- Chaikin (open / closed)
- Cubic (closed only)
Chaikin (closed) | Chaikin (open) |
---|---|
STABLE - used in production
yarn add @thi.ng/geom-subdiv-curve
// ES module
<script type="module" src="https://unpkg.com/@thi.ng/geom-subdiv-curve?module" crossorigin></script>
// UMD
<script src="https://unpkg.com/@thi.ng/geom-subdiv-curve/lib/index.umd.js" crossorigin></script>
Package sizes (gzipped, pre-treeshake): ESM: 640 bytes / CJS: 721 bytes / UMD: 764 bytes
import * as gsc from "@thi.ng/geom-subdiv-curve";
gsc.subdivide([[0,0], [100,0], [100,100], [0,100]], gsc.SUBDIV_CHAIKIN_CLOSED, 4)
Karsten Schmidt
© 2016 - 2020 Karsten Schmidt // Apache Software License 2.0