I'm trying to follow the tutorial on this website about circle-line collision.
The following is a copy from that tutorial:
[color="#283769"][font="Arial, sans-serif"]Find several other points:[/font]
- The point of intersection between line and the movement vector of the circle. (a)
- The closest point on the line to the endpoint of the movement vector of the circle. (
- The closest point on the movement vector to [color="#006000"][font="monospace"](x1, y1)[/font]. ©
- The closest point on the movement vector to the other endpoint. (d)
- a is less than [color="#006000"][font="monospace"]r[/font] away from each endpoint on the movement vector and on the line.
- b is less than r away from the endpoint of the movement vector and on the line segment.
- c is less than r away from [color="#006000"][font="monospace"](x1, y1)[/font] and on the movement vector.
- d is less than r away from [color="#006000"][font="monospace"](x2, y2)[/font] and on the movement vector.
[color=#283769][font=Arial, sans-serif][color="#000000"][font="arial, verdana, tahoma, sans-serif"]Now, my problem is that my tests mostly fail on these last four points even when it is obvious that there is a collision. Take the above image for an example.[/font]
[color="#000000"][font="arial, verdana, tahoma, sans-serif"] [/font]
[color="#000000"][font="arial, verdana, tahoma, sans-serif"]Is this tutorial wrong/incomplete or am I missing something?
[/font][/font]
Thanks in advance!