Programming_Challenges_19-19
Programming_Challenges_19-19
13 Geometry 291
13.1 Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
13.2 Triangles and Trigonometry . . . . . . . . . . . . . . . . . . . . . . . 294
13.2.1 Right Triangles and the Pythagorean Theorem . . . . . . . . 295
13.2.2 Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . 295
13.2.3 Solving Triangles . . . . . . . . . . . . . . . . . . . . . . . . . 296
13.3 Circles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
13.4 Program Design Example: Faster Than a Speeding Bullet . . . . . . 299
13.5 Trigonometric Function Libraries . . . . . . . . . . . . . . . . . . . . 302
13.6 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
13.6.1 Dog and Gopher . . . . . . . . . . . . . . . . . . . . . . . . . . 304
13.6.2 Rope Crisis in Ropeland! . . . . . . . . . . . . . . . . . . . . . 305
13.6.3 The Knights of the Round Table . . . . . . . . . . . . . . . . 306
13.6.4 Chocolate Chip Cookies . . . . . . . . . . . . . . . . . . . . . 307
13.6.5 Birthday Cake . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
13.6.6 The Largest/Smallest Box ... . . . . . . . . . . . . . . . . . . . 309
13.6.7 Is This Integration? . . . . . . . . . . . . . . . . . . . . . . . . 310
13.6.8 How Big Is It? . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
13.7 Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312