[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Nov 18 23:40:34 2000 
Subject:RE: RCLIB (another extension) 
From:Aaron Sloman See text for reply address 
Volume-ID:1001118.01 

[To reply replace "Aaron.Sloman.XX" with "A.Sloman"]

lucbZZZ@telus.net writes:

> Date: Thu, 16 Nov 2000 20:34:04 +0000 (UTC)
>
> RCLIB looks like an excellent contribution to Poplog. RCLIB's interface with
> X will be a lot faster than using Java, and I suspect would make the development
> faster too.
>
> Once I get my home PC set-up with LINUX and Poplog, I'll be able to try it
> out!

I've now added a new facility to RCLIB, enabling you to "morph" a
picture made of a set of lines (an open, or closed, or filled,
polygon) from one shape to another. This is now in the rclib.tar.gz
package.

rc_transform_lines(
    coords1, coords2, steps, colour,
        widthOrShape, mode, delay, trail, proc);

coords1 and coords2 are lists (or vectors) of 2xN numbers representing
N points defining an open or closed or filled polygon.

The program uses the procedure proc to draw the picture
repeatedly, starting with coords1 and gradually transforming the
points into into coords2 by linear interpolation.

steps is the number of transformations to use for intermediate
states between coords1 and coords2.

colour is a string, e.g. 'blue',

proc is one of the procedures
    rc_draw_lines           -- for open polygons
    rc_draw_lines_closed    -- for closed polygons
    rc_draw_lines_filled    -- for filled polygons

the widthOrShape parameter is the line width for open or closed
polygons and one of Convex, Nonconvex or Complex for filled
polygons (giving advice to the X polygon fill procedure).

mode is one of CoordModeOrigin or CoordModePrevious, to
determined how the coordinates are interpreted ( as explained in
REF XpwPixmap)

delay is an integer representing the delay in 100ths of a second
between drawn stages. Make this smaller for faster morphing.

If trail is true, then the intermediate steps are left drawn,
otherwise they are drawn and deleted. (Using xor or equiv, as
required.)

A new library, LIB rc_pythagoras, giving a demonstration of the
Chinese proof of pythagoras' theorem shows how the new transform
procedure can be used. It presents the proof dynamically, by
moving squares and triangles around.

I shall later produce a variant of rc_transform_lines called
perhaps rc_transform_picture, which instead of taking lists
of coordinates takes lists (or vectors) of lists (or vectors) of
coordinates, each representing a picture made of arbitrarily
many different polygons etc., with additional descriptive
information, e.g. OPEN, CLOSED, FILLED, colour, etc.

The whole picture will then be morphed by gradually transforming
all the sub-pictures in parallel: useful for simple cartoons,
simulated moving robots, etc.

Linear interpolation of points is not ideal, since it will not
deal with things like rotating fixed-length lines, but that's
all I am aiming for just now - unless someone has already done
all this for pop-11 + X.

Comments and suggestions welcome.

Aaron
===
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (ReadATas@please !)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/freepoplog.html