Re: Resizing bezier objects.
Re: Resizing bezier objects.
- Subject: Re: Resizing bezier objects.
- From: Robert Clair <email@hidden>
- Date: Sun, 23 Oct 2005 11:42:56 -0400
However in the sketch example the rectangles are normal to the image..
So when you resize them, you are either making them wider or taller.
But what if the rectangle is rotated by a few degrees? When you drag
the object by its control points to resize it, what should its
behavior be?
It gets wider or taller because that's how the designer of Sketch wanted
the application to work. The user manipulates the resize handles (they
are *not* the control points of the path except accidentally in the case
of the corners of a rectangular path, they mark the corners and
midpoints of
the sides of the path's bounding box in a coordinate system aligned
to the
screen) to indicate a new rectangle that he/she would like the path
to fit
in and the program calculates the appropriate transform and applies
it to the
path. It would do this to any shaped path in any orientation.
There is no "should" involved - it depends what you want your program
to do.
I understand that bezier objects can have transforms like rotation and
scaling applied to them. How do I rotate a path about a point or
line?
The
- (void)transformUsingAffineTransform:(NSAffineTransform *)aTransform
of NSBezierPath will apply an affine transform contained in an
NSAffineTransform
object to all the points in the path. An affine transform is one
which, when
applied to a parallelogram results in another parallelogram -
basically translation,
rotation, reflection, scaling and shear. NSAffineTransform has
methods to
create some of these, others can be built up by successive
applications of
these methods or by setting the individual matrix elements. (There is
no such thing
as rotation about a line in 2D, only rotation about a point or
reflection about
a line.)
But none of this is really Cocoa or even Quartz: It is Computer
Graphics 101. From
the general tenor of your questions I think you'd find life a lot
easier if you
spent some time with the sections on matrices, transforms and
homogeneous coordinates
in a text on basic computer graphics. I'm not familiar with the
current crop so I don't
have a recommendation. Perhaps someone else on the list has a favorite.
Another option is the web. A number of very industrious professors
seem to have
posted their course notes on the web, a bit of vigorous Googling can
turn them up.
...Bob Clair
------------------------------------------------------------------------
--------
OK, put the gamba down slowly and nobody gets hurt.
_______________________________________________
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