Chapter 20.   An Articulated, Moveable Figure


[Figure2 PIC] [Figure1 PIC] This chapter describes the implementation of an articulated figure, composed of rotatable limbs, which can be moved around a checkboard floor in a similar manner to the 3D sprites in Chapters 18 and 19.

This work is based on the first part of Thana Konglikhit's student project.

The left-hand image shows the figure in its initial stance, the next is the figure after the following commands have been processed:

urLeg f 40, lrLeg f -40, ulArm f 20, llArm f 20, chest t 10, head t -10

The first four commands specify forward (f) rotations of the limbs representing the upper part of the right leg (urLeg), the lower right leg (lrLeg), the upper left arm (ulArm), and the lower part of the left arm (llArm). The chest and head are turned (t) left and right respectively, so that the head stays facing forward.

[Figure3 PIC] All the operations are carried out as a group, causing a single re-orientation of the figure.

Pressing <enter> repeats the commands, although when a limb reaches its predefined maximum or minimum rotation, operations which would rotate it beyond these limits are ignored. The screen shot on the right shows the result of executing the commands several times.

Note that the right arm passes through the right leg; The Mover3D application does not employ collision avoidance to prevent limbs intersecting.

The user can move the entire figure about the floor by typing commands into the text field or by pressing arrow keys on the keyboard. The left-hand image below displays the outcome of the commands:

f, f, c, c, f, f

[Figure5 PIC] [Figure4 PIC] The commands cause the figure to move from its starting position at (0,0) on the floor: forward 0.6 units, 22.5 degrees to its right, and forward another 0.6 units. The right-hand image is a view of the scene after repeating these commands three times. Sixteen repetitions will cause the figure to return to its starting position at (0,0).

These commands are reminiscent of the turtle geometry constructs found in languages like Logo.

As with the limb operations, all movements entered into the textfield update the figure at once. The operations are carried out in the order specified by reading the input sequence left-to-right.

A close look at the pictures above shows that its limbs are unaffected by the movement: the entire figure is moved and rotated as a single 'unit'.

[Figure6 PIC] The screen shot on the right illustrates the result of pressing the "reset" button in the GUI: the figure's limbs are rotated back to their starting position, but the figure remains at its current position and orientation on the floor.

Other features:




Dr. Andrew Davison
Back to my home page