This page lists confirmed errors fixed in digital versions of the content. Mastering Algorithms with C by Kyle Loudon The catalog page for this title is http://www.oreilly.com/catalog/junitpg/ This page was last updated April 30, 2008. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy or the digital version accessed. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem Confirmed errors fixed in digital versions: (99) Remove the text " in real time" under the item "X Window System". [207] Change the value inside the circle to the far right from 81 to 83. (291) Change "acrylic" to "acyclic". {323} In Example 12.5, change the line of code: int mgsort(void *data, int size, int esize, int i, ... to: int mgsort(void *data, int esize, int i, ... That is, remove "int size, " since this parameter is not used. We should also make sure that this is changed in the code on disk. {345} The values in the first three columns for i=4 in Figure 13.1 should be 4, 0.0, 0.5. That is, changed the value in the third column of this row, 1.5, to 0.5. {503-504} Code should be this: /***************************************************************************** * * * -------------------------------- lint.c ------------------------------- * * * *****************************************************************************/ #include "geometry.h" /***************************************************************************** * * * --------------------------------- lint --------------------------------- * * * *****************************************************************************/ int lint(Point p1, Point p2, Point p3, Point p4) { double z1, z2, z3, z4; int s1, s2, s3, s4; /***************************************************************************** * * * Perform the quick rejection test. * * * *****************************************************************************/ if (!(MAX(p1.x, p2.x) >= MIN(p3.x, p4.x) && MAX(p3.x, p4.x) >= MIN(p1.x, p2.x) && MAX(p1.y, p2.y) >= MIN(p3.y, p4.y) && MAX(p3.y, p4.y) >= MIN(p1.y, p2.y))) { { return 0; } /***************************************************************************** * * * Determine whether the line segments straddle each other. * * * *****************************************************************************/ if ((z1 = ((p3.x - p1.x)*(p2.y - p1.y)) - ((p3.y - p1.y)*(p2.x - p1.x))) < 0) s1 = -1; else if (z1 > 0) s1 = 1; else s1 = 0; if ((z2 = ((p4.x - p1.x)*(p2.y - p1.y)) - ((p4.y - p1.y)*(p2.x - p1.x))) < 0) s2 = -1; else if (z2 > 0) s2 = 1; else s2 = 0; if ((z3 = ((p1.x - p3.x)*(p4.y - p3.y)) - ((p1.y - p3.y)*(p4.x - p3.x))) < 0) s3 = -1; else if (z3 > 0) s3 = 1; else s3 = 0; if ((z4 = ((p2.x - p3.x)*(p4.y - p3.y)) - ((p2.y - p3.y)*(p4.x - p3.x))) < 0) s4 = -1; else if (z4 > 0) s4 = 1; else s4 = 0; if ((s1 * s2 <= 0) && (s3 * s4 <= 0)) return 1; /***************************************************************************** * * * Return that the line segments do not intersect. * * * *****************************************************************************/ return 0; }