Problems for Lesson 9

Problem 9.1 – Oriented Duck

Write a function orient-duck that takes a horizontal velocity hv and returns a duck that points in the direction of its veolicty: if hv is positive or zero, then the duck should face right; if hv is negative, then the duck should face left.

For example, (orient-duck 10) should produce , while (orient-duck -10) should produce .

Problem 9.2 – Directed Duck

Write a function direct-duck that takes a horizontal velocity hv and vertical velocity vv and returns duck that points in the direction of its overall velocity.

The duck should be oriented based on hv in the same way as for orient-duck, but it should be tilted down for a positive vv and up for a negative vv. The amount tilt is given in radians by the atan function applied to the ratio of the absolute values of vv to hv. Recall that you can convert radians to degrees by multiplying by (/ 360 pi).

For example, (direct-duck 10 0) should produce , while the result of (direct-duck -10 10) should resemble .