View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# the math challenge

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1Pseudo  Members

Posted 21 July 2001 - 12:46 PM

I have 2 2d line equations in general form (Ax+By+C=0) and I would like to find the point of intersection (if any). How can I do this? I started to write it out on paper and gave up because I would have had to simplify a huge equation. I know there is a simple solution, so if you are man(or women) enough to take the math challenge, please post what you think is the quickest solution. Pseudo

### #2sympathy  Members

Posted 21 July 2001 - 12:57 PM

Lets say we have two lines:

y = mx + b

y = 3x + 3
y = 4x + 1

To find the point of intersection we arrange them like this:

x + y = b

-3x + y = 3
-4x + y = 1

This is a systems of equation. What we have to do is have either the x or the y on the top and bottom being the inverse value. So lets use the x:

12x - 4y = -12
-12x + 3y = 3

All I did was multiply the top by - 3, and the bottom by + 3. This gives us an equation we can solve. We now cross of the zeroing xs, add the ys and add the ending term:

0x - 1y = -9
-1y = -9
y = 9

Now to find the x point, we take a line and substitute in for y and solve for x.

9 = 3x + 3
6 = 3x
2 = x

(2, 9) is the point of intersection for the two lines defined by: y = 3x + 3, y = 4x + 1. Hope this helped. I did this based on memory so I''m not sure if it is all entirely correct.

### #3Anonymous Poster_Anonymous Poster_*  Guests

Posted 21 July 2001 - 01:00 PM

I''d rewrite each formula so that a single variable (x or y) was on one side. I will pick y:Ax + By + C = 0By = -Ax - Cy = -Ax/B - C/B   (y=mx+b format)Do that for each line, then set the y of one line = to the y of the other line, so you will get something like:4x + 5 = 5x + 3Then solve for x:5 - 3 = 5x - 4x2 = x

### #4Pseudo  Members

Posted 21 July 2001 - 01:34 PM

thanks alot. I had a little brain fart I guess.

### #5Strife  Members

Posted 21 July 2001 - 03:28 PM

Yeah, those are the two easiest ways to do it. If you have more than 2 equations, the same thing goes, only for n equations, you must have n variables to solve.

Got Slack?
Commander M

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.