[gameprogrammer] Re: argh, math!

OK, chose 3 equations and put them equal to each other. Say:

3x + 2y + 5z + 3 = 0
6x + 3y + 3z + 1 = 0
5x + 7y + 2z + 8 = 0

Then you have 3 equations and 3 unknowns, which you can solve by
similtaneous equations.

Using Eq1: x = (-2y - 5z - 3)/3

Then substitute into Eq2:

6((-2y - 5z - 3)/3) + 3y + 3z + 1 = 0
2(-2y - 5z - 3) + 3y + 3z + 1 = 0
-4y -10z - 6 + 3y + 3z + 1 = 0
-y - 7z - 5 = 0
y = -7z -5

Then substitute x into equation 3:

5((-2y - 5z - 3)/3) + 7y + 8 = 0
(-10y - 5z - 3)/3 + 7y + 8 = 0
-10y - 5z - 3 + 21y + 24 = 0

Then substitute y into that equation:

-10(-7z - 5) - 5z - 3 + 21(-7z - 5) + 24 = 0
70z + 50 - 5z - 3 - 147z - 105 + 24 = 0
-82z - 34 = 0
82z = -34
z = -34/82

Then substitute z into y = -7z - 5 to get y, then substitute y and z into
any of the original equations to get x.

Then put the values of x, y and z through all your equations and check all
the answers work out to be 0. If they do then the point exists, if they
don't then it doesn't.

Easy, huh?

Rob

----- Original Message ----- 
From: "Alan Wolfe" <atrix2@xxxxxxx>
To: <gameprogrammer@xxxxxxxxxxxxx>
Sent: Saturday, May 29, 2004 9:14 PM
Subject: [gameprogrammer] Re: argh, math!


> Hey Rob,
>
> it sounds easy but nobody seems to be able to help :P
>
> lets say you have 12 of these:
>
> Ax+By+Cz+D > 0
>
> where in each of the 12 equations, there is a different value for A,B,C
and
> D.
>
> how could you be able to tell if there is some value for x,y,z that
> satisfies all 12 equations?
>
> ----- Original Message ----- 
> From: "Rob Quill" <rjquill@xxxxxxxxxx>
> To: <gameprogrammer@xxxxxxxxxxxxx>
> Sent: Saturday, May 29, 2004 1:01 PM
> Subject: [gameprogrammer] Re: argh, math!
>
>
> > OK, my maths isn't great, but they will be overlapping if the lines
> > intersect, so by putting two of the equations equal to each other and
> > solving you can see if there is a point of intersection.
> >
> > That sounds a bit too simple, so maybe I have mis-interpretted the
> problem.
> >
> > Or thinking about it, could you not use vectors? If you had the vector
> > equations you could use:
> >
> > a.b = |a||b|cos(x)
> >
> > But again, it seems too simple. Is it that hard to solve a equation 12
> > times.
> >
> > Rob
> >
> > Rob
> > ----- Original Message ----- 
> > From: "Alan Wolfe" <atrix2@xxxxxxx>
> > To: <gameprogrammer@xxxxxxxxxxxxx>
> > Sent: Saturday, May 29, 2004 8:52 PM
> > Subject: [gameprogrammer] argh, math!
> >
> >
> > > hey everyone
> > > I have a math problem im trying to solve for my game and am having
> > difficulty :P
> > >
> > > i have a "box" defined by 6 planes in the form of: Ax+By+Cz+D=0, where
> > A,B,C and D are known constants for each equation.
> > >
> > > the box doesnt have to have corners at right angles, but it's assumed
to
> > be concave.
> > >
> > > what im trying to do is take 2 of these "boxes" and see if they
overlap
> at
> > all.
> > >
> > > so basicly from what i can tell i have 12 plane equations and what i
am
> > trying to do is find if there are any sets of X,Y,Z which satisfy all 12
> > equations.
> > >
> > > I asked around how to solve systems of inequalities but people keep
> saying
> > "graph it", which doesnt help me any :P
> > >
> > > Does anyone know how to do this? I'm starting to think that there is
no
> > solution ::cry:: hehe
> > >
> > >
> > >
> > > ---------------------
> > > To unsubscribe go to http://gameprogrammer.com/mailinglist.html
> > >
> > >
> > >
> >
> >
> >
> >
> > ---------------------
> > To unsubscribe go to http://gameprogrammer.com/mailinglist.html
> >
> >
>
>
>
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>
>




---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: