🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.postscript
4 messages
4 total messages Started by Andrew Newell Mickish Mon, 10 Aug 1992 18:04
Big polygons
#255
Author: Andrew Newell Mickish
Date: Mon, 10 Aug 1992 18:04
12 lines
896 bytes
I need a strategy for printing polygons with an arbitrary number of
vertices.  Currently, I just put all the coordinates on the stack
and pop them off as I draw them.  However, the number of vertices
that can be drawn is limited by the number of elements that can appear
on the stack at one time.

So I guess the question comes down to how do I deal with a very large
number of parameters to a function?

Thanks,

--Andrew Mickish
Re: Big polygons
#1843
Author: Jim DeLaHunt
Date: Fri, 21 Aug 1992 03:44
30 lines
1714 bytes
In article <4eVm0Lq00awAMCPkkW@andrew.cmu.edu> am2q+@andrew.cmu.edu 
(Andrew Newell Mickish) writes:
>I need a strategy for printing polygons with an arbitrary number of
>vertices.  So I guess the question comes down to how do I deal with a 
>very large number of parameters to a function?

In general, write your script in such a way that it the interpreter
consumes code as soon as it receives it.  For instance, don't do
  143.2 246.0 .... (1000 coordinate pairs in reverse order here)
  1000 {moveto} repeat 

Send the coordinates and consume them at once.
  143.2 246.0 lineto 141.59 240.0 lineto ... (998 more "x y lineto" sets)

If you are concerned about data size, then define an abbreviation for 
"lineto".  You can also reduce data size by sending the difference between
coordinates, and by eliminating insignificant digits etc.
  % in prolog
  /l /lineto load def	/r /rlineto load def
  % in script
  143.2 246.0 l -1.41 -6 r ... (998 more "x y r" sets)

>Thanks,
>
>--Andrew Mickish

You're welcome!
	--Jim DeLaHunt, Developer Support, Adobe Systems Incorporated	
delahunt@adobe.com	...!{apple,decwrl}!adobe!delahunt      +1-415-962-3790
In matters of style my word is law!  I work for Developer Support.  :-)
Re: Big polygons
#1848
Author: Andi Loesch
Date: Fri, 21 Aug 1992 07:29
45 lines
2187 bytes
delahunt@adobe.com (Jim DeLaHunt) writes:

>In article <4eVm0Lq00awAMCPkkW@andrew.cmu.edu> am2q+@andrew.cmu.edu 
>(Andrew Newell Mickish) writes:
>>I need a strategy for printing polygons with an arbitrary number of
>>vertices.  So I guess the question comes down to how do I deal with a 
>>very large number of parameters to a function?

>In general, write your script in such a way that it the interpreter
>consumes code as soon as it receives it.  For instance, don't do
>  143.2 246.0 .... (1000 coordinate pairs in reverse order here)
>  1000 {moveto} repeat 

>Send the coordinates and consume them at once.
>  143.2 246.0 lineto 141.59 240.0 lineto ... (998 more "x y lineto" sets)

>If you are concerned about data size, then define an abbreviation for 
>"lineto".  You can also reduce data size by sending the difference between
>coordinates, and by eliminating insignificant digits etc.
>  % in prolog
>  /l /lineto load def	/r /rlineto load def
>  % in script
>  143.2 246.0 l -1.41 -6 r ... (998 more "x y r" sets)

>>Thanks,
>>
>>--Andrew Mickish

>You're welcome!
>	--Jim DeLaHunt, Developer Support, Adobe Systems Incorporated	
>delahunt@adobe.com	...!{apple,decwrl}!adobe!delahunt      +1-415-962-3790
>In matters of style my word is law!  I work for Developer Support.  :-)

But what happens if the length of the polygon becomes too large? If you only want to plot it, you can "stroke" it and everything is ok. How to proceeed when you want to FILL it???

thanks

Andi


--
  Andreas Loesch	Phone   : (+49 89)3209 4086
  Univ. Muenchen	FAX     : (+49 89)3209 4059
  Am Coulombwall 1	E-mail  : Andi.Loesch@Physik.Uni-Muenchen.DE
W-8046 Garching
Re: Big polygons
#1849
Author: Jim DeLaHunt
Date: Fri, 21 Aug 1992 09:05
34 lines
2157 bytes
>delahunt@adobe.com (Jim DeLaHunt) writes:
>
>>In general, write your script in such a way that it the interpreter
>>consumes code as soon as it receives it.  For instance....
>>  % in script
>>  143.2 246.0 l -1.41 -6 r ... (998 more "x y r" sets)

In article <loesch.714382187@hera> loesch@bl.physik.tu-muenchen.de (Andi 
Loesch) writes:
>
>But what happens if the length of the polygon becomes too large? 

We were talking about how to draw big polygons without being limited by
the size of the operand stack.  You are asking about the next obvious
problem, which is about the limit imposed by the PostScript interpreter's
path storage.  The path storage limit depends on the interpreter 
implementation.  For most PostScript Level 1 implementations, this limit
is 1500 vertices.  For PostScript Level 2 implementations, the limit is higher
and more flexible.

The solutions to this problem are unfortunately application-specific.  
If the application knows its polygon doesn't self-intersect and has no holes
in it, it might get away with simply issuing 'fill' operators every 1500
vertices or so.  This will print correctly on most PostScript interpreter
implementations.  If the polygon is more complex, then the application 
must do correspondingly more work to divide it into sub-polygons.

Complex graphics unfortunately can require complex software to manage them.

	--Jim DeLaHunt, Developer Support, Adobe Systems Incorporated	
delahunt@adobe.com	...!{apple,decwrl}!adobe!delahunt      +1-415-962-3790

[For our German-speaking readership:
Ich bin ein Virus. Mach' mit und kopiere mich in Deine .signature. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads