public int[][] getRegularPolygon(int vertices,int rotation, int size){ // returns a list of vertices describing a regular polygon // with n vertices, rotated by (rotation) degrees. // The polygon fits into a rectangle [xTopLeft,yTopLeft,width, height]=[0,0,size,size], // input: vertices: number of vertices // rotation: angle of rotation in degrees // size: size of bounding square, i.e. all coordinates returned // are in [0,size] // output: 2 dimensional array V of vertex coordinates, v[][0]=x,V[][1]=y double [][]p=new double[vertices][2]; int [][]V=new int[vertices][2]; // The basic regular polygon double degDiff=360.0/(vertices-1); for (int i=0; i