OK, I have added it like this:
def shear(xshear=0, yshear=0):
        """Creates a shear transformation in either X and/or Y directoion"""
        return (1, yshear, xshear, 1, 0, 0)

Note that the 6-tuple representation goes in columns, so I swapped the
yshear/xshear values from what you had in your example.  I don't think any
of the other transforms in the document are very relavent (projection is
pretty boring in 2D.  If you need it you can easily create the 6-tuple for
the situation).

Generally you can think of the linear transformation given by the matrix
[a b; c d] as translating the base vector (1,0) to (a,c) and (0,1) to
(b,d).  This way of thinking is quite useful, since if you know that the
transformation you want is linear (takes (0,0) to (0,0), preserves
linear combinations) and it takes (1,0) to (w,x) and (0,1) to (y,x), then
the affine transformation 6-tuple is (w,x,y,z,0,0).

I think that is enough maths for a bit.  The affine module should be
enough for most people.

James Henstridge.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Fri, 12 Mar 1999, David M. Cook wrote:

> On Fri, Mar 12, 1999 at 05:48:21PM +0800, James Henstridge wrote:
> 
> > People were wondering about if I could add an affine transformation helper
> > module to gnome-python so I have.  I have included it at the end of the
> > message for people who are interested (if it looks like there are some
> > bugs in it, please send in the reports)
> 
> Cool.  I would add a shear which has the general matrix form
> 
> | 1  g |
> |      |
> | h  1 |
> 
> 
> h=0, g nonzero gives a pure shear in the y direction
> g=0, h nonzero gives a pure shear in the x direction
> 
> def shear(g=0, h=0):
>     return (1, g, h, 1, 0, 0)
> 
> Here's a nice paper with examples of the basic 2-d transformations:
> 
> http://cs.fit.edu/~wds/classes/cse5255/thesis/index/index.html
> 
> Dave
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to