
Joel de Guzman wrote:
I had a look at Fusion, but I'm not sure whether it would be helpful in this context. TinyVector is based on three design goals: it should support the std::vector interface (except for resize etc.),
Like boost::array?
Similar, but more sophisticated. E.g. it has separate view templates that don't own the data, and provides a number of mathematical functions with loop unrolling.
like a built-in arithmetic type (except for division which is problematic because the zero vector is not the only one that may cause a division-by-zero error).
No problem. But have you seen Andy's work on matrices using fusion?
No, can you provide a pointer?
Fusion may be more helpful in heterogeneous pixel types, but they often have very specific requirements that are perhaps better handled explicitly.
Like what, for example?
How about RGBA? How would a Fusion version of alpha blending two pixels look like? The formula is RGB' = alpha2*RGB2 + (1-alpha2)*alpha1*RGB1 alpha' = alpha2 + (1-alpha2)*alpha1 where pixel 2 is in front of pixel 1. Alternatively, with premultiplied alpha we have RGBA' = RGBA2 + (1-alpha2)*RGBA1 When the individual channels are represented by uint8, we must add functionality to stay in the range 0...255. Regards Ulli -- ________________________________________________________________ | | | Ullrich Koethe Universitaet Hamburg / University of Hamburg | | FB Informatik / Dept. of Informatics | | AB Kognitive Systeme / Cognitive Systems Group | | | | Phone: +49 (0)40 42883-2573 Vogt-Koelln-Str. 30 | | Fax: +49 (0)40 42883-2572 D - 22527 Hamburg | | Email: u.koethe@computer.org Germany | | koethe@informatik.uni-hamburg.de | | WWW: http://kogs-www.informatik.uni-hamburg.de/~koethe/ | |________________________________________________________________|