jscad / OpenJSCAD.org

JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
https://openjscad.xyz/
MIT License
2.58k stars 505 forks source link

Idea: functions to generate the stroke of a path or geom2 #1272

Open platypii opened 11 months ago

platypii commented 11 months ago

We should introduce functions to generate the stroke of a path.

stroke

Such functions could be useful for creating the exterior of a shape from a given path. There are cases where having only the path is not enough and one might need to add "thiccness". This could also be helpful for things like importing SVGs which can have both fill and stroke.

For paths, this functionality would essentially be offset. However, there is currently no straightforward way to compute the stroke of a geom2.

Options for stroking a path, from the svg spec:

z3dev commented 6 months ago

Maybe a little more primitive, the WebAPI provides both CanvasRenderingContext2D and Path2D interfaces for constructing 2D paths for rendering. Maybe some of these concepts could be adopted.