\documentstyle[11pt]{article}
\begin{document}
\section*{Chapter 8 Solutions}
\begin{flushleft}
8.1 If the upper arm is longer than the lower arm then, as a
first approximation, the robot can
reach all points within a sphere centered at the joint on the base.
However, this answer is only approximate as the lower arm cannot
move below the level of the base, so a second approximation is a hemisphere
above the base. This approximatoin has to have added to it points below the
base that can be reached by the lower arm while the upper arm is parallel to
the top of the base, a set of points that depends on the length of the
upper arm and the radius of the base.

If the lower arm is longer than the upper arm, then there will be 
an interior sphere radius equal to the difference in the arm lengths
that cannot be reached.

\medskip
8.3 For this simple example, there are three values of the joint angles and
three coordinates in space, so there are a couple of simple approaches
that can work. One is to usethe result in the previous problem to solve for the
joint angles in terms of the given $x$, $y$, and $z$ values, using a numerical
method. We could then simply move the joint angles from their initial to
final positions linearly. 

\medskip
A more interesting possibility is to have the tip of the robot arm trace 
out a given path, for example, a line segment between the starting and
ending positions. If use the parametric form of this line, we can obtain
a set of positions along it as the parameter varies from 0 to 1. For each
of these intermediate positions, we can numerically solve for the joint angles
and have the joint angles move linearly between succesive points. This scheme
would give us an approximately linear trajectory.

\medskip
In general, the problem is far more difficult because a typical robot will
have many more degrees of freedom and thus there will be many possible
joint angle combinations for a given reachable position. We also have to
worry about factosr such as the maximum allowable rate at which joint
angles can change.

\medskip
8.5 There are a number of possibilities. One is to use the turtle
representation where the angle is 60 degrees and the distance forward
is half the size of the triangle. Then the sequence
$FFRRFFRRFRFRRFRRFRFRR$ will draw the edges of the four triangles.
Another approach is to have 3 productions, each of which draws one
of the interior triangles.

\medskip
8.17 Let case 0 be the case with no black or no white vertices,
case 1 be the case with 1 black or one white vertex, case 2 be the
case with two adjacent white vertices and and case 3 be the case with
two diagonally opposite white vertices. Coloring consective vertices
as 0 or 1, the 16 cases are

\newpage

0000 0 all white\\
0001 1 one white\\
0010 1 one white\\
0011 2 two consecutive white\\
0100 1 one white\\
0101 3 diagonally opposite white\\
0110 2 two consecutive white\\
0111 1 one black\\
1000 1 one white\\
1001 2 two consecutive white\\
1010 3 diagonally opposite white\\
1011 1 one black\\
1100 2 two consecutive white\\
1101 1 one black\\
1110 1 one black\\
1111 0 all black\\

\medskip
8.21 If the values of the function $f(x,y,z)$ are given at the 
corners of a unit cube with a vertex at the origin and lying in
the positive octant, then trilinear interpolation approximates $f$
inside the cube by the function
$$g(x,y,z)=(1-x)(1-y)(1-z)f(0,0,0)+x(1-y)(1-z)f(1,0,0)$$
$$+(1-x)y(1-z)f(0,1,0)+(1-x)(1-y)zf(0,0,1)+xy(1-z)f(1,1,0)$$
$$+x(1-y)zf(1,0,1)+(1-x)yzf(0,1,1)+xyzf(1,1,1).$$
Clearly where the cube is located is unimportant and the values of $f$ can
be replaced by samples at the vertices of any parallelepiped.

\end{flushleft}
\end{document}
