Closed davidyu closed 10 years ago
It's not clear to me why, but 6be68278d053000cfb2ae8e5d02d5ec7890f8a46 fixes this.
Resolved the tension after thinking about it a bit. This was left as an inline comment:
Think about it intuitively, like this. Suppose we wanted the scalar projection of the vector AB onto itself. We expect a value of 1.
AB . AB = AB.x * AB.x + AB.y * AB.y, or . Now, when we normalize this scalar value, we'd intuitively want , and not . This is why we divide by ab.lengthsq()
If you run into a wall, you wrap to the closest endpoint. This is most likely a bug I introduced while refactoring closestLinePoint