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.
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.
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
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…