Tangram Update

2005-10-25 12:12:00

Tangram Duck

An updated version of the tangram screen saver is included in the latest release of XScreenSaver. I have made a number of changes:

All of the images have names. If you have a better name for some of the shapes let me know.

The code that generates the colors is lifted from the polyhedral screen saver. Before, I had written a program that would convert a gimp palette file to C code. I think the colors in the new version look better.

The part that is really cool is the movement. Before, the code that moved the shapes up and down was linear. The shapes moved up the axis, stopped at a constant height, moved into position, then moved down. Now, the shapes use this code for their movement:


ts->dz += ts->ddz;
ts->crd.z += ts->dz * SPEED;
if (ts->crd.z < BOTTOM) {
    reset_shape(ts);
}

Cow Graph

This allows you to get the displacement, which is parabolic in shape, by keeping the 1st and 2nd derivatives in the struct. This algorithm was lifted from the bouncing cow screen saver.