2011/2/4 <J.B.C.Engelen@...1578...>:
I temporarily fixed this. It is indeed a bug in 2geom: multiplication of matrices. Geom::Affine const affine(Geom::Translate(-norm) * rel_affine * Geom::Translate(norm) ); changed to Geom::Affine const affine( (Geom::Affine)Geom::Translate(-norm) * rel_affine * (Geom::Affine)Geom::Translate(norm) ); fixes it. Without the casts, the Translate matrices are effectively ignored. Perhaps with the new operator stuff, the compiler reorders the multiplication, Krzystof?
Cheers, Johan
Based on the symptoms, I think when you write: trans(-p) * scale(x) * trans(p) it gets reodered to: scale(x) * trans(-p) * trans(p) so the transformation always starts from the origin. Similarly for rotation.
I looked closer at the manual, and it looks like boost::operators contains a hidden assumption that multiplication is commutative, in the sense that for multipliable<T, U> it generates both T * U and U * T. This second case (U * T) causes problems because it uses T *= U for computation, which is of course wrong. I'll write a multiplication operator helper that does not assume commutativity.
Regards, Krzysztof