Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,484 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Cubic Spline Interpolation! #162649
10/21/07 19:33
10/21/07 19:33
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
benni Offline OP
Newbie
benni  Offline 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: benni] #162650
10/21/07 19:57
10/21/07 19:57
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
this formula is easy to implement even if you don't understand it:
http://en.wikipedia.org/wiki/Cubic_Hermite_spline

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 Offline OP
Newbie
benni  Offline 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 Offline
Senior Expert
ventilator  Offline
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 Offline OP
Newbie
benni  Offline 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: benni] #162654
10/22/07 08:38
10/22/07 08:38
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Another suggestion that might save you a lot of time when working with software. If you can't find something in the manual, like how to perform a spline movement: Every chm manual has a 'Search' function where you can enter keywords like "Spline".

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 Offline OP
Newbie
benni  Offline 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 Offline OP
Newbie
benni  Offline 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.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1