Re: any shear can be achieved by combining rotation and scale

Giganews Newsgroups
Subject:Re: any shear can be achieved by combining rotation and scale
Posted by: Dave Eberly (dNOSPAMeber…@usemydomain.com)
Date:Tue, 07 Feb 2006

"Vasileios Zografos" <vasilei…@NOSPAMzografos.org> wrote in message
news:43e89e5c$0$27788$6d36ac…@titian.nntpserver.com...
> How is this possible?
> Can someone show me this please for the 2d case.

The singular value decomposition guarantees that M = L*D*R
for some orthogonal matrices L and R and for some diagonal
matrix D.  So try
  M = {{1,a},{0,1}}, L = {{c0,s0},{-s0,c0}},
  R = {{c1,-s1},{s1,c1}}, D = {{d0,0},{0,d1}}
where c0 and c1 are cosines and s0 and s1 are sines.  The
equations you obtain by equating M and L*D*R are
  c0*c1*d0 + s0*s1*d1 = 1
  -c0*s1*d0 + s0*c1*d1 = a
  -s0*c1*d0 + c0*s1*d1 = 0
  s0*s1*d0 + c0*c1*d1 = 1
Also, s0*s0+c0*c0 = 1 and s1*s1+c1*c1 = 1.  From basic
principles, 1 = det(M) = det(D), so d0*d1 = 1.  A bit of
algebra shows that d0 = c0/c1 and d1 = c1/c0.  Substitute
these into the four displayed equations to obtain the two
independent equations
  s0*c0 = s1*c1
  a*c0*c1 = s0*c1*c1*c1 - s1*c0*c0*c0

If s0 = sin(t0), c0 = cos(t0), s1 = sin(t1), and c1 = cos(t1),
the first of these equations implies sin(2*t0) = sin(2*t1).
If you try t0 = t1, the second equation forces c0 = 0 when
a is not zero, but this is not possible since d1 is then undefined.
Instead you need 2*t0 and 2*t1 to be symmetric about pi/2,
in which case t1 = pi/2 - t0, and s1 = c0 and c1 = -s0.

Substitute these into the second of the previously displayed
equations to obtain
  (2*s0*c0)*(2*s0*c0) + a*(2*s0*c0) - 2 = 0
If you set x = 2*s0*c0, you have a quadratic equation
  Q(x) = x*x+a*x-2 = 0
for which you want a root x in the interval [-1,1] because
x = 2*s0*c0 = sin(2*t0).  Given this root, solve t0 = 0.5*asin(x).

If |a| <= 1, Q(1)*Q(-1) = 1-a*a <= 0, so there must be
such a root x.  If a > 1, Q(1)*Q(0) < 0, so there is such
a root x.  If a < -1, Q(-1)*Q(0) < 0, so there is such a root x.

--
Dave Eberly
http://www.geometrictools.com

Replies

In response to

any shear can be achieved by combining rotation and scale posted by Vasileios Zografos on Tue, 7 Feb 2006