Closed techninja closed 9 years ago
2 ways to fill an object. the snake method would give a cleaner more accurate result. once we work out the optimal thickness of the line we can easily fill within the parameters so the lines match up and slightly overlap to seal it in. Anyway just some food for thought
Pancake.. food for thought... :laughing:
Snake is certainly doable, just make the line based on the outside tangent and connect the ends. Will need some real world testing to see which works better.
For sure. It is all about testing!
All this week I've been working hard to find a way to will using the given mathematical boolean operations on paths.. and it seems like they're just not made for non-filled/closed paths.
On the Wikipedia page for flood fill, they actually list the open source vector editor Inkscape as one that does a vector fill. I checked and it does indeed have a vector flood fill, but I believe they're definitely cheating. A flood fill of a circle does not result in a perfectly circular filled path, but.. a slightly lumpy uneven one that still does a fine job of filling it. Reading the documentation on the feature, it's purely a perceptual thing, meaning that it looks at what matches and what doesn't and converts the pixels to a vector when it's done!
If we were to use a similar method, we would get around solving the very complex math required for the boolean method, and we'll get paths that are probably more than adequate for pancake fills, if not perfectly matching the lines.
Of course the work still has to be done to convert what we have to raster, finding the closed area, run a flood fill algorithm on it, convert that to boundary points, reorder those points via distance, then convert that to a shape, then simplify that. Sheesh! And that's not even fully accounting for internal filled path occlusion. Oh well, I have my work cut out for me :)
Ok, looks like it's time! First, the results:
I've implemented basically exactly what I mentioned above:
I did a little digging and found a few more instances of the triangle crossover, turns out it's partially the island grouping threshold to blame, so I doubled it and it seems to be quite happy. I think I'm going to leave this issue be, and the next build with this will be to the m4 wrap issue.
Using a selected color, a user can click in the void between any overlapping lines or closed paths to create a new filled shape.