Documentation for HorseWalk.py

Hierarchy

Any blobby puppet requires a hierarchy of articulation points, so that rotating a joint in the puppet properly moves everything below that (and only that) joint.

The blobby horse puppet was created with the following hierarchy:

Hierarchy:
barrel
	point_of_hip
		point_of_tail
			point_of_tail2
		offpoint_of_hip
			offside_hock
				offsideback_pasternjoint
					offsideback_hoof
		nearpoint_of_hip
			nearside_hock
				nearsideback_pasternjoint
					offsidefore_hoof
	point_of_croup
		withers
			poll
			right_earframe
			left_earframe
		offside_elbow
			offside_knee
				offsidefore_pasternjoint
					offsidefore_hoof
		nearside_elbow
			nearside_knee
				nearsidefore_pasternjoint
					nearsidefore_hoof

The hind legs and tail are attached to the central horse's frame (the barrel frame) while the front legs, neck, and head are attached to the point of croup, so that these body parts can rotate around the hindquarters of the horse (necessary for rearing).

Equivalence of graphic libraries

Features used from Vpython's visual library / Corresponding feature in other graphics libraries
frame()							transformation node
ellipsoid primitive					scaled sphere primitive
frame.rotate()						rotation matrix applied to the transform node

Explanation of bendjoint()

The function bendjoint is the key function in generating the animation. It has three main parameters: an array of frames, a respective array of maximum angles, a respective array of axes

The function bendjoint also has two important constants: number of image frames, an offset

There is a while loop that iterates for the number of image frames. Each maximum angle is divided by the number of frames and then the frame is rotated by the fraction of its maximum angle. The central frame is displaced by the offset constant after each rotation in order to achieve simultaneous lateral movement along with the rotation of the blobby's parts. To animate the movement of two limbs simultaneously the array of frames must alternate between the limbs so that each limb is incremented a little one right after the other.

By passing in an array of joints on a limb with an array of angles, a limb can be bent to a different position. Passing in the same array of joints with an array of opposite angles of the same magnitude to bendjoint will unbend the limb.

To control the speed with which the horse walks, there is a constant that is set at the beginning of the code that is multiplied to the number of frames and divided from the lateral offset. This constant has to be changed when running the program on different machines because of the different clock speeds on the machines.

Animation of rider falling

After a few iterations of the horse walking the horse rears up and the rider falls off. The arrays corresponding to the puppet rearing on its hind legs are passed to bendjoint and the frame of lateral movement is changed from the horse to the rider. Once the rider hits the ground rider's main frame is detached from the horse and attached to the stationary world frame at the position where the rider has fallen.

The Secret to the Horse of a Different Color's Colors

After the rider has fallen off a color vector change is added to the loop of the walking animation. The color vector is rotated among yellow, magenta, and cyan each time the horse turns around in the animation.

A Word about a Novice Programmer using Vpython

As a novice programmer with only some experience with object oriented programming in Java and some exposure to the C programming language, the Vpython offered a much more rewarding experience in programming. In Vpython the results were immediate and the syntax was forgiving. By mimicking the example Vpython codes and adventurous exploring of Vpython functions I could create something new. This was much more enjoyable than trying to code data structures or trying to replicate already functional code. Having prior experience with Java and C did make it easier to not be intimidated by the Vpython language and gave me some familiarity with the basics of programming. I definitely learned a lot more about programming and especially graphics programming through this project. The only downsides to Vpython was that it's libraries are not well-documented, and it is difficult to find pre-built functions and classes that implement what is desired because it is unclear what name to look under in the Vpython tutorial. Unfortunately as a novice I still feel that I lack the ability to create original structured easily maintained programs, but this project brought me one step closer to achieving that goal by making me aware of where I can improve.

A Word about vportage

Another student project focused on how to bridge the visual library with the SZG library so that the horsewalk scenegraph could be viewed in the 3D virtual environments of the CAVE and CUBE. By changing the library that the Vpython code imports in the first line of the code from importing visual to importing vportage all of the calls to visual functions and classes are handled in vportage to call the equivalent functions and classes in SZG. Vportage currently only supports all of the functions used by horsewalk but little of the multitude of other visual features.