A little confused about concatenating NSAffineTransform
A little confused about concatenating NSAffineTransform
- Subject: A little confused about concatenating NSAffineTransform
- From: Graham Cox <email@hidden>
- Date: Sun, 10 Oct 2004 21:56:28 +1000
I'm trying to set up the following:
1. several separate graphical objects, each having their own position
and rotation angle, are then grouped
2. The group of objects may be additionally scaled and rotated about
their common centre
I have 1) working fine, but 2) is proving trickier. The way I am
attempting this is to try and avoid the group needing to manipulate the
paths etc. of the owned objects. Instead, I want the group to
manipulate the current graphics context transformation, draw the
objects in the normal way, then restore the graphics context. This way,
the group doesn't need to know how the individual objects in the group
actually implement their drawing, allowing objects of different types
to be easily grouped.
Problem I'm having is setting up the current CG transformation matrix
appropriately. The group knows the point of the common centre of the
grouped objects, and its own rotation angle and scale factors. I can
generate a transformation matrix from this info (which is known to be
OK because it is used to draw the handles and bounding path of the
group, which are behaving as they should), but when I concat this with
the current CG, things don't work as they should. I've tried a number
of variations, such as offsetting to the origin, doing the rotation and
offsetting back, but as far as I can tell the two translations cancel
out and the objects end up rotating around the view origin, not the
group centre.
Anyone see what I'm missing here?
Graham
_______________________________________________
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