Re: Inviting to comment on Cocoa categories
Re: Inviting to comment on Cocoa categories
- Subject: Re: Inviting to comment on Cocoa categories
- From: Roland King <email@hidden>
- Date: Mon, 10 Nov 2008 19:16:36 +0800
possibly drifting towards off topic here but ...
An Affine Transform (in the context we're talking about here here) is
a transform which maps straight lines to straight lines. If it was
straight when you started, it's straight after you're done. It also
preserves the relative distance between points on a line, so if you
have 3 points and the third one is 10x as far away from the first one
as the second one is, after the transform, that's still true.
It consists of a linear transform (which doesn't move the origin) and
a translation, which can. Linear would be scaling, shearing (ie
scaling more on one axis than another) and rotation, but it's totally
multiplicative and so the origin stays fixed. The translation
afterwards then moves the origin around. So Affine Transform = Linear
Transform + Translation.
You can actually represent an affine transform with a purely
multiplicative matrix by adding an extra row and column to the Linear
Transform matrix with the translation vector and a few carefully
placed 0s and 1s and adding an extra 1 to the point you're moving
around. This really just adds a dimension, moves your world off the
origin of it and then the translation becomes a shear in a dimension
you don't care about. The result you get is the projection back onto
the original space.
So an Affine Transform can be represented by a pure matrix
multiplication, including the transformation bit, and you can combine
any number of them by multiplying matrices. No addition necessary.
On Nov 10, 2008, at 6:40 PM, Kyle Sluder wrote:
On Sun, Nov 9, 2008 at 10:58 PM, Michael Ash <email@hidden>
wrote:
Whoops, you're right. Still, NSAffineTransform can obviously do
translations, so surely this objection does not make sense?
It's a gut reaction. Not being a linear algebra guru, I'm wondering
if it's done to avoid confusion; perhaps it's rather easy to create a
case in which a set of rotations and translations looks like it should
map one way but does another. If I remember correctly, matrix
multiplication does not distribute over matrix addition, and since a
transformation matrix stack is essentially a product of sums, the API
designers might, as you suggest, have simply left the functionality
out for the sake of clarity.
Interestingly enough, I can't recall seeing any graphics API that
provided rotation around a point. I know DirectX doesn't.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden