From: Johan E. <jbc...@sw...> - 2013-11-07 21:45:32
|
Hi all, Is there a bug perhaps in this piece of code: elliptical-arc.cpp, lines 608-632 double dsq1 = distanceSq(p, pointAt(from)); double dsq2 = distanceSq(p, pointAt(to)); if ( second_sol ) { if ( mindistsq2 > dsq1 ) { result.clear(); result.push_back(from); mindistsq2 = dsq1; } else if ( are_near(mindistsq2, dsq) ) <--------- BUG ? { result.push_back(from); } if ( mindistsq2 > dsq2 ) { result.clear(); result.push_back(to); } else if ( are_near(mindistsq2, dsq2) ) { result.push_back(to); } } From symmetry of the code, shouldn't "dsq" be "dsq1" in that line? The code compiles because earlier, "dsq" was defined. If this is not a bug, please add a comment in the code, saying that it is indeed correct. If it *is* a bug, please correct it, and also reduce the scope of the "dsq" variable defined earlier. Thanks a bunch! Johan |