How to fix typo in code on page 356 of Android Game Programming By Example?

On page 356 of Android Game Programming By Example there is an obvious typo in the code:
// And now we can test the rotated point from cp1 against the
// rotated points which form a side from cp2

if (((cp2.currentPoint.y > cp1.currentPoint.y) != (cp2.currentPoint2.y > cp1.currentPoint.y)) &&
(cp1.currentPoint.x < (cp2.currentPoint2.x - cp2.currentPoint2.x) *
(cp1.currentPoint.y - cp2.currentPoint.y) / (cp2.currentPoint2.y - cp2.currentPoint.y) + cp2.currentPoint.x))
numCrosses++;
The typo must be in (cp2.currentPoint2.x - cp2.currentPoint2.x) since that is identically ZERO and it multiplies other terms.
What is the correct code?
1 person has
this question
+1
Reply