Article View: comp.lang.postscript
Article #308Re: rotation in postscript (stupid question)
From: Kevin Grover
Date: Wed, 22 Jul 1992 19:21
Date: Wed, 22 Jul 1992 19:21
73 lines
3212 bytes
3212 bytes
In article <3606@fcs280s.ncifcrf.gov>, toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:
)
) This bombed under OpenWindows 2 with this message:
)
) It drew a circle with ticks and 3 numbers; then a second displaced
) ticked circle. On my LaserWriter NTXII I just got the first circle
) and nothing else. It's debugging time!
)
Opps. It worked under GhostScript 2.4.1, so I ASSUMED it was
correct!! Actually the problem was that true PostScript interpreters
were adding a ".0" to the end if the degrees because the divide caused
the number to be a real instead of an integer (this was too long for
the 3 string buffer I was using). The fix is to change the line
begginig with the command "10 div" to "10 div cvi" (i.e. convert the
number to a integer. (Or, the size of the string could be increased
to 4 to handle the longers strings, but then all of the numbers would
end in ".0", not as nice a fix)
I discovered this because it would not run on our NeXT machines
either ... Sorry for the hassle
For the those you who do not wish to find and correct this, the fixed
program follow my .sig
- kev
--------------------------------------------------------------------------
Kevin O. Grover | UNLV Computer Science and Electrical Engineering
grover@isri.unlv.edu | ISRI - Information Science Research Institute
CServe: [73627,1677] | 4505 S. Maryland Parkway, Las Vegas NV 89154-1017
%!
% Compase Rose ? (An(other) Attempt any Way)
% - Kevin O. Grover, grover@isri.unlv.edu
% Tue Jul 21 11:05:39 PDT 1992, Wed Jul 22 12:18:09 PDT 1992
%
gsave
3 3 scale
newpath % Start a new path
2 setlinewidth % Draw circle in 2 pt line
100 100 50 0 360 arc stroke % Draw the circle
/s 3 string def /Helvetica findfont 6 scalefont setfont
100 100 translate 0 0 moveto % Move origin
10 10 360 { % Draw longer lines
gsave
rotate
0 45 moveto 0 10 rlineto stroke
grestore
} bind for
1 setlinecap
30 30 360 { % Put arrows an numbers
gsave % Every 30 degrees
dup rotate
0 45 moveto 0 55 lineto stroke
-2 50 moveto 0 55 lineto 2 50 lineto stroke
10 div cvi % Eat the trailing 0 from number
% If you don't want the number rotated with the line, delete
% the "90 rotate", you can also delete the "gsave/grestore" pair
gsave 1.5 60 translate 0 0 moveto 90 rotate s cvs show grestore
grestore
} bind for
1 setlinewidth % Change linewidth for short lines
5 10 355 { % Draw shorter lines
gsave
rotate
0 47 moveto 0 6 rlineto stroke
grestore
} bind for
grestore
showpage
Technical Details
Message-ID:
<1992Jul22.192127.29813@unlv.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!nevada.edu!jimi!mighty-joe.isri.unlv.edu!groverReferences:
<1992Jul20.210405.21140@usho93.hou281.chevron.com> <1992Jul21.184121.20437@unlv.edu> <3606@fcs280s.ncifcrf.gov>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript Path: arc1-ca.pugleaf.net!sparky!uunet!nevada.edu!jimi!mighty-joe.isri.unlv.edu!grover From: grover@mighty-joe.isri.unlv.edu (Kevin Grover) Subject: Re: rotation in postscript (stupid question) Message-ID: <1992Jul22.192127.29813@unlv.edu> Sender: news@unlv.edu (News User) Reply-To: grover@isri.unlv.edu Organization: Information Science Research Institute (UNLV-ISRI) References: <1992Jul20.210405.21140@usho93.hou281.chevron.com> <1992Jul21.184121.20437@unlv.edu> <3606@fcs280s.ncifcrf.gov> Date: Wed, 22 Jul 92 19:21:27 GMT Lines: 76