antfu / drauu

Headless SVG-based drawboard in browser.
https://drauu.netlify.app/
MIT License
1.2k stars 64 forks source link

feat: add eraser support #17

Closed benjinus closed 2 years ago

benjinus commented 2 years ago

The eraser function using a simple approximate solution to path-line intersection by subdividing the path (via the built-in svg path function .getPointAtLength) into an arbitrary number of straight line segments and testing for line-line intersections at each one.

More tech details about line-line intersections: Line–line intersection algorithms