LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 28 May 2002 09:18:41 -0400
Reply-To:     Art@DrKendall.org
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Arthur J. Kendall" <Arthur.Kendall@VERIZON.NET>
Subject:      Re: Macro question (was MDS)
Comments: To: healym@earthlink.net
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? > Thanks, > 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)). > exe. > !enddefine. > > rotate theta='-10' x=x y=y.


Back to: Top of message | Previous page | Main SPSSX-L page