[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image transformations

From: YAMAMOTO Mitsuharu
Subject: Re: Image transformations
Date: Fri, 14 Jun 2019 20:45:37 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (Goj┼Ź) APEL/10.8 EasyPG/1.0.0 Emacs/25.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

On Fri, 14 Jun 2019 19:55:49 +0900,
Richard Copley wrote:
> On Fri, 14 Jun 2019 at 11:45, Alp Aker <address@hidden> wrote:
> > On Thu, Jun 13, 2019 at 3:01 PM Richard Copley <address@hidden> wrote:
> >
> > >     Yes, but our transformation includes translation, rotation, and
> > >     another translation.  Not just one translation.  IOW, it isn't the
> > >     transformation matrix that is given; it's the operation on the image.
> >
> > There's a miscommunication here.  I was speaking to Alan's question about
> > how
> > to geometrically interpret the components of a transformation matrix.
> >
> > If the question is what translations to use in order to generate a rotation
> > around an arbitrary point p, then there's no question: the sequence of
> > operations is translation by -p, then rotation, then translation by p.
> >
> > > The origin is at the top left so a pure rotation clockwise about the
> > origin
> > > through angle a goes like this:
> > >
> > > [cos(a)  -sin(a)  0] [X]   [cos(a) * X - sin(a) * Y]
> > > [sin(a)   cos(a)  0] [Y] = [sin(a) * X + cos(a) * Y]
> > > [     0        0  1] [1]   [                      1]
> >
> > That is a counter-clockwise rotation.
> >
> Are you sure?
> This matrix takes (1, 0) to (cos(a), sin(a)), which is roughly (1, a) for
> small a.
> I think that's clockwise, if a is positive. (Remember the y axis points
> down.)

Other than the direction of the Y axis, there are several sources of

1. Some people (mathematicians?) prefer operating on column vectors
   with matrix multiplication from left, others (computer graphics
   people?) prefer operating on row vectors with matrix multiplication
   from right.  Conversion between them involves transposition.

2. At least on cairo, there are "current transformation matrix", which
   is from user space to device space, and "pattern's transformation
   matrix" which is from user space to pattern space.  Here's a quote
   from the document of cairo_pattern_set_matrix telling caveats about
   the latter one:

     Important: Please note that the direction of this transformation
     matrix is from user space to pattern space. This means that if
     you imagine the flow from a pattern to user space (and on to
     device space), then coordinates in that flow will be transformed
     by the inverse of the pattern matrix.

   The matrix constructed in image.c is of the latter type, which is
   more-or-less directly usable on XRender and cairo.  But NS only has
   the former type of transformations.  That's why the NS code
   involves matrix inversion (not transposition).

One must clarify the context then talking about transformation matrices.

                                     YAMAMOTO Mitsuharu

reply via email to

[Prev in Thread] Current Thread [Next in Thread]