Hi Laurent,
Rather than post-process the segments, is it easier to just change the
way we generate the segments to account for the cap/join?
For instance, when we get to capping a segment we have the first moveto
in one half of the path which could be moved "back" by 1/2 lw and the
other path has a final lineto that we can extend by 1/2 lw rather than
appending a new path.
Of course, if the first/last segments are curves then we still need to
append line segments anyway.
Also, we need to be wary of assuming that the interior intersection
points for joins are on the last path segments - the final/initial path
segments may be very short (or, obviously part of a curve) and so this
only helps with first/last segments that are much longer than the lw.
But, other than those caveats, the techniques look promising...
...jim
On 4/14/15 8:16 AM, Laurent Bourgès wrote:
Sorry I forgot mailing lists in CC !
Hi Jim,
Did you start looking at early rejection of segments (clipping) ?
On my side, I looked at the Stroker class and I figured out why it
generates so many segments (4M) for my 800k spiral: mitter join are
generated with many intermediate segments.
I wrote the StrokerTest class to illustrate this issue : it uses the
createStrokedShape() to illustrate / check what the renderer does
(stroking, dashing, culling).
Here is the ductus / pisces output with cap = CAP_BUTT (no extra cap
decoration) and join = MITTER_JOIN: you can see mitter joins are made
with several segments: 2 extra segment per join.
I started understanding and hacking the drawJoin() method = some quick &
dirty hacks to remove the intermediate point and use the intersection
point instead.
- Marlin without collinear Simplifier:
- Marlin with collinear Simplifier: it removes collinear segments:
To conclude, it is promising (many tests with curves remain) but I would
prefer avoiding generating such extra segments in the Stroker / Dasher
as early as possible ... but it seems more tricky !
PS: Cap decoration have the same issue: it generates 3 extra segments
for CAP_SQUARE, but the collinear simplifier eliminate superfluous segments.
Does anybody have any idea / opinion ?
Is there any reason to generate these intermediate segments (winding
rule, ...) as ductus / pisces does ?
Does it seem possible to remove them definitely for the marlin renderer
at least ?
Cheers,
Laurent