Graphics Reference
In-Depth Information
Create :
Ask the user for a size and then create a new robot of that given size. At any given
time there is a currently active robot (the one to which the “Walk,” “Speed,” and
“Reset” commands apply).
Walk :
Ask the user for a number of steps, then walk the robot that many steps in the direc-
tion it is facing with its joints moving in a way so that the walk is reasonably close
to a human's walk.
Speed :
Ask the user for a new speed that is a function of the distance between positions at
which the robot is displayed.
Reset :
Resets the robot to its initial configuration.
Select :
Let the user specify another robot to be the currently active one.
4.13.2 Robot walking along path
Extend project 4.13.1 by associating a path to each robot along which it walks. For example,
the robot in Figure 4.27(b) is walking along path C . The default path for a robot (if the user
did not explicitly define one) is a straight line in the direction the robot is pointing.
The menu should now look like
(a)
(b)
Figure 4.27.
Robots in motion.
Figure 4.28.
Two-dimensional link parameters.
Search WWH ::




Custom Search