import java.applet.*; import java.util.*; import java.awt.*; interface timerObject { public void do_update(); } class Point2d7 { float x, y; Point2d7() { x = 0f; y = 0f; } Point2d7(float x0, float y0) { x = x0; y = y0; } } /* ---------------------------------------------------------------------------- */ class DrawSpirolat7 extends Canvas implements timerObject { float splistang[] = { 18.0000f,20.0000f,20.0000f,20.0000f,20.0000f,20.0000f,20.0000f,20.0000f, 20.0000f,20.0000f,22.5000f,22.5000f,22.5000f,22.5000f,25.7140f,25.7140f, 25.7140f,25.7140f,25.7140f,30.0000f,30.0000f,30.0000f,30.0000f,30.0000f, 30.0000f,30.0000f,30.0000f,30.0000f,30.0000f,30.0000f,30.0000f,30.0000f, 30.0000f,30.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f, 36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f, 36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f, 36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,36.0000f,40.0000f, 40.0000f,40.0000f,40.0000f,40.0000f,40.0000f,45.0000f,45.0000f,45.0000f, 45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f, 45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f, 45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f,45.0000f, 45.0000f,45.0000f,54.0000f,54.0000f,54.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,60.0000f, 60.0000f,60.0000f,60.0000f,60.0000f,60.0000f,72.0000f,90.0000f,75.0000f, 90.0000f,90.0000f,90.0000f,90.0000f,90.0000f,90.0000f,90.0000f,90.0000f, 90.0000f,90.0000f,90.0000f,90.0000f,90.0000f,108.0000f,120.0000f }; int spliststep[] = { 2,1,1,1,1,1,3,2, 2,6,2,4,6,6,2,2, 2,2,2,2,2,3,4,6, 8,8,8,9,9,9,9,9, 9,9,1,1,1,1,1,1, 1,1,1,1,1,1,2,2, 2,2,3,3,3,3,4,7, 7,7,7,7,7,7,7,2, 2,2,3,4,8,1,1,1, 1,1,1,1,2,2,2,2, 2,2,3,3,4,6,6,6, 7,7,10,10,10,10,10,10, 10,10,4,5,5,2,2,2, 2,2,4,4,4,4,4,4, 4,5,5,5,5,5,7,7, 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,2,3,4, 5,5,5,7,9,9,9,9, }; int splistrepeat[] = { 10,9,9,9,9,9,3,9, 9,3,8,4,8,8,7,7, 7,7,7,6,6,4,3,2, 3,3,3,4,4,4,4,4, 4,4,5,5,5,5,5,5, 5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,9, 9,9,6,9,9,8,8,8, 8,8,8,8,4,4,4,4, 4,4,8,8,2,4,4,4, 8,8,4,4,4,4,4,4, 4,4,5,4,4,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,5,4,6, 4,4,4,4,4,4,4,4, 4,4,4,2,2,10,3 }; String splistrevs[] = { "0","0","0","0","0","0","0","0", "0","0","0","0","1,2,3,4,6","1,2,4,6","0","0", "0","0","1,2,4","0","0","0","0","0", "1,3","1,7","1,2,4,6,7,8","0","1,2,3,4,5,6","1,2,3,4,6,9","1,2,3,4,7,8","1,2,3,5,6,9", "1,2,3,5,8,9","1,2,3,7,8,9","0","0","0","0","0","0", "0","0","0","0","0","0","0","0", "0","0","0","1","1,2","1,3","0","1,2,3,6,7", "1,2,4","1,2,4,5,6","1,2,4,6","1,2,5,6","1,3,4,6","1,3,4,7","1,3,5,6,7","0", "0","0","0","1,2,3","1,3,4,5,8","0","0","0", "0","0","0","0","0","0","0","0", "0","0","1","1,2","0","0","1,2,4,5","1,2,4,5,6", "1,3,4,7","1,3,6","1,2,3,4,5,8,9","1,2,3,5,7,10","1,2,3,5,8,9","1,2,3,6,7,8","1,2,3,6,8,9,10","1,3,4,6,7,8,9", "1,3,4,7,8,9,10","1,4,6","0","0","0","0","0","0", "0","0","0","0","1","1,2,3","1,2,4","1,2,4", "1,3,4","0","0","1,2","1,2,5","1,5","1,2,4","1,2,4,5", "0","1","1,2,3","1,2,3,4","1,2,3,4,5,6","1,2,3,4,5,7","1,2,3,4,6,7","1,2,3,5", "1,2,3,5,6,7","1,2,3,6","1,2,4","1,2,4,5","1,2,4,5,6,7","1,2,4,7","1,2,6,7","1,2,7", "1,3,4","1,3,4,5","1,3,4,5,6,7","1,3,4,7","1,3,6,7","1,3,7","1,4,5,6","1,5,6,7", "1,2,3","1,2,3,4,5","1,2,3,4,5,6","1,2,3,6,7,8","1,2,3,7,8","1,5","0","1,2", "1,2,3","1,2,3,4,5","1,2,3,4,5,6","1,2,3,5,6,7","1,2,3,6,7","1,2,3,6,7,8","1,2,3,7,8","1,2,4", "1,2,4,5,6","1,2,4,5,6,7","1,2,4,6,7","1,2,4,6,7,8","1,2,4,7,8","1,2,5,6,7,8","1,2,6,7,8","1,2,8", "1,3","1,3,4","1,3,4,6,7,8","1,3,4,7,8","1,5","1,5,6","0","1", "1,2,3","1,2,3,4","1,2,3,4,5,6","1,2,3,4,5,6,8","1,2,3,4,5,6,9","1,2,3,4,5,7","1,2,3,4,5,7,8","1,2,3,4,5,7,10", "1,2,3,4,5,9,10","1,2,3,4,5,10","1,2,3,4,6,7","1,2,3,4,6,7,8","1,2,3,4,6,10","1,2,3,4,8,9","1,2,3,4,8,9,10","1,2,3,4,9,10", "1,2,3,5,6,7","1,2,3,5,6,7,8","1,2,3,5,6,7,10","1,2,3,5,7,8","1,2,3,5,8,9,10","1,2,3,5,9,10","1,2,3,6","1,2,3,6,7,8", "1,2,3,6,9,10","1,2,3,7,8,9","1,2,3,9","1,2,3,10","1,2,4","1,2,4,5","1,2,4,5,6,7","1,2,4,5,6,7,8", "1,2,4,5,6,7,10","1,2,4,5,6,10","1,2,4,6","1,2,4,6,7,9,10","1,2,4,6,9,10","1,2,4,7","1,2,4,7,8,9,10","1,2,4,10", "1,2,5,6,7,10","1,2,5,6,8,9,10","1,2,7","1,2,7,8","1,2,10","1,3,4,6","1,3,4,6,7,8","1,3,4,6,7,8,10", "1,3,4,6,8,9","1,3,4,6,8,9,10","1,3,4,6,9,10","1,3,4,7","1,3,4,7,8,9,10","1,3,4,7,8,10","1,3,4,8","1,3,4,8,9,10", "1,3,4,10","1,3,5,6","1,3,5,6,9,10","1,3,5,7,8,10","1,3,6,7,8,9,10","1,3,7","1,3,7,8","1,3,7,8,9,10", "1,3,7,10","1,3,9,10","1,3,10","1,4,5","1,3,5,6","1,3,4","1,4,5,6,7,8","1,4,5,6,7,8,9", "1,4,5,6,8,9","1,4,5,6,8,9,10","1,4,5,6,9,10","1,4,7,8,9,10","1,5,6","1,5,6,7","1,5,6,7,8,9","1,5,6,7,8,9,10", "1,5,6,7,9,10","1,5,6,8,9,10","1,5,6,9","1,5,6,10","1,5,7","1,5,7,8","1,5,7,8,9,10","1,5,7,10", "1,6,7,8","1,6,7,8,9,10","1,8,9","1,8,9,10","1,9,10","0","0","0", "0","1,3,4,5","1,2,4,5","1,3,4,6,7","0","1,2,3,5","1,2,3,7,8,9","1,2,4,5,6", "1,2,4,5,7,8,9","1,2,4,6,7,8,9","1,4,7","0","1,3,4,5","0","0" }; float tklist[] = { 0.2800f,0.0500f,0.1250f,0.1750f,0.2100f,0.3600f,0.3600f,0.3530f, 0.3530f,0.3600f,0.2200f,0.3900f,0.3200f,0.4100f,0.4600f,0.4900f, 0.2800f,0.4150f,0.4500f,0.3600f,0.3600f,0.2700f,0.2700f,0.5500f, 0.5700f,0.5700f,0.5700f,0.5700f,0.5700f,0.5700f,0.5700f,0.5700f, 0.5700f,0.5700f,0.1000f,0.1500f,0.2300f,0.3300f,0.4500f,0.7000f, 0.1700f,0.2000f,0.2300f,0.3250f,0.3630f,0.6500f,0.3300f,0.5300f, 0.5300f,0.5300f,0.5300f,0.3000f,0.3300f,0.4200f,0.3300f,0.7200f, 0.3200f,0.3200f,0.3200f,0.4600f,0.5900f,0.6500f,0.6500f,0.2600f, 0.2600f,0.5900f,0.5000f,0.3700f,0.6100f,0.1700f,0.2900f,0.2900f, 0.2900f,0.3700f,0.7100f,0.9900f,0.4100f,0.2000f,0.5900f,0.5900f, 0.8300f,0.9900f,0.2100f,0.1500f,0.5900f,0.4200f,0.5900f,0.7200f, 0.3600f,0.4200f,0.5900f,0.9900f,0.9900f,0.9900f,0.9900f,0.9900f, 0.7800f,0.9900f,0.3300f,0.6500f,0.8300f,0.5800f,0.5800f,0.8700f, 0.9900f,0.9900f,0.5800f,0.8700f,0.8700f,0.8700f,0.8700f,0.8700f, 0.8700f,0.8700f,0.5800f,0.5800f,0.5800f,0.5800f,0.5800f,0.5800f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.5800f,0.5800f,0.5800f,0.5800f,0.5800f,0.5800f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.8650f, 0.8650f,0.8650f,0.8650f,0.8650f,0.8650f,0.4100f,0.9900f,0.7700f, 0.9900f,0.9900f,0.9900f,0.9900f,0.9900f,0.9900f,0.9900f,0.9900f, 0.9900f,0.9900f,0.9900f,0.9900f,0.9900f,0.9900f,0.9900f }; String drawlist[] = { "C","E","E","CE","CE","E","C","K", "EK","C","CEK","E","C","C","E","CE", "EK","EK","CE","K","CK","CE","CE","E", "C","C","C","C","C","C","C","C", "C","C","CE","CE","CE","CE","CE","CE", "CK","K","EK","C","CK","E","CE","EK", "K","CK","EK","E","E","E","E","C", "C","C","C","C","C","C","C","E", "CE","K","K","C","C","CE","K","EK", "CEK","CK","K","K","CE","C","K","CEK", "CK","CK","CE","E","CK","CE","CE","CE", "C","C","C","C","C","C","C","C", "C","C","C","C","K","CE","CEK","CEK", "EK","K","CE","CE","CE","CE","CE","E", "CE","CE","CK","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CE","CE","CE","CE","CE","CE","CE","CE", "CEK","CE","CEK","CE","CEK","CE","CE","CE", "CE","CE","CE","CEK","CE","CE","CE" }; int splistmax = 0; int splistnum = 0; float tangle; int nsteps, nrepeat; double widfact; String nlefts; String ndraw; boolean clrepeat, clstep; boolean firstime, isready; boolean showdata; int pxtrans, pytrans; float xtrans, ytrans, pscale; Color BackColor; int stptime, drwtime, clrtime; public DrawSpirolat7() { /* set initial values */ splistmax = splistang.length - 1; splistnum = 0; /* tangle = (float)splistang[splistnum]; nsteps = spliststep[splistnum]; nrepeat = splistrepeat[splistnum]; nlefts = splistrevs[splistnum]; widfact = tklist[splistnum]; ndraw = drawlist[splistnum]; */ } public void do_update() { if (isready) { /* inc to next set of values */ splistnum = splistnum + 1; if (splistnum > splistmax) splistnum = 0; /* tangle = (float)splistang[splistnum]; nsteps = spliststep[splistnum]; nrepeat = splistrepeat[splistnum]; nlefts = splistrevs[splistnum]; widfact = tklist[splistnum]; ndraw = drawlist[splistnum]; */ isready = false; repaint(); } } public void paint(Graphics g) { float walllen = 10; int numlines = 0; int irepeat, istep; int count = 0, ncount = 0; int into,inti; int docont = 0; int npts = 0; float xmin = 10000, ymin = 10000, xmax = -10000, ymax = -10000; float totalangle = 0; float itotalangle; int iturn, niturn; int nlen; float xdim, ydim; int i = 0; int j = 0; int pxpt = 0, pypt = 0, clxpt = 0, clypt = 0; int ilxpt = 0, ilypt = 0, olxpt = 0, olypt = 0; String cstep, ctemp; Point2d7 pt1 = new Point2d7(0,0), pt2 = new Point2d7(0,0); Point2d7 fpt1 = new Point2d7(0,0); Point2d7 fipt = new Point2d7(0,0), fopt = new Point2d7(0,0); Point2d7 ipt1 = new Point2d7(0,0), opt1 = new Point2d7(0,0); Point2d7 ipt2 = new Point2d7(0,0), opt2 = new Point2d7(0,0); Point2d7 ipt3 = new Point2d7(0,0), opt3 = new Point2d7(0,0); Point2d7 ipt4 = new Point2d7(0,0), opt4 = new Point2d7(0,0); float cdist; Point2d7 cpts[] = new Point2d7[250]; Point2d7 ipts[] = new Point2d7[250]; Point2d7 opts[] = new Point2d7[250]; int polyx[] = new int[4]; int polyy[] = new int[4]; /* System.out.println("next"); */ tangle = (float)splistang[splistnum]; nsteps = spliststep[splistnum]; nrepeat = splistrepeat[splistnum]; nlefts = splistrevs[splistnum]; widfact = tklist[splistnum]; ndraw = drawlist[splistnum]; System.out.println(splistnum+" "+tangle+" "+nsteps+" "+nrepeat+" "+ndraw+" "+nlefts); float wfact = (float)widfact/2; pt1 = new Point2d7(0,0); numlines = 0; npts=0; ctemp = "0,"+nlefts; for (irepeat = 1; irepeat <= nrepeat; irepeat++) { nlen = 10; count = 1; for (istep = 1; istep <= nsteps; istep++) { /* check for left turn */ cstep = ","+String.valueOf(istep); iturn = -1; if (ctemp.indexOf(cstep) > 0) iturn = 1; /* inc angle */ totalangle = totalangle + (float)((180.0 - tangle) * iturn); pt2 = Polar(pt1.x, pt1.y, totalangle, (float)nlen); /* first inside/outside point */ if (numlines==0) { cstep = ","+String.valueOf(2); niturn = -1; if (ctemp.indexOf(cstep) > 0) niturn = 1; itotalangle = totalangle - 90; if (niturn==1) itotalangle = totalangle + 90; fpt1 = pt1; ipt1 = Polar(fpt1.x,fpt1.y,itotalangle,(walllen * wfact)); opt1 = Polar(fpt1.x,fpt1.y,(itotalangle+180),(walllen * wfact)); npts = npts + 1; cpts[npts] = pt1; if (niturn==1) { ipt2 = ipt1; ipt1 = opt1; opt1 = ipt2; } fipt = ipt1; fopt = opt1; } /* distance to next point */ cdist = Distance(fpt1,pt2); /* check for last point */ if ((numlines == ((nrepeat*nsteps)-1)) && (cdist > 0.1)) { /* edges on current line */ ipt2 = Polar(ipt1.x,ipt1.y,totalangle,(nlen*5)); opt2 = Polar(opt1.x,opt1.y,totalangle,(nlen*5)); itotalangle = totalangle; ipt3 = pt2; ipt4 = Polar(ipt3.x,ipt3.y,(itotalangle+90),(nlen*5)); opt3 = pt2; opt4 = Polar(opt3.x,opt3.y,(itotalangle-90),(nlen*5)); /* compute intersection */ ipt2 = xyint(ipt1,ipt2,ipt3,ipt4); opt2 = xyint(opt1,opt2,opt3,opt4); } /* check for not last point */ if ((numlines != ((nrepeat*nsteps)-1)) || (cdist < 0.1)) { /* edges on current line */ ipt2 = Polar(ipt1.x,ipt1.y,totalangle,(nlen*5)); opt2 = Polar(opt1.x,opt1.y,totalangle,(nlen*5)); /* edges on next line */ ncount = count+1; if (ncount > nsteps) ncount=1; cstep = ","+String.valueOf(ncount); niturn = -1; if (ctemp.indexOf(cstep) > 0) niturn = 1; itotalangle = (totalangle + ((180 - tangle) * niturn)); ipt3 = Polar(pt2.x,pt2.y,(itotalangle-90),(walllen*wfact)); ipt4 = Polar(ipt3.x,ipt3.y,itotalangle,(nlen*5)); opt3 = Polar(pt2.x,pt2.y,(itotalangle+90),(walllen*wfact)); opt4 = Polar(opt3.x,opt3.y,(itotalangle+180),(nlen*5)); /* compute intersection */ ipt2 = xyint(ipt1,ipt2,ipt3,ipt4); opt2 = xyint(opt1,opt2,opt3,opt4); /* check for intersection on outside edge */ opt3 = Polar(opt2.x,opt2.y,itotalangle,(nlen*5)); into = ifint(ipt1,ipt2,opt2,opt3); /* check for intersection on inside edge */ ipt3 = Polar(ipt2.x,ipt2.y,itotalangle,(nlen*5)); inti = ifint(ipt2,ipt3,opt1,opt2); /* check intersections - flip inside and outside */ if ((into == 1) || (inti == 1)) { /* edges on current line */ ipt2 = Polar(ipt1.x,ipt1.y,totalangle,(nlen*5)); opt2 = Polar(opt1.x,opt1.y,totalangle,(nlen*5)); /* edges on next line */ ncount = count+1; if (ncount > nsteps) ncount=1; cstep = ","+String.valueOf(ncount); niturn = -1; if (ctemp.indexOf(cstep) > 0) niturn = 1; itotalangle = totalangle+((180-tangle)*niturn); ipt3 = Polar(pt2.x,pt2.y,(itotalangle+90),(walllen*wfact)); ipt4 = Polar(ipt3.x,ipt3.y,(itotalangle+180),(nlen*5)); opt3 = Polar(pt2.x,pt2.y,(itotalangle-90),(walllen*wfact)); opt4 = Polar(opt3.x,opt3.y,itotalangle,(nlen*5)); /* compute intersection */ ipt2 = xyint(ipt1,ipt2,ipt3,ipt4); opt2 = xyint(opt1,opt2,opt3,opt4); } } /* check if closed */ if (cdist < 0.1) { if (widfact < 1.0) { fipt = ipt2; fopt = opt2; } docont = 1; } npts = npts + 1; ipts[npts] = ipt2; opts[npts] = opt2; cpts[npts] = pt2; /* min/max */ if (pt2.x > xmax) xmax = pt2.x; if (pt2.x < xmin) xmin = pt2.x; if (pt2.y > ymax) ymax = pt2.y; if (pt2.y < ymin) ymin = pt2.y; if (ipt2.x > xmax) xmax = ipt2.x; if (ipt2.x < xmin) xmin = ipt2.x; if (ipt2.y > ymax) ymax = ipt2.y; if (ipt2.y < ymin) ymin = ipt2.y; if (opt2.x > xmax) xmax = opt2.x; if (opt2.x < xmin) xmin = opt2.x; if (opt2.y > ymax) ymax = opt2.y; if (opt2.y < ymin) ymin = opt2.y; nlen = nlen + 10; ipt1 = ipt2; opt1 = opt2; pt1 = pt2; numlines = numlines+1; /* check for points */ if ((npts == 249) || (docont == 1)) { istep = nsteps + 1; irepeat = nrepeat + 1; } count = count + 1; } } /* set first point */ ipts[1] = fipt; opts[1] = fopt; /* compute scale to canvas size */ xdim = xmax - xmin; ydim = ymax - ymin; pscale = Math.min((size().width-80) / xdim, (size().height-80) / ydim); xtrans = (float) (0 - xmin); ytrans = (float) (0 - ymin); pxtrans = (((size().width-80) - (int)(xdim * pscale))/2)+40; pytrans = (((size().height-80) - (int)(ydim * pscale))/2)+40; int numpixels = (int)((widfact*10) * pscale); int maxpixels = (int)(10 * pscale); /* System.out.println(splistnum+" "+tklistnum+" "+drwlistnum+" "+numpixels+" "+maxpixels); */ /* clear screen */ if (firstime) { g.setColor(BackColor); g.fillRect(0,0,size().width,size().height); } firstime = false; /* draw spirolateral */ if (showdata) { g.setColor(Color.black); g.setFont( new Font("TimesRoman",Font.BOLD, 14)); g.drawString("Angle: "+String.valueOf(tangle)+ " Steps: "+String.valueOf(nsteps)+ " Repeats: "+String.valueOf(nrepeat)+ " Reverse at: "+nlefts, (int)(size().width*0.05), (int)(size().height*(0.05))); } g.setColor(Color.black); g.setFont( new Font("TimesRoman",Font.BOLD, 18)); g.drawString("< ? >", (int)(size().width*0.05), (int)(size().height*(0.95))); /* angle */ g.drawArc((int)(size().width*0.85), (int)(size().height*(0.90)), 40,40,0,180); g.drawLine((int)((size().width*0.85)+0), (int)((size().height*(0.90))+20), (int)((size().width*0.85)+40), (int)((size().height*(0.90))+20) ); opt4 = Polar((int)((size().width*0.85)+20), (int)((size().height*0.90)+20),-tangle,20f); g.drawLine((int)((size().width*0.85)+20), (int)((size().height*0.90)+20), (int)opt4.x,(int)opt4.y); /* draw lines */ g.setColor(Color.black); for (i = 1; i <= npts; i++) { pxpt = Math.round( (((cpts[i].x+xtrans)*pscale)+pxtrans) ); pypt = Math.round( (((cpts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.drawLine(clxpt,clypt,pxpt,pypt); clxpt = pxpt; clypt = pypt; pxpt = Math.round( (((ipts[i].x+xtrans)*pscale)+pxtrans) ); pypt = Math.round( (((ipts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.drawLine(ilxpt,ilypt,pxpt,pypt); ilxpt = pxpt; ilypt = pypt; pxpt = Math.round( (((opts[i].x+xtrans)*pscale)+pxtrans) ); pypt = Math.round( (((opts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.drawLine(olxpt,olypt,pxpt,pypt); olxpt = pxpt; olypt = pypt; try { Thread.sleep(stptime); } catch (InterruptedException e) {} } /* fill to edge */ g.setColor(Color.black); for (i = 1; i <= npts; i++) { polyx[3] = Math.round( (((ipts[i].x+xtrans)*pscale)+pxtrans) ); polyy[3] = Math.round( (((ipts[i].y+ytrans)*pscale)+pytrans) ); polyx[2] = Math.round( (((opts[i].x+xtrans)*pscale)+pxtrans) ); polyy[2] = Math.round( (((opts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.fillPolygon(polyx, polyy, 4); polyx[0] = polyx[3]; polyy[0] = polyy[3]; polyx[1] = polyx[2]; polyy[1] = polyy[2]; try { Thread.sleep(stptime); } catch (InterruptedException e) {} } System.out.println(ndraw+" "+ndraw.indexOf("C")+" "+ndraw.indexOf("E")+" "+ndraw.indexOf("K")); /* draw center line */ if (ndraw.indexOf("C") > -1) { g.setColor(BackColor); for (j = 1; j <= 2; j++) { for (i = 1; i <= npts; i++) { pxpt = Math.round( (((cpts[i].x+xtrans)*pscale)+pxtrans) ); pypt = Math.round( (((cpts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) { g.drawLine(clxpt,clypt,pxpt,pypt); } clxpt = pxpt; clypt = pypt; try { Thread.sleep(stptime); } catch (InterruptedException e) {} }} } /* draw edge lines */ if (ndraw.indexOf("E") > -1) { g.setColor(BackColor); for (j = 1; j <= 2; j++) { for (i = 1; i <= npts; i++) { pxpt = Math.round( (((ipts[i].x+xtrans)*pscale)+pxtrans) ); pypt = Math.round( (((ipts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.drawLine(ilxpt,ilypt,pxpt,pypt); ilxpt = pxpt; ilypt = pypt; pxpt = Math.round( (((opts[i].x+xtrans)*pscale)+pxtrans) ); pypt = Math.round( (((opts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.drawLine(olxpt,olypt,pxpt,pypt); olxpt = pxpt; olypt = pypt; try { Thread.sleep(stptime); } catch (InterruptedException e) {} }} } /* draw corner lines */ if (ndraw.indexOf("K") > -1) { Corners(numlines, ipts, opts, g); } /* at end of drawing */ try { Thread.sleep(drwtime); } catch (InterruptedException e) {} /* erase it */ g.setColor(BackColor); for (i = 1; i <= npts; i++) { polyx[3] = Math.round( (((ipts[i].x+xtrans)*pscale)+pxtrans) ); polyy[3] = Math.round( (((ipts[i].y+ytrans)*pscale)+pytrans) ); polyx[2] = Math.round( (((opts[i].x+xtrans)*pscale)+pxtrans) ); polyy[2] = Math.round( (((opts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.fillPolygon(polyx, polyy, 4); polyx[0] = polyx[3]; polyy[0] = polyy[3]; polyx[1] = polyx[2]; polyy[1] = polyy[2]; /* edges */ pxpt = Math.round( (((ipts[i].x+xtrans)*pscale)+pxtrans) ); pypt = Math.round( (((ipts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.drawLine(ilxpt,ilypt,pxpt,pypt); ilxpt = pxpt; ilypt = pypt; pxpt = Math.round( (((opts[i].x+xtrans)*pscale)+pxtrans) ); pypt = Math.round( (((opts[i].y+ytrans)*pscale)+pytrans) ); if (i != 1) g.drawLine(olxpt,olypt,pxpt,pypt); olxpt = pxpt; olypt = pypt; try { Thread.sleep(clrtime); } catch (InterruptedException e) {} } /* g.setColor(BackColor); g.fillRect(0,0,size().width,(int)(size().height*0.90)); */ isready = true; } /* ---------------------------------------------------------------------------- */ public void Corners(int numlines, Point2d7 ipts[], Point2d7 opts[], Graphics g) { float hdiff = 0f, hdist = 0f, idist = 0f, odist = 0f; float harea, farea; float iang, oang; int ilxpt = 0, ilypt = 0, olxpt = 0, olypt = 0; int i, j; float walllen = 10; float wfact = (float)widfact/2; Point2d7 ipt1 = new Point2d7(0,0), opt1 = new Point2d7(0,0); Point2d7 ipt2 = new Point2d7(0,0), opt2 = new Point2d7(0,0); Point2d7 iflpt = new Point2d7(0,0), iblpt = new Point2d7(0,0); Point2d7 oflpt = new Point2d7(0,0), oblpt = new Point2d7(0,0); Point2d7 cflpt = new Point2d7(0,0), cblpt = new Point2d7(0,0); hdiff = 0f; for (j = 1; j <= 2; j++) { for (i = 1; i <= numlines; i++) { ipt1 = ipts[i]; ipt2 = ipts[i+1]; idist = Distance(ipt1,ipt2); opt1 = opts[i]; opt2 = opts[i+1]; odist = Distance(opt1,opt2); hdist = (float)(Math.abs(odist-idist) / 2f); if (hdist > hdiff) hdiff = hdist; } /* hdiff = Math.round(hdiff*1000)/1000; */ harea = (hdiff * ((walllen * wfact) * 2f)) / 2f; System.out.println("wfact,hdiff,harea="+wfact+" "+hdiff+" "+harea); g.setColor(BackColor); for (i = 1; i <= numlines; i++) { iflpt = ipts[i]; oflpt = opts[i]; iblpt = ipts[i+1]; oblpt = opts[i+1]; idist = Distance(iflpt,iblpt); odist = Distance(oflpt,oblpt); /* idist = Math.round(Distance(iflpt,iblpt)*1000)/1000; odist = Math.round(Distance(oflpt,oblpt)*1000)/1000; */ iang = Angle(iflpt,iblpt); oang = Angle(oflpt,oblpt); if (Math.round(idist*100) == Math.round(odist*100)) { cflpt = Polar(iflpt.x,iflpt.y,iang,hdiff); cblpt = Polar(oflpt.x,oflpt.y,iang,(idist-hdiff)); farea = (Distance(cflpt,iflpt) * Distance(cflpt,oflpt)) / 2f; if (Math.round(farea*100) != Math.round(harea*100)) { cflpt = Polar(oflpt.x,oflpt.y,iang,hdiff); cblpt = Polar(iflpt.x,iflpt.y,iang,(idist-hdiff)); } /* bottom */ ilxpt = Math.round( (((cflpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((cflpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((iflpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((iflpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((oflpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((oflpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((cflpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((cflpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((cblpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((cblpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((iblpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((iblpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((oblpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((oblpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((cblpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((cblpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); } if (idist > odist) { cflpt = Polar(iflpt.x,iflpt.y,iang,hdiff); cblpt = Polar(iflpt.x,iflpt.y,iang,(idist-hdiff)); /* bottom */ ilxpt = Math.round( (((cflpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((cflpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((oflpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((oflpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((iflpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((iflpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((cflpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((cflpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((cblpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((cblpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((iblpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((iblpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((oblpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((oblpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((cblpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((cblpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); } if (odist > idist) { cflpt = Polar(oflpt.x,oflpt.y,oang,hdiff); cblpt = Polar(oflpt.x,oflpt.y,oang,(odist-hdiff)); /* bottom */ ilxpt = Math.round( (((cflpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((cflpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((oflpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((oflpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((iflpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((iflpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((cflpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((cflpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((cblpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((cblpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((iblpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((iblpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); ilxpt = Math.round( (((oblpt.x+xtrans)*pscale)+pxtrans) ); ilypt = Math.round( (((oblpt.y+ytrans)*pscale)+pytrans) ); olxpt = Math.round( (((cblpt.x+xtrans)*pscale)+pxtrans) ); olypt = Math.round( (((cblpt.y+ytrans)*pscale)+pytrans) ); g.drawLine(ilxpt,ilypt,olxpt,olypt); } try { Thread.sleep(stptime); } catch (InterruptedException e) {} }} } /* ---------------------------------------------------------------------------- */ public void Dosleep(int ttime) { Date now = new Date(); long endTime = now.getTime()+ttime; long nowTime = 0; while (nowTime < endTime) { now = new Date(); nowTime = now.getTime(); } } /* ---------------------------------------------------------------------------- */ public float Angle(Point2d7 p1, Point2d7 p2) { float xoff, yoff, ang; xoff = p2.x - p1.x; yoff = p2.y - p1.y; ang = 0f; if (Math.round(xoff*100) == 0) { if (yoff < 0f) ang = 270f; ang = 90f; } { ang = (float)(Math.atan(yoff / xoff) * 180f / 3.14156); if (xoff < 0f) ang = ang + 180f; ang = 360f + ang; } return ang; } /* ---------------------------------------------------------------------------- */ public float Distance(Point2d7 p1, Point2d7 p2) { return (float)Math.sqrt((float)Math.pow(p1.x-p2.x,2)+(float)Math.pow(p1.y-p2.y,2)); } /* ---------------------------------------------------------------------------- */ public Point2d7 Polar(float xpt, float ypt, float ang, float dist) { return (new Point2d7((float) (xpt + (dist * Math.cos((double)ang * (3.14156/180)))), (float) (ypt + (dist * Math.sin((double)ang * (3.14156/180)))))); } /* ---------------------------------------------------------------------------- */ public Point2d7 xyint(Point2d7 p1, Point2d7 p2, Point2d7 p3, Point2d7 p4) { double a, b, e, c, d, f; double xk, yk, xl, yl, xm, ym, xn, yn; /* first, check to see if the segments intersect by parameterization on s and t; if s and t are both between [0,1], then the segments intersect */ xk = (double)p1.x; yk = (double)p1.y; xl = (double)p2.x; yl = (double)p2.y; xm = (double)p3.x; ym = (double)p3.y; xn = (double)p4.x; yn = (double)p4.y; /* check to see if the segments have any endpoints in common. If they do, then return the endpoints as the intersection point */ if ((xk==xm) && (yk==ym)) { return (new Point2d7((float)xk, (float)yk)); } if ((xk==xn) && (yk==yn)) { return (new Point2d7((float)xk, (float)yk)); } if ((xl==xm) && (yl==ym)) { return (new Point2d7((float)xl, (float)yl)); } if ((xl==xn) && (yl==yn)) { return (new Point2d7((float)xl, (float)yl)); } /* check to see if they intersect */ a = -(yl-yk); b = xl-xk; c = -(yn-ym); d = xn-xm; e = -(a*xk)-(b*yk); f = -(c*xm)-(d*ym); /* they intersect, so compute the intersection point using ax+by+e = 0 and cx+dy+f = 0 */ return (new Point2d7((float)(-(e*d-b*f)/(a*d-c*b)), (float)(-(a*f-c*e)/(a*d-c*b)))); } /* ---------------------------------------------------------------------------- */ public int ifint(Point2d7 p1, Point2d7 p2, Point2d7 p3, Point2d7 p4) { double xk, yk, xl, yl, xm, ym, xn, yn; double s, t; /* first, check to see if the segments intersect by parameterization on s and t; if s and t are both between [0,1], then the segments intersect */ xk = (double)p1.x; yk = (double)p1.y; xl = (double)p2.x; yl = (double)p2.y; xm = (double)p3.x; ym = (double)p3.y; xn = (double)p4.x; yn = (double)p4.y; s = (double)(((xn-xm)*(ym-yk)-(yn-ym)*(xm-xk))/((xn-xm)*(yl-yk)-(yn-ym)*(xl-xk))); t = (double)(((xl-xk)*(ym-yk)-(yl-yk)*(xm-xk))/((xn-xm)*(yl-yk)-(yn-ym)*(xl-xk))); if (((s < 1) && (s > 0)) && ((t < 1) && (t > 0))) return 1; return 0; } /* ---------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------- */ } class myTimer extends Thread { int time; timerObject timer_object; public myTimer(timerObject to, int t) { timer_object = to; time = t; } public void run() { while (true) { try { sleep(time); } catch (InterruptedException e) {} timer_object.do_update(); } } } /* ---------------------------------------------------------------------------- */ /* class PopupFrame extends Frame { public boolean handleEvent(Event evt) { if( evt.id == Event.WINDOW_DESTROY) dispose(); return super.handleEvent(evt); } } */ /* ---------------------------------------------------------------------------- */ public class sprolat7 extends Applet { DrawSpirolat7 pict = new DrawSpirolat7(); myTimer mytimer = new myTimer(pict, 1200); Panel opt1, opt2, opt3, optn, opts; String line1, line2, line3; public void init() { /* brown Color(156,123,75) */ /* light Color(221,206,178) */ Color ColorBeige = new Color(221,206,178); this.setBackground(ColorBeige); pict.BackColor = ColorBeige; pict.setBackground(ColorBeige); pict.firstime = true; pict.isready = true; pict.showdata = false; pict.stptime = 40; pict.drwtime = 1500; pict.clrtime = 40; /* pict.notes[0] = getAudioClip(getCodeBase(), "cnote.au"); pict.notes[1] = getAudioClip(getCodeBase(), "dnote.au"); pict.notes[2] = getAudioClip(getCodeBase(), "enote.au"); pict.notes[3] = getAudioClip(getCodeBase(), "fnote.au"); pict.notes[4] = getAudioClip(getCodeBase(), "gnote.au"); pict.notes[5] = getAudioClip(getCodeBase(), "anote.au"); pict.notes[6] = getAudioClip(getCodeBase(), "bnote.au"); pict.notes[7] = getAudioClip(getCodeBase(), "c1note.au"); */ setLayout(new BorderLayout() ); add("Center", pict); mytimer.start(); } public void Stop() { mytimer.stop(); } public void repaint() { } public boolean mouseDown(Event evt, int x, int y) { System.out.println("Down: " + x + ", " + y); /* based on ? at 48,468 (500,500) [18 1 18 1 18] */ if (x > 39 && x < 57 && y > 459 && y < 477) { if (pict.showdata) { pict.showdata = false; System.out.println("ShowData "+pict.showdata); return true; } pict.showdata = true; System.out.println("ShowData "+pict.showdata); return true; } if (x > 59 && x < 77 && y > 459 && y < 477) { pict.splistnum = pict.splistnum + 1; System.out.println("Right"); } if (x > 20 && x < 38 && y > 459 && y < 477) { System.out.println("Left"); pict.splistnum = pict.splistnum - 1; if (pict.splistnum < 0) pict.splistnum = 1; } /* if ( (y < pict.size().height/2) ){ line1 = "Angle: "+String.valueOf(pict.tangle); line2 = "Steps: "+String.valueOf(pict.nsteps); line3 = "Repeat: "+String.valueOf(pict.nrepeat); PopupFrame f = new PopupFrame(); f.resize(50,10); f.add("North", new Label(line1, Label.LEFT)); f.show(); } */ return true; } } /* ---------------------------------------------------------------------------- */