🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Line vs. Circle: Fight!

Started by
0 comments, last by Joshua Schpok 24 years, 9 months ago
Seemingly simple, yet boggling question:

Given: two points of line segment, point of circle center, circle radius

We are in 2D, here.

How do you determine if and where the line segment is intersecting the circle?

------------------
Oddball Software
http://zap.to/oddball

Advertisement
A circle is defined as the set of points that are all equidistant from one point, which is the center of the circle. So basically, any points on the line that are R units away from the center lie on the circle (R = radius).

The (nonstandard) equations for lines and circles are:

y = mx + b and
(x-h)^2 + (y-k)^2 = r^2

Where m is the slope, and b is the point the line crosses the Y axis.

(h,k) is the center of the circle and R is the radius.

Hope this helps

This topic is closed to new replies.

Advertisement