Staredit Network

Staredit Network -> UMS Assistance -> Basic algebra question
Report, edit, etc...Posted by Tuxedo Templar on 2004-09-23 at 21:42:49
Alright, say you have two points, [8,18] (start) and [6,12] (end). Now, I want to get a number I can use to determine the direction from the start to the end. What was the math for doing that again (been years since I last did anything with algebra)?

And if you must know, this relates to A&O's gunner system.
Report, edit, etc...Posted by BeeR_KeG on 2004-09-23 at 21:44:32
Can the X & Y be negative in the system you will be using?

Formula is:

m=x2-x1/y2-y1
Report, edit, etc...Posted by CheeZe on 2004-09-23 at 21:45:48
you cant' figure out direction because the line goes two ways, but thats the slope formula and ..its pretty hard to put that in starcraft tongue.gif
Report, edit, etc...Posted by dashrike on 2004-09-23 at 21:46:29
The direction? I don't know about that...

Edit: Beer you got it backwards. Yours would give an answer of 1/3. You can see that the y increases 6 for the 2 that x increases, so it is not 1/3.

[hr]

You can find the slope of it...

M = ( Y2 - Y1 ) / ( X2 - X1 )

In your case: M = ( 12 - 18 ) / (6 - 8 ) = ( -6 ) / ( -2) = 3
Report, edit, etc...Posted by Tuxedo Templar on 2004-09-23 at 21:46:33
Ok slope. That's what I was trying to remember. Thanks.

And yes, that's exactly what I intend to do. Goodbye to another week (or 5) of my life to make it lol.
Report, edit, etc...Posted by BeeR_KeG on 2004-09-23 at 21:48:19
Aight Tux, now you know at what angle and distance the projectile will go.

How are you going to determine which direction it will go to?
Report, edit, etc...Posted by CheeZe on 2004-09-23 at 21:50:32
moose..it goes down, not up..noob tongue.gif

EDIT: LOL GG MOOSE tongue.gif
Report, edit, etc...Posted by Mini Moose 2707 on 2004-09-23 at 21:54:25
I didn't even post Cheeze. Stop spamming.
Report, edit, etc...Posted by Tuxedo Templar on 2004-09-23 at 21:55:01
Well with the slope and the starting point I can make sets of triggers for the different slope values and have a relativity grid travel from that point in a direction roughly equal to the slope up to a certain range.

In a nutshell, I want to make a REAL gunner system, using dark swarms only to set the direction and trigger firing. Might not succeed, but it's worth a shot.
Report, edit, etc...Posted by CheeZe on 2004-09-23 at 21:56:38
I tried to do that making a reflector map where it determined the degree based on how many grids it went through...very big failure if you get it to work..give me triggers!!! sad.gif

silly moose, trix are for kids happy.gif
Report, edit, etc...Posted by dashrike on 2004-09-23 at 21:56:58
Very nice Moose. I saw it too. tongue.gif
Report, edit, etc...Posted by DT_Battlekruser on 2004-09-23 at 22:47:46
How to get a degree of direction.


x = run; y = rise.

TAN(angle of tri) = y/x

so if run is 1 and rise is 3 then

TAN(theta) = 3
theta = (-TAN)3]

bah stupid comp cant do -TAN, wheres my TI-84+....

theta ~=71.5

