On Sat, 2008-07-19 at 01:17 -0300, bulia byak wrote:
> Problems so far: create two open paths with two nodes and a bezier
> segment each. Do a boolop of them. Problem #1: the result is closed,
> not open even for union (livarot has the same problem).
njh and I have been talking about this; the main issue is deciding what
interpretation to give an open path which has no area (boolops currently
work in terms of area). I think the answer we settled on was to treat
the line of open paths as if it were "solid", albeit with zero
thickness. For example, intersecting a line with a shape leaves you
with just the portions of the line which lie inside the shape.
An interesting question is whether it should really be open versus
closed, though... I wonder whether filled versus unfilled ought to be
the real distinction for boolops purposes? At least, it might make more
sense from an artistic/visual perspective.
> Problem #2:
> after converting to path, the points of intersection of the beziers
> have two nodes at the same place instead of one.
This has given me some headaches.
Our main goal was, when we cut a path segment in boolops, the point of
the cut must lie exactly on the segment, so that the segment's shape is
not altered. This saves us from the problems that most boolops
implementations like livarot's have, where they can end up with invalid
intersection topology because the curves have moved around. Also, even
when the topology would have remained valid, exact cuts should eliminate
most of the bug reports we get about boolops being visibly inexact.
It turns out, however, that the exact point of intersection of two
curves does not always lie in a place which can be represented by
rational numbers (let alone floats). In that case we must cut at the
nearest representable points which are still actually on each segment,
and then join the cuts with a short line segment so that we still have a
continuous path without altering the shape of the segments on either
As far as I can tell at this point, this seems to be the only way to do
exact boolops within the limitations of floats. In these cases it is
basically a tradeoff between simple node structure on one hand, and
visually+mathematically exact results on the other.
> Problem #3: too much debug output in the console :)
That will go. I need to tease mgs some more about removing it. :)
> Thanks, you rock! If these work well and if you can also implement
> division, cut path, inset/outset, and simplify, then we can switch all
> path commands to 2geom.
Division/cut path should be covered by the same code as boolops support
for open/unfilled paths. I believe the rest is already implemented,
although it still needs some final work polish.