I have tried here, for the first few types of looping and math is working well, but sonic have several types and exceptions, as I said, needing treat each one individually.
As a lover of challenges, maybe finish this sample and share it with you will be amazing.
Also, I didn't said your idea is bad, my post was just a point of how I would make it, because we don't have curved surfaces.
scirra.com/forum/request-curves-in-collission-polygons_topic49138.html
Think, any line have a math, simple or not, everything is possible using events..
Flash have the same issue about the collisions, and you need to code your game using AS3, but I saw Sonic remakes everywhere, and looking inside the .swf, everything look being made with code, so, it's possible.
<img src="http://www.renderhjs.net/bbs/flashkit/sonic_loops_diagram.jpg" border="0">
http://board.flashkit.com/board/showthread.php?758308-MX-Rotation-sonic-style-on-slopes
[tube]http://www.youtube.com/watch?v=rFSVpVCCzMI[/tube]
This is just a matter of elipse nonlinear.