On May 2, Keith Packard wrote:
>
> n u v o
> | / \ |
> l---+------------/----\------------+
> | / \ |
> | a / b \ c |
> | / \ |
> r ===========/============\===========
> | / \ |
> | d / e \ f |
> | / \ |
> s =======/====================\====|
> | / \ |
> |g / h \ i|
> | / \ |
> m---+/----------------------------\+
Keith,
I think we can simplify some of these equations to make implementation
easier without affecting the quality of the result.
As you mentioned, the precise values returned by the area function
really doesn't matter as long as it behaves deterministically. In the
same sense, the precise values returned by the alpha function are not
that important either, (as long as the sum of the polygon alphas is
the same as the alpha of the whole pixel).
You had:
/ area(a) \
alpha(a) = round | alpha(u) * ------- |
\ area(u) /
This could also be computed as:
/ area(a) \
alpha(a) = round | alpha(o) * ------- |
\ area(o) /
which is clearly easy to compute as alpha(o) is constant:
alpha(o) = 2**depth-1
while area(o) is arbitrary and can be conveniently set to 1.
The same reasoning can be applied to all forms:
round(alpha(X) * area(polygon) / area(X))
So, we can define a new function:
alpha_from_area(A) = round(2**depth-1 * A)
and thereby reduce the original equations to:
alpha(o) = 2**depth-1
alpha(a) = alpha_from_area(area(a))
alpha(ab) = alpha_from_area(area(ab))
alpha(b) = alpha(ab) - alpha (a)
alpha(abc) = alpha_from_area(area(abc))
alpha(c) = alpha(abc) - alpha(ab)
alpha(ad) = alpha_from_area(area(ad))
alpha (d) = alpha(ad) - alpha (a)
alpha (abde) = alpha_from_area(area(abde))
alpha (de) = alpha (abde) - alpha (ab)
alpha (e) = alpha (de) - alpha (d)
alpha (abcdef) = alpha_from_area(area(abcdef))
alpha (def) = alpha (abcdef) - alpha (abc)
alpha (f) = alpha (def) - alpha (de)
alpha (adg) = alpha_from_area(area(adg))
alpha (g) = alpha (adg) - alpha (ad)
alpha (abdegh) = alpha_from_area(area(abdegh))
alpha (gh) = alpha (abdegh) - alpha (abde)
alpha (h) = alpha (gh) - alpha (g)
alpha (abcdefghi) = alpha_from_area(area(abcdefghi)) =
alpha_from_area(area(o)) = alpha_from_area(1) = alpha(o)
alpha (ghi) = alpha (abcdefghi) - alpha (abcdef)
alpha (i) = alpha (ghi) - alpha (gh)
It's still easy to verify that the sum of alpha(a)..alpha(i) is
alpha(o).
I don't think this change affects any other desirable properties of
the algorithm. Please let me know if I've missed something.
This change does make the implementation much simpler.
-Carl
--
Carl Worth
USC Information Sciences Institute [EMAIL PROTECTED]
3811 N. Fairfax Dr. #200, Arlington VA 22203 703-812-3725
_______________________________________________
Render mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/render