Article View: comp.lang.postscript
Article #1558Re: Drawing lots of triangles
From: Woodrow Baker
Date: Thu, 18 Jan 1990 19:39
Date: Thu, 18 Jan 1990 19:39
73 lines
2770 bytes
2770 bytes
> %!
> %%BoundingBox: 0 0 612 792
> %%EndComments
> initgraphics
> 8.5 72 mul 0 translate 90 rotate 72 1000 div dup scale
> 2.0 setmiterlimit 60 45 {add .5 mul} setscreen
> /NP {newpath} def /SD {setdash} def /SG {99 div setgray} def /MT {moveto} def
> /LT {lineto} def /CP {closepath} def /GS {gsave} def /FL {fill} def
> /GR {grestore} def /SK {stroke} def /LW {setlinewidth} def
> /PLP {1024 1 true [1024 0 0 1 0 0] {<8080808080808080>} imagemask} def
> /WLP {1024 1 true [1024 0 0 1 0 0] {<8888888888888888>} imagemask} def
> erasepage
> [... other graphics stuff deleted, triangles follow]
> NP 8761 6576 MT
> 8781 6584 LT
> 8782 6574 LT
> 8761 6576 LT
Well, this last line probably could be replaced with a closepath operator
certainly, the 2 character abrevieations should be reduced to single character
abreviations, and it would be better to create a routine called triangle
that would take the coordinate pairs, and do a triangle
so that
8782 6574 8781 6584 8761 6576 triangle
/triangle
{
moveto lineto lineto closepath
}
of course you would use t or tr instead of triangle.
or send it 4 pairs and use
moveto lineto lineto lineto
or mt lt lt lt....
or
/triangle
{
NP MT LT LT LT CP GS 99 SG FL GR
}
> CP GS 99 SG FL GR
> NP 8761 6576 MT
> 8760 6587 LT
> 8781 6584 LT
> 8761 6576 LT
> CP GS 99 SG FL GR
> NP 8740 6581 MT
> 8760 6587 LT
> 8761 6576 LT
> 8740 6581 LT
> CP GS 99 SG FL GR
> ... about 180,000 times
>
> Is there anything obviously inefficient about the way this is being printed? I
> see from the 'boxes' discussion that I could redefine the NP, MT, LT, etc. to
> be one letter, but that is a small savings. Any other suggestions? (I don't
> have the source the graphics package, but I could get it, or use post-processing
> under either Ultrix or VMS.)
>
> ++Eric Fielding
> eric@geology.tn.cornell.edu
> eric@crnlthry.bitnet
Cheers
Woody
There are probably some other things one could do as well. It seems that
there are lots of coordinate repititions that might be telescoped to gether.
It might also be possible to write the range of coordinates out to a large
array, and then index the array inorder to get the cordinates. Each
one of these, however when taken together, would probably exceed permissible
array space.
Technical Details
Message-ID:
<17689@rpp386.cactus.org>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!natinst!sequoia!rpp386!woodyReferences:
<9561@batcomputer.tn.cornell.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!natinst!sequoia!rpp386!woody From: woody@rpp386.cactus.org (Woodrow Baker) Newsgroups: comp.lang.postscript Subject: Re: Drawing lots of triangles Summary: yes Message-ID: <17689@rpp386.cactus.org> Date: 18 Jan 90 19:39:31 GMT References: <9561@batcomputer.tn.cornell.edu> Distribution: na Organization: River Parishes Programming, Plano, TX Lines: 73