Loading...
  OR  Zero-K Name:    Password:   

Linear Interpolation?

27 posts, 1925 views
Post comment
Filter:    Player:  
Page of 2 (27 records)
sort
9 years ago
I cannot into Linear Interpolation but this is what i've gleaned.

new.distance = a number

current.distance = spGetUnitSeperation(unitID1,unitID2)

local x1,y1,z1 = spGetUnitPosition(unitID1)
local x2,y2,z2 = spGetUnitPosition(unitID2)

new.x=( ( ( new.distance / current.distance ) * (x1-x2) ) + (x2)
new.z=( ( ( new.distance / current.distance ) * (z1-z2) ) + (z2)

it cant be that simple

is it?
+0 / -0
Basically you have it, though one caveat is that your current formulation gives you (x2,z2) when new.distance

0, and (x1,z1) when new.distance

current.distance, which may be the reverse of what you expect.
+1 / -0
wait why basic vectors math popping up in general disc?
+1 / -0

9 years ago
because there is hardly something more general than basic math?
+7 / -0
9 years ago
Can someone plz tell me what linear interpolation is? (Sorry, taking adv. math next year and want to get a head start)
+0 / -0

9 years ago
http://lmgtfy.com/?q=linear+interpolation&l=1
+0 / -0
9 years ago
RUrankParzival Linear Interpolation is how you find a point along a line that is defined by two known points.

If you know (x1,y1) and (x2,z2) and draw a line through those two points, Linear Interpolation will allow you to find (x,y) anywhere on that line.
+1 / -0
RUrankParzival: unless your school has a much better 9th grade math curriculum than most in North America, you (sadly) won't even be taught this or the underlying vector math until university or college. It's a bigger head start than you think.
+0 / -0
9 years ago
Im homeschooled lol, So i take college level stuff at 10th grade
+0 / -0

9 years ago
The world where people use sliders every day and yet lerp is considered university level knowledge.
+4 / -0
It's more that linear algebra is considered uni-level (don't ask me why, it's a pretty direct extension to algebra and would have made some of my 9th grade math homework 100x easier, not to mention being the first time I actually enjoyed math, rather than just being skilled at it) and lerp only makes sense in a linear context.
+0 / -0
+4 / -0

9 years ago
Stuff that shouldn't be legal:
quote:

Im homeschooled lol
+3 / -0
You don't have to think of linear interpolation in terms of lines and vector algebra (although that's what it technically is), it can work with many things. You say "I want 60% between this and that" and so it gives you 60% that and 40% this.

You can also linearly interpolate between the numbers 8 and 12. 50% in between gives 10, 25% gives 9 [color=grey](25% x 12 + 75% x 8

3 + 6

9)[/color] and 75% gives 11. If you want to be fancy: 150% would give 14 [color=grey](150% x 12 + (-50%) x 8

18 - 4

14, black magic! D:)[/color].
Or one can also interpolate colors, just as another example.

Also, lol at PLrankAdminSprung's xkcd imitation.
+1 / -0

9 years ago
quote:
If you want to be fancy: 150% would give 14 (150% x 12 + (-50%) x 8

18 - 4

14, black magic! D:).

Technically that one is "linear extrapolation".
+0 / -0
-snip-
+0 / -0

9 years ago
I'm pretty sure linear interpolation is high or maybe even elementary school knowledge where I used to live, except it wasn't called that, but rather "line formula".
My memory on that is fuzzy, but a quick google shows that it's taught as at most a 3rd year high school class: http://www.slideshare.net/jbogunovicsadamarkovic/jednacina-prave

University level knowledge is Lagrange interpolation/least squares approximation and their implementation in later classes.
+0 / -0
The slope-offset (aka slope-intercept) line formula is taught in high school here, but how that fits in with points or with linear interpolation is not, or at least not well. Basically we only learn to solve for y=0 and then move on to other subjects.

High school math in North America is (or at least was 10 years ago) basically just 4 years of polynomial root calculation followed by 1 year of random trigonometry and conics.
+0 / -0

9 years ago
quote:

Stuff that shouldn't be legal:

Well, I don't remember school as a wonderful source of knowledge and learning so not sure about that.
Regarding the social value, do you really need 12 years for that? (even if you do, evidently it still doesn't get to everyone)

Anyway, don't judge.
+0 / -0
Skasi
9 years ago
Oh oh, I wanna join the political discussion: Most public schools should not be legal. HA!

With that out of the way, isn't all this just simple vector stuff? Pretty sure I learned that in school when I was 10-14. I doubt anything that simple is taught in university.
+0 / -0
Page of 2 (27 records)