/** * Figure out which ring a particular point corresponds to. * * @param x,y Coordinates of the point * @returns Index of ring */ public int ringID(int x, int y) { int id; int r = diameter/2; int rp = (int)Math.sqrt((x-r)*(x-r)+(y-r)*(y-r)); if (rp <= r) { id = (rp*color.length)/r; } else { id = color.length; } id = color.length-1-id; return id; }