🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #316

Dotted line question

#316
From: David A. Tong
Date: Thu, 23 Jul 1992 15:47
33 lines
1893 bytes
  I am new to this PostScript stuff so forgive me if this is a trivial 
question.  In a program I am writing, I create a PostScript output file
from a C program.  I need to draw a grid of dots that are spaced 5 mm
apart.  The macro definition below is my first attempt at accomplishing
this task.  This macro accepts a starting x position, an ending x position,
and a y position and then draws a horizontal dotted line.  This line is
composed of groups of 4 dots spaced 5 mm apart with a 10 mm separation
between dot groups.  Like this: ( .... .... .... .... ). Please note
that a dashed line will not work.  The dots need to be spaced exactly
5 mm apart with 10 mm between dot groups.  I have set the scale to be
1mm in both the x and y directions.

  Although this function does the job, printing the resulting
PostScript file takes an unacceptably long time (I am using an HPIII with
HP PostScript cartridge and a Sparc 2).  I was wondering if anyone has
a better way or any tips that will improve this macro.  Any help will be
greatly appreciated.  Please email or post.

Thanks,
   David A. Tong

-----------------------------------------------------------------------
/dot_line
  { /dy exch def 
     /maxx exch def /dx exch def
     dx 1 maxx
      { dx 5 div dx 5 idiv sub 0 eq
        { /dx dx 1 add def }
        { dx dy 0.05 0 360 arc fill /dx dx 1 add def }
        ifelse 
      } for clear
  } def
Technical Details
Message-ID: <1992Jul23.154738.15892@engr.latech.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!newshost.latech.edu!dat

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!newshost.latech.edu!dat
From: dat@engr.latech.edu (David A. Tong)
Newsgroups: comp.lang.postscript
Subject: Dotted line question
Message-ID: <1992Jul23.154738.15892@engr.latech.edu>
Date: 23 Jul 92 15:47:38 GMT
Article-I.D.: engr.1992Jul23.154738.15892
Followup-To: dat@engr.latech.edu
Distribution: na
Organization: Louisiana Tech University
Lines: 33