Hello.

    So, I've been working on removing flattening from pisces (except for AA).
The following compiles and sort of works:
http://icedtea.classpath.org/~dlila/webrevs/noflatten/webrev/

    The changes to the AA renderer are small, and for dashing I used the 
algorithm
in your last e-mail. That has worked well so far. Actually, dashing is a bit 
more complicated, since that algorithm computes the arc length given the 
parameter
t. For dashing we needed the inverse of this function. Nevertheless, I found
something and dashing seems to work. For now I would like someone to take a look
at just Stroker.
    To widen cubic curves, I use a cubic spline with a fixed number of curves 
for
each curve to be widened. This was meant to be temporary, until I could find a 
better algorithm for determining the number of curves in the spline, but I 
discovered today that that won't do it.
    For example, the curve p.moveTo(0,0),p.curveTo(84.0, 62.0, 32.0, 34.0, 
28.0, 5.0)
looks bad all the way up to ~200 curves. Obviously, this is unacceptable.

It would be great if anyone has any better ideas for how to go about this.
To me it seems like the problem is that in the webrev I chop up the curve to be
interpolated at equal intervals of the parameter.

Thanks,
Denis.

----- "Jim Graham" <james.gra...@oracle.com> wrote:

> Denis Lila wrote:
> > Hi Jim.
> > 
> >> I think the first version is a better choice for now since you said
> that 
> >> the performance difference isn't noticeable.  I think the lower
> level 
> >> flattening might look a little different if we ever decide to
> upgrade 
> >> the pipeline to deal with curves.  In particular, you are still 
> >> flattening above the dashing/stroking code and I think the
> flattening 
> >> should be done below that code (i.e. in Renderer).
> > 
> >     Wouldn't we still need to flatten for dashing? Is there some way
> to
> > quickly compute the arc length of a bezier curve from t=0 to
> t=some_number?
> > As far as I can see the function for this computation is the
> integral of
> > sqrt(polynomial_of_degree_4), and that would be pretty nasty.
> > Or maybe we can get around this somehow?
> 
> There should be.  Google turns up a few hits for "compute arc length
> for 
> bezier curve" that should be enlightening.
> 
> BTW, have you looked at a widened dashed curved path with the closed 
> JDK?  I'm pretty sure it outputs dashed curves which proves the
> point.
> 
> I have also computed these lengths for other projects (the shape 
> morphing used in some JavaOne demos and Java FX) using the following 
> process:
> 
> - Compute the length of the control polynomial.
> - Compute the length of the line between the endpoints.
> - When they are within "epsilon" return the average as the arc
> length.
> - Otherwise subdivide and try again.
> 
> I think you could also do something that looked at the relative angles
> 
> of all of the control segments and if they are close enough to each 
> other then you can compute the arc length using a simplified equation
> or 
> simply empirically match this to the "close enough" rule as above.
> 
>                       ...jim

Reply via email to