A javascript function to draw regular polygon for HTML5 canvas elements.
Function RegularPolygonPoints(line,centerx,centery,radius)can return an array of points to generate a regular polygon. Parameters: line means number of edges. centerx and centery means the x-axis and y-axis of the geometric center of the polygon. radius means the length of radius of the circumscribed circle of the polygon.
Function RegularPolygon(elementId,line,centerx,centery,radius)can draw a regular polygon in the given canvas field. line,centerx,centery,radius means as above. elementId means the id of the canvas field.