> 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. It was just a stream of consciousness statement intended to
express that my son actually caused me to remember the terms "associative" and
"commutative". I was reminded by a third grader :)
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.
_______________________________________________
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