Re: Shearing with NSAffineTransform
Re: Shearing with NSAffineTransform
- Subject: Re: Shearing with NSAffineTransform
- From: Thomas Lachand-Robert <email@hidden>
- Date: Wed, 29 May 2002 23:07:33 +0200
Le mardi 28 mai 2002, ` 04:27 , Edwin Zacharias a icrit :
Can someone post a quick example of doing shearing with NSAffineTransform?
I can't seem to find one in the documentation.
A shearing matrix (in the x direction) has the form {1, s, 0, 1}, where s
is the shearing coefficient; use {1, 0, s, 1} for shearing in the y
direction.
So you need to use NSAffineTransform setTransformStruct with these values
(plus two zero values for the translation coefficients).
For instance with s = 2, you get the matrix {1, 2, 0, 1}. The four
vertices of the unit square will change as follows:
(0, 0) -> (0, 0)
(1, 0) -> (1, 0)
(1, 1) -> (3, 1)
(0, 1) -> (2, 1)
hence the two bottom points don't change, but the two top points are moved
by s = 2 in the horizontal direction, which gives the shearing.
Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.