PDA

View Full Version : Centripetal Catmul-Rom spline curve implementation example & demo



JernejL
22-05-2018, 08:10 AM
https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline

This is possibly the most useful spline / curve for game developers, you simply put points, and the curve points will be generated that will go thru them and do nice and logical, reasonable turns.

https://i.imgur.com/JjRUshZ.png

Example source implementation (in 2d)
https://github.com/JernejL/Centripetal-Catmull-Rom-spline-pascal-example

SilverWarior
22-05-2018, 03:27 PM
This will come in handy. Thanks for sharing.

JernejL
23-05-2018, 07:53 AM
No problem :)

Btw.. "mali svet" :)

SilverWarior
23-05-2018, 06:00 PM
Btw.. "mali svet" :)

Ja res je mali svet :)

Yes small world indeed :)

paul_nicholls
03-06-2018, 03:33 AM
Thanks for sharing mate!
I didn't know about this version of a catmull-rom spline, very cool :)

JernejL
03-06-2018, 09:28 AM
Thanks for sharing mate!
I didn't know about this version of a catmull-rom spline, very cool :)

It seems like the best variant:

https://i.imgur.com/SQ1gXrz.png

"uniform" fails miserably, chordal seems to go off track a lot, centripetal seems to do its best in these extreme situations.