Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drawing the line

8 views
Skip to first unread message

Count Dracula

unread,
Apr 2, 1996, 3:00:00 AM4/2/96
to
If a PostScript code fragment is going to draw lines
through a set of N + 1 points (x0, y0), (x1, y1), ..., (xN, yN),
which of the following two choices would be more efficient
(or is there something better than both)?

(1) \m {moveto} bind def
\L {lineto} bind def
x0 y0 m x1 y1 L x2 y2 L .... xN yN L stroke

(2) \r {{lineto} repeat} bind def
\m {moveto} bind def
x0 y0 m x1 y1 x2 y2 ... xN yN N r stroke

The number N is expected to be between 25 and 100 for each
use of the code.

--
___________________________________________________________________________________
Levent Kitis lk...@cars.mech.virginia.edu lk...@kelvin.seas.virginia.edu
University of Virginia Department of Mechanical, Aerospace, and Nuclear Engineering
___________________________________________________________________________________

Ian Kemmish

unread,
Apr 3, 1996, 3:00:00 AM4/3/96
to
In article <Dp92...@murdoch.acc.Virginia.EDU>, lk...@cars.mech.Virginia.EDU
says...

>
>If a PostScript code fragment is going to draw lines
>through a set of N + 1 points (x0, y0), (x1, y1), ..., (xN, yN),
>which of the following two choices would be more efficient
>(or is there something better than both)?
>
>(1) \m {moveto} bind def
> \L {lineto} bind def
> x0 y0 m x1 y1 L x2 y2 L .... xN yN L stroke

/m /moveto load def is probably a whisker faster.

>(2) \r {{lineto} repeat} bind def
> \m {moveto} bind def
> x0 y0 m x1 y1 x2 y2 ... xN yN N r stroke

There's less to interpret here, so it should be quicker. Note
{{lineto} bind repeat} may be better still.

You'll also need to remember to push the end points onto the stack in the
opposite order, which you haven't done here (the first executed lineto
consumes the last pushed pair of numbers, etc.)


>The number N is expected to be between 25 and 100 for each
>use of the code.

If you're going to a level 2 printer you should definitely investigate
whether user paths (particularly the encoded string form) will be faster for
you.

============================================================================
Ian Kemmish 18 Durham Close, Biggleswade, Beds SG18 8HZ
i...@five-d.com Tel: +44 1767 601 361 Fax: +44 1767 312 006
Info on Jaws and 5D's other products on http://www.five-d.com/5d
============================================================================
`The customer is King, but the proprietor is God'


jdaw1

unread,
Aug 7, 2022, 3:59:30 PM8/7/22
to
/l /lineto load def
would execute slightly quicker than
/l {lineto} bind def
0 new messages