Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #2459 > unrolled thread

Animations in PostScript

Started byMarkus Triska <triska@metalevel.at>
First post2016-03-18 19:47 +0100
Last post2016-03-22 19:45 +0100
Articles 5 — 3 participants

Back to article view | Back to comp.lang.postscript


Contents

  Animations in PostScript Markus Triska <triska@metalevel.at> - 2016-03-18 19:47 +0100
    Re: Animations in PostScript tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2016-03-20 14:31 -0400
      Re: Animations in PostScript Markus Triska <triska@metalevel.at> - 2016-03-21 21:22 +0100
    Re: Animations in PostScript Carlos <angus@quovadis.com.ar> - 2016-03-22 14:30 +0100
      Re: Animations in PostScript Markus Triska <triska@metalevel.at> - 2016-03-22 19:45 +0100

#2459 — Animations in PostScript

FromMarkus Triska <triska@metalevel.at>
Date2016-03-18 19:47 +0100
SubjectAnimations in PostScript
Message-ID<m260wjipxs.fsf@metalevel.at>
Hi all,

for creating portable animations of search processes and other longer
running tasks, I often enjoy PostScript. For example, a few simple
PostScript definitions typically suffice to get a good visual impression
of the search progress in many combinatorial tasks. I find this much
more convenient and also more beautiful and often even faster than
showing such output on the system terminal or with GUI toolkits. As an
additional bonus, the resulting images are scalable and can be easily
embedded in high-quality documents.

I have uploaded a short document that explains the underlying idea:

   http://www.metalevel.at/postscript/animations.html

An example application is a real-time illustration of the search
progress in the so-called "N-queens problem", using Ghostscript:

   http://www.metalevel.at/queens/

Please see the above page for further links. I first saw this elegant
application of PostScript in Ulrich Neumerkel's excellent GUPU system,
and hope you also find this useful!

All the best,
Markus

[toc] | [next] | [standalone]


#2460

Fromtlvp <mPiOsUcB.EtLlLvEp@att.net>
Date2016-03-20 14:31 -0400
Message-ID<1lmzefnfaec0r.1x3dz779ai5u0.dlg@40tude.net>
In reply to#2459
On Fri, 18 Mar 2016 19:47:11 +0100, Markus Triska wrote:

> ... for creating portable animations of search processes and other longer
> running tasks, I often enjoy PostScript ...

Let me ask: "enjoy"? or "employ" :-) ? (Maybe both at once, actually.)

I've always thought it should be easier than I seem to find it to get
animations going in PostScript -- as easy as in .SVG, or .GIF -- and I have
high hopes your links will help show me the way. So thanks. Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.

[toc] | [prev] | [next] | [standalone]


#2461

FromMarkus Triska <triska@metalevel.at>
Date2016-03-21 21:22 +0100
Message-ID<m2bn6760oy.fsf@metalevel.at>
In reply to#2460
tlvp <mPiOsUcB.EtLlLvEp@att.net> writes:

> Let me ask: "enjoy"? or "employ" :-) ? (Maybe both at once, actually.)
>
> I've always thought it should be easier than I seem to find it to get
> animations going in PostScript -- as easy as in .SVG, or .GIF -- and I have
> high hopes your links will help show me the way. So thanks. Cheers, -- tlvp

Great, I hope you also emjoy it!

All the best,
Markus

[toc] | [prev] | [next] | [standalone]


#2462

FromCarlos <angus@quovadis.com.ar>
Date2016-03-22 14:30 +0100
Message-ID<ncrh6t$5lr$1@dont-email.me>
In reply to#2459
On 18/03/2016 19:47, Markus Triska wrote:
> Hi all,
>
> for creating portable animations of search processes and other longer
> running tasks, I often enjoy PostScript. For example, a few simple
> PostScript definitions typically suffice to get a good visual impression
> of the search progress in many combinatorial tasks. I find this much
> more convenient and also more beautiful and often even faster than
> showing such output on the system terminal or with GUI toolkits. As an
> additional bonus, the resulting images are scalable and can be easily
> embedded in high-quality documents.
>
> I have uploaded a short document that explains the underlying idea:
>
>     http://www.metalevel.at/postscript/animations.html

I think I don't get it. What you mean with "creating a portable 
animation" is just watching Ghostscript paint the page until it is 
complete, isn't it?

I thought you meant how to create a .gif/.gifv file (an easier way than 
a frame per page), or that javascript animation you put on the page...

What am I missing?

-- 

[toc] | [prev] | [next] | [standalone]


#2463

FromMarkus Triska <triska@metalevel.at>
Date2016-03-22 19:45 +0100
Message-ID<m27fgu5p38.fsf@metalevel.at>
In reply to#2462
Hi Carlos,

Carlos <angus@quovadis.com.ar> writes:

> I think I don't get it. What you mean with "creating a portable
> animation" is just watching Ghostscript paint the page until it is
> complete, isn't it?

The key idea is to use GhostScript so that it shows the animation in
real-time, i.e., while the search is still ongoing and not yet
completed. In the way described on the page, GhostScript's interactive
execution mode is used so that emitted PostScript instructions are
processed as soon as they are received.

Let us have a look at the PostScript instructions of the N-queens
example I linked to. If you use the following Prolog query, the
PostScript instructions for placing and removing queens are emitted on
standard output:

    ?- n_queens(8, Qs), animate(Qs), label(Qs).
    1 8 i
    1 7 i
    1 6 i
    1 5 i
    1 4 i
    1 3 i
    1 2 i
    1 1 q
    8 8 i
    ...
    etc.

The point is that you can directly pipe these instructions to
GhostScript, and this way obtain a real-time animation of the actual
search process while it is still ongoing. The only prerequisite in this
case are a few simple definitions for the procedures q, c, etc. which
are used in this example to place a queen (q) and clear (c) a field.

This works because GhostScript uses an implicit "flushpage" after each
newline, so that the result is guaranteed to show up on screen. If that
were not the case, you can obtain the same effect by setting the
language level to 2 and using "copypage" yourself in the output.

> I thought you meant how to create a .gif/.gifv file (an easier way
> than a frame per page), or that javascript animation you put on the
> page...

The JavaScript animation was obtained in this case by converting the
resulting PostScript instructions of a completed animation. In the
PostScript example though, the key advantage is that we can show the
process dynamically while it is still ongoing, using the actual
search process as the direct source of the animation.

This is tremendously helpful in more complex situations: In the simpler
N-queens examples, we have the luxury to first run the search to
completion, and then view the output at once. But this is only the case
in a tiny minority of real-world use cases of such search tasks!
Typically, you start a search and have no idea what is happening. To see
what is happening, you can emit output on the terminal (ugly, slow etc.)
or use some GUI toolkit (complex, often non-portable etc.). Or, and that
is what I am showing on the page, you can simply emit PostScript
instructions and pipe them to GhostScript for excellent and portable
typesetting quality, obtaining colours and scalable output for free.

I hope this helps. Thank you for your interest in this!

All the best,
Markus

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web