jscad / csg.js

DEPRECATED: CSG Library for JSCAD (See the link below)
https://github.com/jscad/OpenJSCAD.org/tree/master/packages/modeling
MIT License
218 stars 56 forks source link

V1 Path2D api under V2 #159

Closed pentacular closed 5 years ago

pentacular commented 5 years ago

This implements the V1 Path2D api using V2, for backward compatibility.

Note: rectangularExtrude, expandToCAG, innerToCAG, and appendBezier are not initially implemented.

This implementation decouples Path2D from any particular geometry implementation by using registry/call, and tries to move all non-api related code elsewhere -- either to a geometry, or to an algorithm.

See Path2D.test.js to see how geometry/path is set up as the default V1 path geometry, and how it could be swapped out for another geometry without changing Path2D.

The registry has been refactored from the earlier PR to a form like: call(geometry).toPointArray({}, geometry)

This form seems less intrusive in code in practice than the earlier proposed toImplementation().