jbuckmccready / CavalierContours

2D polyline library for offsetting, combining, etc.
MIT License
421 stars 79 forks source link

Make ParallelOffsetIslands more general #40

Open lscandella opened 3 years ago

lscandella commented 3 years ago

Hello JBuck and thanks for your excellent work!

I'm working on your ParallelOffsetIslands algorithm trying to make it more general in two ways:

  1. Handle negative offsets. Here I think I have a result by reversing all polylines before input to your code and swapping cwLoops with ccwLoops. Is it correct?
  2. Handle different offsets for internal contours and external. Here I'm lost... Can you suggest some heuristics?

Thanks. L

jbuckmccready commented 3 years ago
  1. I think that should work...
  2. I do not think there is an easy way to do this right now without modifying the code (code would need to change to pair an offset value with each loop and apply different offsets and distance checks according to that value). I wont be working on this any time soon and if/when I work on it it would be in the Rust library here. If you make changes and get it working I'll accept pull requests.