Animation

EusLisp's animation facility provides the pseudo real-time graphics on stock workstations without graphics accelerators. The basic idea is the quick playback of a series of images which have been generated after long computation. Images are retained in two ways: one is to keep a number of xwindow pixmaps each of which holds a complete pixel image, and the other is to keep line segment data obtained by hidden-line elimination. The former is faster and the only way for rendered images, but not suitable for a long animation since it requires much memory in the X server. The latter is more memory efficient and suitable for storing data in disks, but the performance is degraded when the number of line segments increases.

In either way, the user provide a function which gives new configurations to the objects to be drawn and generates drawing on *viewer*. pixmap-animation calls this function as many times as specified by the count argument. After each call, the content of *viewsurface*, which is assumed to be an xwindow, is copied to a newly created Xwindow pixmap. These pixmaps are played back by playback-pixmaps. Similarly, hid-lines-animation extracts visible line segments from the result of hid, and accumulates them in a list. The list is then played back by playback-hid-lines.

Following functions are defined in llib/animation.l, and demo/animdemo.l contains a sample animation program using hid-lines-animation on the ETA3 manipulator model.



pixmap-animation count &rest forms [macro]

forms are evaluated count times. After each evaluation, the content of *viewsurface* is copied in a new pixmap. A list of count pixmaps is returned.


playback-pixmaps pixmaps &optional (surf *viewsurface*) [function]
Each pixmap in the pixmaps list is copied to surf successively.


hid-lines-animation count &rest forms [macro]

forms, which are assumed to include call(s) to hid, are evaluated count times. After each evaluation, the result of hid held in *hid* is scanned and visible segments are collected in a list of point pairs. A list of length count is returned.


playback-hid-lines lines &optional (view *viewer*) [function]
lines is a list of lists of point pairs. draws lines successively on view. Double buffering technique allocating another pixmap is used to generate flicker-free animation.


list-visible-segments hid-result [function]

collects visible segments from the list of edge-images hid-result.


k-okada 2013-05-21