Original Post
🔒 Locked
Vector to circle collision
Advertisement
It's probably faster just to explain it than to find a reference for you. So...
By vector I assume you mean linear component of some sort (line, ray, or segment). Let the line be O+tD. The squared distance from the line to the circle center at parametric value t is:
f(t) = (O+tD-C)2
Let d = O-C, and multiply to get:
f(t) = (D.D)t2+2(d.D)t+(d.d)
You're interested in the values of t at which the squared distance from the line to the circle center is exactly r2. Set f(t) to this value and you get a quadratic, the solution of which tells you if and where the line and circle intersect. For rays or segments, just reject values of t outside the acceptable range.
By vector I assume you mean linear component of some sort (line, ray, or segment). Let the line be O+tD. The squared distance from the line to the circle center at parametric value t is:
f(t) = (O+tD-C)2
Let d = O-C, and multiply to get:
f(t) = (D.D)t2+2(d.D)t+(d.d)
You're interested in the values of t at which the squared distance from the line to the circle center is exactly r2. Set f(t) to this value and you get a quadratic, the solution of which tells you if and where the line and circle intersect. For rays or segments, just reject values of t outside the acceptable range.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement