tbfleming / jscut

In-browser CAM package
http://jscut.org
GNU General Public License v3.0
302 stars 141 forks source link

Allow non-closed lines for the engrave option #36

Closed CarlosGS closed 3 years ago

CarlosGS commented 9 years ago

Hi, engraving non closed lines can be a very useful function to have. Right now it is a bit annoying as every design needs to have closed shapes.

screenshot from 2015-03-04 11 35 23 screenshot from 2015-03-04 11 35 56 screenshot from 2015-03-04 11 36 55

I haven't yet found an option to do this easily, what are your thoughts? By the way I'm loving Jscut, thank you so much for this amazing tool

tbfleming commented 9 years ago

It's a complicated problem:

  1. I use the browser's built-in hit testing for selecting objects. That doesn't work well with open paths; they're hard to click on.
  2. jsclipper mangles open paths; I'd have to bypass all code which uses it when open paths are present.
  3. Most of jscut's code base assumes closed paths; I'd have to bypass much of the existing code when open paths are present.

jscut automatically closes an open path if a user somehow manages to click on it; this prevents jsclipper and the rest of jscut from mangling things.

CarlosGS commented 9 years ago

Oh, thanks for the explanation, that makes total sense. What a pity then!

I have the crazy thought of changing the closure behavior, instead of just joining start-to-end, duplicate the path and join the extremes. But yeah that'd imply a polygon with zero area, which wouldn't be selectable at all... etc etc

Anyway no worries as it is very possible to live without support for open paths. Thanks again for your quick answer!!