You could connect the two endpoints with a cubic Bézier curve, which achieves 1st- and 2nd-derivative continuity at the endpoints ($P_0$ and $P_3$ in the illustration below). <hr /> [![Bezier][1]][1] <br /> <sup> (Image from [CartouCHe](http://www.e-cartouche.ch/content_reg/cartouche/graphics/en/html/Curves_learningObject2.htmlrl).) </sup> <hr /> [1]: https://i.sstatic.net/XF8De.jpg