
import java.awt.*;


public class JoeyGrids extends Object {
	
	Graphics g;
	
	public JoeyGrids(Graphics g) { 
		this.g = g;
	}
	
	public void setColor(Color c) { 
		g.setColor(c);
	}
	
	
	public void drawIdLine(int id, int x1, int y1, int x2, int y2) {
		
		
		switch (id)	{
		case 0:
			drawGrid00Line(x1, y1, x2, y2);
			break;
		case 1:
			drawGrid01Line(x1, y1, x2, y2);
			break;
		case 2:
			drawGrid02Line(x1, y1, x2, y2);
			break;
		case 3:
			drawGrid03Line(x1, y1, x2, y2);
			break;
		case 4:
			drawGrid04Line(x1, y1, x2, y2);
			break;
		case 5:
			drawGrid05Line(x1, y1, x2, y2);
			break;
		case 6:
			drawGrid06Line(x1, y1, x2, y2);
			break;
		case 7:
			drawGrid07Line(x1, y1, x2, y2);
			break;
		case 8:
			drawGrid08Line(x1, y1, x2, y2);
			break;
		case 9:
			drawGrid09Line(x1, y1, x2, y2);
			break;
			
		default:
			g.drawLine(x1, y1, x2, y2);
		}	
	}
	
	
	public void drawGrid00Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<4; t=t+1) {	
			float s1 = (float)(t);
			float s2 = (float)(t+1);	
			float X1 = (float) (3* Math.sin(s1) * Math.sin(s1));
			float Y1 = (float) (3* Math.cos(s1) * Math.cos(s1));
			float X2 = (float) (3* Math.sin(s2) * Math.sin(s2));
			float Y2 = (float) (3* Math.cos(s2) * Math.cos(s2));
			float tempx = x1 + (float)(x2-x1)*t/4;
			float tempy = y1 + (float)(y2-y1)*t/4;	
			g.drawLine((int)(tempx+X1), (int)(tempy+Y1), (int)(tempx*(X2+Y2)), (int)(tempy*(X1+Y1)));
		}
	}
	
	public void drawGrid01Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<2; t=t+1) {	
			float s1 = (float)(t);	
			float X1 = (float) (7* Math.sin(s1) * Math.sin(s1));
			float Y1 = (float) (5* Math.cos(s1) * Math.sin(s1));
			float tempx = x1 + (float)(x2-x1)*t/2;
			float tempy = y1 + (float)(y2-y1)*t/2;	
			g.drawLine((int)(tempx), (int)(tempy), (int)(300*X1), (int)(300*Y1));
		}
	}
	
		
	public void drawGrid02Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<2; t=t+1) {	
			float s1 = (float)(t);
			float X1 = (float) (5* Math.cos(2*s1) * Math.sin(2*s1));
			float Y1 = (float) (5* Math.cos(s1) * Math.sin(s1));
			float tempx = x1 + (float)(x2-x1)*t/2;
			float tempy = y1 + (float)(y2-y1)*t/2;	
			g.drawLine((int)(tempx), (int)(tempy), (int)(300*X1), (int)(300*Y1));
		}
	}

	public void drawGrid03Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<3; t=t+1) {	
			float s1 = (float)(t);		
			float X1 = (float) ( Math.sin(s1) * Math.sin(s1) * Math.sin(s1));
			float Y1 = (float) ( Math.cos(s1) * Math.sin(s1) * Math.sin(s1));
			float tempx = x1 + (float)(x2-x1)*t/3;
			float tempy = y1 + (float)(y2-y1)*t/3;		
			g.drawLine((int)(tempx), (int)(tempy), (int)(300*X1), (int)(300*Y1));
		}
	}
	
	
	public void drawGrid04Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<4; t=t+1) {	
			float s1 = (float)(t);
			float X1 = (float) (3* Math.cos(5*s1) * Math.cos(3*s1));
			float Y1 = (float) (5* (Math.cos(2*s1) * Math.sin(s1)));

			float tempx = x1 + (float)(x2-x1)*t/5;
			float tempy = y1 + (float)(y2-y1)*t/5;
			
			g.drawLine((int)(tempx), (int)(tempy), (int)(300*X1), (int)(300*Y1));
		}
		
	}
	

	public void drawGrid05Line(int x1, int y1, int x2, int y2) {	
		for (int t=0; t<5; t=t+1) {	
			float s1 = (float)(t);	
			float X1 = (float) (3* Math.cos(s1) * Math.cos(s1));
			float Y1 = (float) (5* Math.cos(s1) * Math.sin(s1));
			float tempx = x1 + (float)(x2-x1)*t/6;
			float tempy = y1 + (float)(y2-y1)*t/6;		
			g.drawLine((int)(tempx), (int)(tempy), (int)(300*X1), (int)(300*Y1));
		}		
	}
	
	
	public void drawGrid06Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<6; t=t+1) {	
			float s1 = (float)(t)/(float)3;
			float s2 = (float)(t+1)/(float)3;	
			float X1 = (float) (3* Math.sin(s1) * Math.cos(s1));
			float Y1 = (float) (3* Math.sin(s1) * Math.sin(s1));
			float X2 = (float) (3* Math.sin(s2) * Math.cos(s2));
			float Y2 = (float) (3* Math.sin(s2) * Math.sin(s2));	
			float tempx = x1 + (float)(x2-x1)*t/4;
			float tempy = y1 + (float)(y2-y1)*t/4;
			g.drawLine((int)(tempx+X1), (int)(tempy+Y1), (int)(400*X2), (int)(400*Y2));
		}
	}
			
	public void drawGrid07Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<7; t=t+1) {	
			float s1 = (float)(t)/(float)3;	
			float X = (float) (5* Math.cos(s1) * Math.cos(s1));
			float Y = (float) (5* Math.cos(s1) * Math.sin(s1));
			float tempx = x1 + (float)(x2-x1)*t/8;
			float tempy = y1 + (float)(y2-y1)*t/8;
			g.drawLine((int)(tempx), (int)(tempy), (int)(-tempx*X), (int)(tempy*Y));
		}
	}
	
	public void drawGrid08Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<8; t=t+1) {	
			float s1 = (float)(t)/(float)3;
			float X1 = (float) (Math.sin(s1) * Math.sin(s1));
			float Y1 = (float) (Math.cos(s1) * Math.sin(s1));
			float tempx = x1 + (float)(x2-x1)*t/11;
			float tempy = y1 + (float)(y2-y1)*t/11;
			g.drawLine((int)(tempx), (int)(tempy), (int)(300*X1), (int)(300*Y1));
		}	
	}
	
	public void drawGrid09Line(int x1, int y1, int x2, int y2) {
		for (int t=0; t<9; t=t+1) {	
			float s1 = (float)(t)/(float)3;
			float s2 = (float)(t+1)/(float)3;
			float X1 = (float) (3* Math.cos(s1) * Math.cos(s1));
			float Y1 = (float) (3* Math.cos(s1) * Math.sin(s1));
			float X2 = (float) (3* Math.cos(s2) * Math.cos(s2));
			float Y2 = (float) (3* Math.cos(s2) * Math.sin(s2));		
			float tempx = x1 + (float)(x2-x1)*t/8;
			float tempy = y1 + (float)(y2-y1)*t/8;
			g.drawLine((int)(tempx+X1), (int)(tempy+Y1), (int)(tempx*X2), (int)(tempy*Y2));
		}
		
	}
	
}
