# Vector to circle collision

This topic is 4848 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How do i find if and where a vector intersects a circle of X radius in the cartesian plane?

##### Share on other sites
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.

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633313
• Total Posts
3011319
• ### Who's Online (See full list)

There are no registered users currently online

×