RE: Probem with finding out Transformed objects Points.
RE: Probem with finding out Transformed objects Points.
- Subject: RE: Probem with finding out Transformed objects Points.
- From: Erik Buck <email@hidden>
- Date: Wed, 1 Nov 2006 07:35:44 -0800 (PST)
First: You need to understand what you are doing when you transform a coordinate system using NSAffineTransform. A mailing list is not a good forum for detailed explanation of basic computer graphics principals. There are lots of good books on the subject including the seminal text book, "Computer Graphics, Principles and Practice" by Foley & Van Dam et. al. http://www.amazon.com/Computer-Graphics-Principles-Practice-2nd/dp/0201848406
There are less comprehensive free explanations on the web as well.
Second: You can use methods like the following:
- (NSPoint)transformPoint:(NSPoint)aPoint
- (NSSize)transformSize:(NSSize)aSize
- (void)invert
The basic idea is that to transform a point in a rotated/scaled/translated coordinate system into the "base" coordinated system system, you use -transformPoint:. In your case, the "base" coordinate system will be the untransformed coordinate system of the view.
To go the other way and convert a point in base coordinates to a point in the transformed coordinate system, invert the affine transform matrix and use -transformPoint:. Just be cautious that not all affine transforms have an inverse!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden