package sample.svg;

import static util.SVGUtil.*;
public class Polygon {
	public static void main(String[] args) {
		int n=6, r=100;
		start();
		noFill();
		stroke(0x3f3f3f);
		beginShape();
		vertex(0, 0);
		vertex(pageWidth(), 0);
		vertex(pageWidth(), pageHeight());
		vertex(0, pageHeight());
		endShape(true);
		stroke(0x0000ff);
		translate(centerX(), centerY());
		for(int i=0; i<n; i++) {
			double x0 = r*Math.cos(2*i*PI/n);
			double y0 = r*Math.sin(2*i*PI/n);
			double x1 = r*Math.cos(2*(i+1)*PI/n);
			double y1 = r*Math.sin(2*(i+1)*PI/n);
			line(x0, y0, x1, y1);
		}
		finish();
	}
}
