I'm using monogame to create a game which takes the users touch input and moves a sprite along the path they have drawn. I want to be able to draw a line from a certain point on screen (say a square) then draw that line in any direction on screen, have it smoothed out (bezier curves) then have a character follow that line.

Does anyone know if monogame supports the curves class thats in xna 4.0? I don't really know where to start with drawing and smoothing a line using the techniques mentioned above from the users touch input, as my maths isn't great.

Has anyone done this before, and wouldnt mind pointing me in the right direction ? Any snippets or articles that you think might useful then please post them. All the articles I've found are using pre determined paths which are smoothed using beziers, not from users touch input.

Cheers

Bezier curves are difficult to curve fit to a set of points automatically because you need to set control points that are not on the curve.

I would suggest using Catmull-Rom splines or some other spline that passes through the control points. You'll have some trouble finding a ready-made implementation but I can help you get started. Catmull-Rom splines are piecewise-defined parametric functions. Your set of points p are your touch coordinates. Given four points, p0, p1, p2 and p3, the segment between p1 and p2 is defined using the equations on that page. You can specify a spline using more segments by creating many b-splines, like so:

spline 0 = p0, p0, p1, p2 (p0 is repeated to ensure the spline starts at p0 rather than at p1)
spline 1 = p0, p1, p2, p3
spline 2 = p1, p2, p3, p4
spline 3 = p2, p3, p4, p5
...
spline (n-1) = p(n-2), p(n-1), p(n), p(n)

To draw the spline, you could either use sprites at regular intervals (drawing a sprite at t=0, t=0.1, t=0.2...) or use a line strip or triangle strip.