0 registered members (),
16,232
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Cubic Spline Interpolation!
#162649
10/21/07 19:33
10/21/07 19:33
|
Joined: Oct 2007
Posts: 49 Hildesheim, Germany
benni
OP
Newbie
|
OP
Newbie
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
|
Hello, has anybody a script that performs a cubic spline interpolation, or knows an other method for smooth movement through specified coordinates? Lite-C seems not to have such a function built in, am I right? But isn't that essential for computer games? I found several resources on the web but my math capabilities are not sufficient for understanding the concept and write a code I think  Anyway, I keep on trying, perhaps somebody has a suggestion...
|
|
|
Re: Cubic Spline Interpolation!
[Re: ventilator]
#162651
10/21/07 20:14
10/21/07 20:14
|
Joined: Oct 2007
Posts: 49 Hildesheim, Germany
benni
OP
Newbie
|
OP
Newbie
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
|
Quote:
this formula is easy to implement even if you don't understand it
 I'm sorry but for me it isn't. But I can try to explain what I don't understand, please don't laugh if it is complete nonsens: This formula interpolates beetween 2 points, therefore it needs the the tangents (m) of those points. But how do I get the tangents?
|
|
|
Re: Cubic Spline Interpolation!
[Re: benni]
#162652
10/21/07 20:44
10/21/07 20:44
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
let's say you have a curve through 4 points: p1 - tangent simply points to p2 p2 - tangents are parallel to p3-p1 p3 - tangents are parallel to p4-p2 p4 - tangent simply points to p3 i am not sure if this is the best method but it seems to make sense if you test it with a drawing on a piece of paper. 
|
|
|
Re: Cubic Spline Interpolation!
[Re: ventilator]
#162653
10/21/07 21:03
10/21/07 21:03
|
Joined: Oct 2007
Posts: 49 Hildesheim, Germany
benni
OP
Newbie
|
OP
Newbie
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
|
Thanks for the suggestion, this seems to be a useful approach! A few minutes ago I had the idea of combining linear interpolation with quadratic bezier... first define a middle step beetween each point with linear interpolation, then do a quadratic bezier interpolation with one point and his two neighboring middle step points. This seems to be easier to calculate- I will work on this and later try Your suggestion 
Last edited by benni; 10/21/07 21:06.
|
|
|
Re: Cubic Spline Interpolation!
[Re: jcl]
#162655
10/22/07 14:13
10/22/07 14:13
|
Joined: Oct 2007
Posts: 49 Hildesheim, Germany
benni
OP
Newbie
|
OP
Newbie
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
|
I didn't miss the slight sarcasm in your post, nevertheless it was very helpful  Also I want to clarify that I was sure I did search the manual...strange things happen after midnight...
Last edited by benni; 10/22/07 14:59.
|
|
|
Re: Cubic Spline Interpolation!
[Re: benni]
#162656
10/22/07 20:16
10/22/07 20:16
|
Joined: Oct 2007
Posts: 49 Hildesheim, Germany
benni
OP
Newbie
|
OP
Newbie
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
|
I just finished Part 1 of a Quadratic Bezier Interpolation Script, it interpolates smooth beetween 3 points, just like here: wikipedia It is probably not a genius work but I'm pretty proud because I started programming just a few days ago. I think it is very fast to compute and, once finished, could be used wherever path_spline is too heavy for example particle movement. My next goal is to combine it with linear interpolation and add a function that jumps to the next 3 points.
|
|
|
|