function makeRegular(polygon, center, radius, angle) {
  const flatCoordinates = polygon.getFlatCoordinates();
  const stride = polygon.getStride();
  const sides = flatCoordinates.length / stride - 1;
  const startAngle = angle ? angle : 0;
  for (let i = 0; i <= sides; ++i) {
    const offset = i * stride;
    const angle = startAngle + (modulo(i, sides) * 2 * Math.PI) / sides;
    flatCoordinates[offset] = center[0] + radius * Math.cos(angle);
    flatCoordinates[offset + 1] = center[1] + radius * Math.sin(angle);
  }
  polygon.changed();
}
Modify the coordinates of a polygon to make it a regular polygon.
@param {Polygon} polygon Polygon geometry.
@param {import("../coordinate.js").Coordinate} center Center of the regular polygon.
@param {number} radius Radius of the regular polygon.
@param {number} [angle] Start angle for the first vertex of the polygon in
    counter-clockwise radians. 0 means East. Default is 0.