Date: Tue, 28 May 2002 09:18:41 -0400
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Arthur J. Kendall" <Arthur.Kendall@VERIZON.NET>
Subject: Re: Macro question (was MDS)
Content-Type: text/plain; charset=us-ascii
If you want, for example, a 90 deegree counter clockwise rotation, you might try 270 degrees clockwise.
Perhaps, you could generalize your macro by subracting negative arguments from 360.
michael healy wrote:
> Dear Listmember,
> I've written a macro that will rotate a 2-d matrix. I'd like to be able to perform counterclockwise rotation by assigning theta a negative value, but the macro doesn't seem to read in negative numbers correctly. My workaround is to quote the negative degrees for the macro call and unquote it within the macro. Does anyone have a suggestion as to how I can skip the quoting business?
> Mike Healy
> /* rotates a two-dimensional matrix THETA degrees clockwise.
> /* Negative theta of values for counter-clockwise rotation.
> /* quotes for theta (which is in degrees) are necessary.
> define rotate(theta = !tokens(1)
> /x = !tokens(1)
> /y = !tokens(1)
> /cw =!tokens(1) !default(1)).
> comp #rad = (!unquote(!theta) * 3.141592654)/180.
> comp !concat(!x, 'p') = !x*(cos(#rad) - sin(#rad)).
> comp !concat(!y, 'p') = !y*(cos(#rad) + sin(#rad)).
> rotate theta='-10' x=x y=y.