From: Brian Victor <bhv11@...>

Date: Thu, 11 Dec 1997 20:27:08 -0500

Date: Thu, 11 Dec 1997 20:27:08 -0500

At 9:08 AM -0500 12/11/97, Chris wrote: >>Does anyone know the answer to these two geometry questions? >> >>1. The formula for finding the intersection point of two lines. >The intersection point of two lines is found by setting the two line >equations equal to each other, solving for x and then substituting that >value into one of the original equations to find y. That's exactly the concept. Getting it into BASIC is just a matter of reducing it to two equality statements. For the moment, I'll assume that your linear equations are in slope-intercept form. (y=mx+b) If they're not, you'll have to add a step to get them there. For each equation, you have two coefficients, and therefore two variables. y1 = ax + b y2 = cx + d a, b, c, and d are your variables. Through algebra we can solve for x in a form that will work nicely for an assignment statement. ax + b = cx + d ax - cx = d - b (a-c)x = d - b x = (d-b)/(a-c) That last line will plug right into BASIC, with changes allowed for your own particular variable names. Note however that it would be prudent to make your x and y variables either single or double precision variables (append either a # or a ! to the variable name: x# or x!) in order to allow for the decimals that you're likely to run into. To locate the y coordinate, take one of your original equations and plug in your x value, which you now know: y = a * x + b This should solve your first problem for you. The second will be more of a challenge. I'll look it over and see what I can come up with. -- Brian Victor