Interpolation Module - Beta testing


This is a developer release.

I made a simple GUI to test out the module.

I’m sure it’s going to have lots of bugs, so help me test it!

Interpolation module (goes in /lua/includes/modules/):
http://solidfiles.com/info_imgs/ZMqk.jpg

Interpolation Graph Test (goes in /lua/ and needs the above file):
http://solidfiles.com/info_imgs/fre1.jpg

Documentation coming later, I’m going to bed!

Have fun!

Edit:



Stoned: 6666! D:


lol

Thanks.

Looks pretty awesome. Nice work.

So if I’m looking at the code right, you have linear, cosine, cubic, and hermite interpolation, right?

Sexy, I gotta apply that somewhere.

Only a question? how could you use that? I mean what is its use?

Looks kewl.

There are many different applications. Making curved paths and beams mostly. The physgun beam uses a form of interpolation - when you sway a prop with it, the beam bends smoothly instead of pointing straight to the prop.

Or with the graph test Deco made, you could make some thing like most Server hosters have where you can see how many players are in the server at times of the day.

With lua you could have it far more advanced like how many props, sents, npcs, etc etc not only entities, but do one of player deaths as well during a set period of 24 hours or what ever.

Now that is a brilliant idea!

Might sound dumb but why make a module for it?

It’s a lua module, not a binary module.

I know what I’m doing today. :3

/me is already in the process.

Mmk. :stuck_out_tongue:

It would be nice to be able to draw the vgui without any points to begin with. Then be able to add them our selfs manually with GraphPanel.PointsTable = y

I can’t seem to remove any of the points without causing a mass spew of errors.

This just made my Tesla Cannon cooler.

Except that’d be in the vector library on a website, not ingame so we can all rape our CPUs

If you set the cache argument to true when creating an interpolating table with interpolation.create then it will only calculate the values once. Or, more if the data changes.

I think the cache functionality is broken, though. Gonna have to fix that.

Thanks for the good replies, guys :smiley:
Anyone found any bugs yet?

I’ll be adding documentation and implementing more features over the next week or so, then I’ll probably loose interest and release it.
Recommend some functionality please :smiley:

I’m gonna see how animation suites like Flash and vector graphics creators like Illustrator do that angle handle thingy.

This could be used for GMod animation suites. You’d be able to control various characteristics of the entities using graphs.
The possibilities are endless. You could overlay graphs onto each other. e.g: Red, Green, Blue.

I hope I don’t loose interest in this :smiley:

Yes it did.

I have a bezier interpolation function (since the one built into GMod doesn’t work), perhaps you could include that?



function PointOn3DBezierCurve(dis,pt1,pt2,pt3) --my poor attempt at a bezier curve algorthm. I think dis is distance along the curve, pt1 is start, pt2 is control, and pt3 is end.
	local out1 = ((1-dis)^2)*pt1.x+2*(1-dis)*dis*pt2.x+(dis^2)*pt3.x
	local out2 = ((1-dis)^2)*pt1.y+2*(1-dis)*dis*pt2.y+(dis^2)*pt3.y
	local out3 = ((1-dis)^2)*pt1.z+2*(1-dis)*dis*pt2.z+(dis^2)*pt3.z
	return Vector(out1,out2,out3)
end


and if you only want interpolation for 1 dimension:



function BezierInterpolation(dis,pt1,pt2,pt3) --my poor attempt at a bezier curve algorthm. I think dis is distance along the curve, pt1 is start, pt2 is control, and pt3 is end.
	return ((1-dis)^2)*pt1+2*(1-dis)*dis*pt2+(dis^2)*pt3
end


[editline]11:29AM[/editline]

It’s a quadratic bezier curve algorithm to be precise.

[editline]11:31AM[/editline]

I could make a cubic bezier function quite easily…

[editline]11:47AM[/editline]



function CubicBezierInterpolation(dis,pt1,pt2,pt3,pt4)
	return ((1-dis)^3)*pt1+3*((1-dis)^2)*dis*pt2+3*((1-dis)^2)*dis*pt3+(dis^3)*pt4
end


There we go. Should work for cubic bezier interpolation, haven’t tested it, though.

As you can see, quadratic only has 1 control point for the curve, and cubic has 2. I could try to make the generalization function (so you can have bezier curves of the nth degree), but I’m not quite sure how well that will go…