You've made it all way the through each of our example programs, line by line,
and you (hopefully) understand how each line works and fits into its program.
Now you're ready to take what you know and practice writing your own C code!
Let's take another look at the link diagram of the squatter.
In this homework you will modify the C program ``joints.c'' to determine
the X and Y coordinates of the squatter's hip and shoulder, given the
information in the link diagram and the angles for the squatter's ankles and
knees.
Modify the ``joints.c'' programs as follows:
- The program will ask the user for the current angles of the
squatter's ankle and knee joints (but not the hip joint). The angles
will be input in degrees, measured counterclockwise from the positive X axis.
(Or more precisely, the angles will be measured in degrees counterclockwise
from a ray in the positive X direction passing though the joint, to the
appropriate link.) The angles will be input as floating-point numbers.
- The program will use the input angles and the values shown in the
link diagram to compute the positions of the squatter's knee, hip, and
shoulder joints.
- The program will print out the X and Y coordinates of the
squatter's knee, hip, and shoulder joints.
Compile, run, and test your program. Invent your own test data. In order to
be sure that your programs are working properly, you might want to duplicate
your implementation in Maple.
Remember to put appropriate comments in your programs!
Eric N. Eide
Hamlet Project
Department of Computer Science
University of Utah