lining
v0.0.1
Published
Generate line patterns
Readme
@mbrandt-art/lining
Started as a fork of @anvaka/streamlines.
Rewritten to expose more options and optimize for plotter art.
API
computeStreamlines(options)
Returns: { lines, d_arr }
import { computeStreamlines } from '@mbrandt-art/lining'
let streamlines = computeStreamlines({
bbox: { left: -5, top: -5, width: 10, height: 10 },
field(p){
// custom field code goes here
return {
x: Math.cos(p.x),
y: Math.sin(p.y)
}
},
tolerance: 0.05, // for line simplification
seeds: [], // starting points
forwardOnly: false,
dSep: 0.5,
dTest: 0.25,
timeStep: 0.01,
})
streamlines.lines // ~> Array of lines [[x,y]]
streamlines.d_arr // ~> Array of SVG d stringsReferences
- Original library @anvaka/streamlines
- Core Algorithm
