mercredi 28 janvier 2015

Curving through a polygon of points

I would like to use canvas draw a smooth curve through a convex polygon of points, with the resulting shape being totally contained by the polygon, as shown in this diagram:


Rounded Polygon


I would like to take the points that define the black pentagon and use them to draw the red smooth closed curve.


I've tried to work out how to do this, but after quite a bit of research I couldn't work out how to ensure that the curving does not escape the polygon, and that the curve is smooth for the entire path (including the join back to the beginning). It seems that one way to do it would be to use the vertices of the polygon as control points, and their midpoints as the actual "vertices" of the red shape, but in trying to implement this my result was not smooth.


Any help would be appreciated!


Aucun commentaire:

Enregistrer un commentaire