Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Neil Armstrong tripped.


devel / comp.lang.postscript / Smoothing over 'moveto' vs 'lineto'

SubjectAuthor
* Smoothing over 'moveto' vs 'lineto'luser droog
`- Re: Smoothing over 'moveto' vs 'lineto'luser droog

1
Smoothing over 'moveto' vs 'lineto'

<2577131f-0b09-4821-868a-8ca234d2c5b7n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=129&group=comp.lang.postscript#129

  copy link   Newsgroups: comp.lang.postscript
X-Received: by 2002:ac8:5f53:: with SMTP id y19mr13226750qta.638.1643044760791;
Mon, 24 Jan 2022 09:19:20 -0800 (PST)
X-Received: by 2002:a4a:ac4a:: with SMTP id q10mr11044427oon.63.1643044760519;
Mon, 24 Jan 2022 09:19:20 -0800 (PST)
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.postscript
Date: Mon, 24 Jan 2022 09:19:20 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=97.87.183.68; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 97.87.183.68
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2577131f-0b09-4821-868a-8ca234d2c5b7n@googlegroups.com>
Subject: Smoothing over 'moveto' vs 'lineto'
From: luser.droog@gmail.com (luser droog)
Injection-Date: Mon, 24 Jan 2022 17:19:20 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 41
 by: luser droog - Mon, 24 Jan 2022 17:19 UTC

In simple drawing programs I keep running into the very minor
problem that you have to call 'moveto' on the first point but
then 'lineto' on all the other points to put a line segment into
the path. It is very minor. But it keeps on happening.

This last time around I had my points all nicely packed into
an array of array. Lovely. And that led to this function which
I haven't found the right name for:

/fx,mapgxs { % a f g . [a0 f] [a1 g .. aN g]
3 1 roll exch dup first % g f a a0
3 -1 roll [ 3 1 roll exec ] % g a [a0 f]
3 1 roll rest exch map % [a0 f] [a1 g .. aN g]
} def
/first{ 0 get } def
/rest{ 1 1 index length 1 sub getinterval } def
/map { 1 index xcheck 3 1 roll [ 3 1 roll forall ] exch {cvx} if } def

Which you call like this:

/draw { % [[x0 y0]..[xN yN]] . -
{aload pop moveto} {aload pop lineto} fx,mapgxs pop pop
closepath
} def

Looking over some old code just now I found a completely
different approach to the same problem, by redefining the
thing to call. The `currentpoint stroke moveto` is just to "animate"
the drawing.

/newline { /line {moveto /line {lineto currentpoint stroke moveto} store} store } def

Which you could use like this (remove the "currentpoint stroke moveto"
above for closepath to work):

/draw {
newline {aload pop line} forall
closepath
} def

Are there other solutions? Is this a problem for anyone else?

Re: Smoothing over 'moveto' vs 'lineto'

<86b1673d-dd7c-4984-aefa-72db6ec8140en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=132&group=comp.lang.postscript#132

  copy link   Newsgroups: comp.lang.postscript
X-Received: by 2002:a05:620a:25ca:: with SMTP id y10mr11692037qko.526.1643047138131;
Mon, 24 Jan 2022 09:58:58 -0800 (PST)
X-Received: by 2002:aca:2309:: with SMTP id e9mr2531627oie.97.1643047137867;
Mon, 24 Jan 2022 09:58:57 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.postscript
Date: Mon, 24 Jan 2022 09:58:57 -0800 (PST)
In-Reply-To: <2577131f-0b09-4821-868a-8ca234d2c5b7n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=97.87.183.68; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 97.87.183.68
References: <2577131f-0b09-4821-868a-8ca234d2c5b7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <86b1673d-dd7c-4984-aefa-72db6ec8140en@googlegroups.com>
Subject: Re: Smoothing over 'moveto' vs 'lineto'
From: luser.droog@gmail.com (luser droog)
Injection-Date: Mon, 24 Jan 2022 17:58:58 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 52
 by: luser droog - Mon, 24 Jan 2022 17:58 UTC

On Monday, January 24, 2022 at 11:19:21 AM UTC-6, luser droog wrote:
> In simple drawing programs I keep running into the very minor
> problem that you have to call 'moveto' on the first point but
> then 'lineto' on all the other points to put a line segment into
> the path. It is very minor. But it keeps on happening.
>
> This last time around I had my points all nicely packed into
> an array of array. Lovely. And that led to this function which
> I haven't found the right name for:
>
> /fx,mapgxs { % a f g . [a0 f] [a1 g .. aN g]
> 3 1 roll exch dup first % g f a a0
> 3 -1 roll [ 3 1 roll exec ] % g a [a0 f]
> 3 1 roll rest exch map % [a0 f] [a1 g .. aN g]
> } def
> /first{ 0 get } def
> /rest{ 1 1 index length 1 sub getinterval } def
> /map { 1 index xcheck 3 1 roll [ 3 1 roll forall ] exch {cvx} if } def
>
> Which you call like this:
>
> /draw { % [[x0 y0]..[xN yN]] . -
> {aload pop moveto} {aload pop lineto} fx,mapgxs pop pop
> closepath
> } def
>
>
> Looking over some old code just now I found a completely
> different approach to the same problem, by redefining the
> thing to call. The `currentpoint stroke moveto` is just to "animate"
> the drawing.
>
> /newline { /line {moveto /line {lineto currentpoint stroke moveto} store} store } def
>
> Which you could use like this (remove the "currentpoint stroke moveto"
> above for closepath to work):
>
> /draw {
> newline {aload pop line} forall
> closepath
> } def
>
> Are there other solutions? Is this a problem for anyone else?

Oh. I forgot about this other way. Perhaps this should be called the "Oopsie!"
technique.

/line { {currentpoint pop pop}stopped{moveto}{lineto} ifelse } def

or just:

/line { {lineto}stopped{moveto}if } def

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor