Article View: comp.lang.postscript
Article #291Re: rotation in postscript (stupid question)
From: Kevin Grover
Date: Tue, 21 Jul 1992 18:41
Date: Tue, 21 Jul 1992 18:41
67 lines
2959 bytes
2959 bytes
In article <1992Jul20.210405.21140@usho93.hou281.chevron.com>, hdnea@usho92.hou281.chevron.com (David Neal) writes:
)
) I'm pretty stupid when it comes to postscript, so if you want
) to throw RTFM references at me, go ahead. Just tell me which FM.
)
) I want to paint a compass rose. What's a compass rose? A circle
) with long dashes every 10 degrees and short dashes every five.
) The dashes are drawn on a line from the center of the circle.
) Every 30 degrees the long dash is replaced with an arrow pointing
) outward from the circle. And, text is placed above the circle
) every thirty degress indication the compass position. Trailing zeroes
) are dropped. (3, 6, 9, 12, 15 = 30, 60, 90, 120, 150)
)
) How do I go about getting the rotation done in postscript. Just rotating
) the entire axes doesn't do what I want.
)
Here's a quick hack that does what you want, I think! Anyway, if you
would like me to explain parts better, drop me an email....
--------------------------------------------------------------------------
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 Attempt any Way)
% - Kevin O. Grover, grover@isri.unlv.edu
% Tue Jul 21 11:05:39 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 % 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:
<1992Jul21.184121.20437@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>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: <1992Jul21.184121.20437@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> Date: Tue, 21 Jul 92 18:41:21 GMT Lines: 68