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.
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
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
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 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
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.
It’s a quadratic bezier curve algorithm to be precise.
I could make a cubic bezier function quite easily…
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…