On Jun 17, 2009, at 11:53 PM, Erik Buck wrote:

My third grader was taught about associative and commutative math operations. Some matrix operations are associative and some are commutative. That's why the order of operations matters.

Just in case: I didn't mean to imply that even third graders should understand matrix math.

They do in Star Trek The Next Generation. Or maybe it was calculus.

You're absolutely correct in general, but - if I'm not mistaken - CGAffineTransform rotations and scalings already do their thing with respect to the center of the view they're being applied to. In fact, I tested that before writing my solution to the OP's problem. And that is indeed the source of the problem. Rotations and scalings, as implemented by CGAffineTransform, are with respect to the view's center but translations are with respect to the view's origin. Therefore, if you scale while you translate, the view's origin changes and the translation is no longer being applied with the correct offset.

To be honest, I'm a bit surprised that CGAffineTransform rotations and scalings are already defined with respect to the center of the view. There's still a part of my brain that thinks that that isn't true, but my tests indicated otherwise.

Wagner


OK. I will have to try this at home. If you create a CGAffineTransform as I did and then use [myUIView setTransform:myTransform], how can a UIView know that part of my transform matrix applies one way and another part applies another way ? I think it is mathematically impossible unless the view is pulling components out of the transform matrix rather than just concatenating the matrix I supply with whatever matrix it's superview uses. If it pulls components out of the transform matrix, it is not a proper affine transform (because shear and skew and some degenerate cases will not work) and all of the functions are misnamed.

Your objections are precisely the reasons why some part of my brain is screaming at the rest of it for publicly making a statement which it believes to be incorrect. It may sound strange, but I'll be happy to be proven wrong on this one.

Wagner
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to