Now you know angles just draw yourself the right triangle and you can find out all you could possible need to know.
Report, edit, etc...Posted by synd][cate on 2004-09-23 at 22:53:13
I am getting into binary, should know add/sub/multiplication by the end of the week..

To do any serious arithmatic your going to have to use binary numbers.

QUOTE
bah stupid comp cant do -TAN, wheres my TI-84+....

Also thats the other problem, you need to figure out the equation for tangent and implement it into your map.

If you just want to know the relative direction the person is going we know that..

Using slope
Rise/Run
35 deg = slope of 0.57735 or 1/sqr(3)
45 deg = slope of 1/1
60 deg = slope of 1.732 or sqrt(3)/1 or sqrt(3)
Report, edit, etc...Posted by Tuxedo Templar on 2004-09-24 at 00:54:55
Ahehehe, I DO want to have at least SOME sperm count after making this, so I'll just see if I can even get slopes and work from there.

Slopes go to infinity as they begin reaching vertical, right?
Report, edit, etc...Posted by DT_Battlekruser on 2004-09-24 at 00:59:21
Yes. Think about rise over run as point (0,0) to (1,0) - Zero Slope goes to (0,0) to (1,inifnity) so that slope becomes infinity - 0/1 until it becomes vertical to (0,0) to (0,infinity) making slope infinity/0
Report, edit, etc...Posted by (U)Bolt_Head on 2004-09-24 at 01:16:45
QUOTE(Tuxedo Templar @ Sep 23 2004, 11:54 PM)
Ahehehe, I DO want to have at least SOME sperm count after making this, so I'll just see if I can even get slopes and work from there.

Slopes go to infinity as they begin reaching vertical, right?
[right][snapback]78122[/snapback][/right]


Wow it has been a long time for you.

Yes 0 is flat and high numbers are closer to vertical.
Report, edit, etc...Posted by .Coko[CK] on 2004-09-24 at 14:58:29
Strickly speaking it is impossible to have a perfect vertical slope, but we won't go there.

I was having fun yesterday seeing if Starcraft could handle simple applied Maths Mechanics, such as the rules of collisions, and its equations, its hard to get starcraft to do division quickly! Also since it lacks a .point value i had to use a huge set of death counts each representing the differnet levels, then used a varying set of units moving location location at different times and seeing if it worked...just about...though so slowly!
Report, edit, etc...Posted by Mini Moose 2707 on 2004-09-24 at 14:59:04
The technical term for an infinite slope is "undefined". As in, the slope isn't zero, there just is no slope.
Report, edit, etc...Posted by Tuxedo Templar on 2004-09-24 at 15:00:55
Got it! W00p. I'll post the map later today after I test it a bit more (just tweaking the behaviors around the map edges). It doesn't do slopes, but I think I won't need to anyway because slopes are useless for telling me which way the shot goes (only the angle).

Heres how it works so far: on a 256^2 map, it finds the x,y coordinates of both the dark swarm and defiler within 1 grid square precision, then computes the delta of each x and y and copies it to mins/gas for display. Since there's no way to get negative numbers for resources, and since the deltas won't ever go beyond 256 each (or rather 9 for the final result, but up to 256 while being computed), I just use the thousands decimal place (and up) to represent negatives, and so far it seems to work perfectly.

That's stage 1. The next stage will be to make sets of triggers that use relativity grids to "travel" from the source (defiler) in the direction of the target (dark swarm), based on each possible delta result.


Newb version: I'm half way done with making a real gunner system with theoretically unlimited directional range via. the defiler gunner system. Now I only need to make the triggers for each possible direction and I'm done!

And yes, this will go in A&O.
Report, edit, etc...Posted by dashrike on 2004-09-24 at 16:04:08
QUOTE(Mini Moose 2707 @ Sep 24 2004, 01:59 PM)
The technical term for an infinite slope is "undefined". As in, the slope isn't zero, there just is no slope.
[right][snapback]78227[/snapback][/right]


Undefined in terms of x anyways... Usually the equation is 'y = ax + b', 'a' and 'b' being constants. 'y' is also interchangeable with 'f(x)', meaning the function in terms of 'x'.


When you get into more complicated math, you get lots of fun stuff like 'f(g(x))', and then with derivaties and intergrals etc. Its lots of fun.
Report, edit, etc...Posted by .Coko[CK] on 2004-09-24 at 16:16:40
g: x |-> x(x + 2) - 4
h: x |-> x/1 + (x+2x)/7

gh(x) =?

(x/1 + (x+2x)/7)((x/1 + (x+2x)/7)+2) - 4

There you go, work that one out, its my current choice of work to do, there is over another 10 similar ones, as well as doing them on graphs, F(x) = x and working out what f(x) = X...
Report, edit, etc...Posted by Tuxedo Templar on 2004-09-24 at 16:33:02
Bah, nobody read my post. Now you're just getting sidetracked into math specifics and stuff.

I don't think you guys realize just what I'm about to make here. A TRUE gunner system with possibly limiteless directional range. Imagine the possibilities: sniper maps, defenses, RPGs (A&O in this case)... tons of stuff. This could be a whole new map type waiting to happen.
Report, edit, etc...Posted by dashrike on 2004-09-24 at 16:37:55
Yay!




When does it happen?
Report, edit, etc...Posted by Tuxedo Templar on 2004-09-24 at 17:14:56
Hopefully soon. I'll make a new thread to post the template for those interested. If everyone isn't to afraid of anything new at this point, there could be some solid potential with this!
Report, edit, etc...Posted by BeeR_KeG on 2004-09-24 at 17:20:56
QUOTE(Tuxedo Templar @ Sep 24 2004, 04:33 PM)
Bah, nobody read my post.  Now you're just getting sidetracked into math specifics and stuff.

I don't think you guys realize just what I'm about to make here.  A TRUE gunner system with possibly limiteless directional range.  Imagine the possibilities: sniper maps, defenses, RPGs (A&O in this case)... tons of stuff.  This could be a whole new map type waiting to happen.
[right][snapback]78284[/snapback][/right]


Thats IF you release the triggers.
Will the gunner system be like slow, like shooting one bullet every couple of seconds or be sort of like a machine gun?

Anyways

(x/1 + (x+2x)/7)((x/1 + (x+2x)/7)+2) - 4
(x+x/7+2x/7)(x+x/7+2x/7+2)-4
(10x/7)(10x/7 +2)-4
100x²/7 + 20x/7 -4
14.28x²+2.85x-4 = gh(x)
This is too easy...

Do this one:

f(x) = x²-3x Check if this function is a 1-1 function(That for 1 point in the x there is 1 in the y)
Next Page (1)