Intersecting Point of a Line and a Circle
BlitzPlus Forums/BlitzPlus Beginners Area/Intersecting Point of a Line and a Circle
| ||
I need to find a specific point that is the intersecting point of a circle with an origin of a,b a radius of r and a line with a point c,d and a slope of s I can find this mathmaticly on a piece of paper but I'm stumped on how to make a function for it. I basically need a function that will solve this system of equations y - d = s(x - c) (y - b)^2 + (x - a)^2 = r^2 So I would input a,b,c,d,r and s and it would return the x and y values that solve both equations (the posative answers anyway since there will almost always be 2 answers) |
| ||
Hello. Taken from Code Archives\Algorithms: http://blitzbasic.com/codearcs/codearcs.php?code=2130 - make sure to read the comments as well as sometimes bugs are found or instructions are given. Big thanks to SebHoll for that entry. It's in BMX, but you'd have to convert it anyway if someone gave you something from another language. Good luck. |
| ||
Wow that's awesome, thx!! |
| ||
Um I don't know enough about bmax to translate it though :/ |
| ||
Okay, what I actually need is an uber math geek to solve this equation for X ((s(x - ) + d) - b)^2 + (x - a)^2 = r^2 |