Open akx opened 6 years ago
The tricky part is how to know about self-intersection. Do you know an algorithm with complexity less then O(n²)? Rasterization isn't reliable since SVG is really scalable and you can never tell how it'll be used, also I believe it's needs a lot of computation.
This would be a "lossy" transformation for sure, something that's not enabled by default.
Re complexity: Good question. Google suggests the Bentley–Ottmann algorithm, which is O((n+k) / log n)
, but still, the path, which is not necessarily just line segments, would need to be flattened to line segments first. (Or the transformation could just give up on non-line-segment shapes.)
@akx Do you have the idea of achieving it?
+1
It would be useful to be able to remove
fill-rule
stanzas from paths that certifiably do not self-intersect.The implementation might be a little tricky though, as it would involve parsing the path string and rasterizing it or otherwise analyzing it for self-intersection.