/* Toroidia Adventures in (super)toroidal geometry. This version © Fergus Crawshay Murray, February 2000. Any comments or suggestions to toroids@fergusmurray.co.uk. */ import java.awt.*; import java.applet.Applet; public class Toroidia extends java.applet.Applet implements Runnable { // Main entry point when running standalone - note that at present this only runs as an applet... public static void main(String[] args) { Toroidia applet = new Toroidia(); applet.isStandalone = true; Frame frame = new Frame(); frame.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { Frame f = (Frame) e.getSource(); f.setVisible(false); f.dispose(); System.exit(0); } }); frame.setTitle("Applet Frame"); frame.add( applet, BorderLayout.CENTER ); applet.init(); applet.start(); frame.setSize( 768, 576 ); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation( (d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2); frame.setVisible( true ); } // t is the convergence angle, a the roll angle, b the spin angle; // tF, aF and bF are the angles these are set to at the start of each frame. boolean isStandalone=false; double t, a, b, tF, aF, bF, s=150, r=1,x,y, spin=0, roll=0, conv=100, spinF, rollF, convF; float hue; int count, idx, i, leng; int drawer=1, c, ox, oy, xcentre=200,ycentre=200; double f,realx,realy,d,step=0.0001, symmetry=1; float direction=1; double sineArray[]=new double[1025]; Color colours[]=new Color[256]; boolean clearnow=true; public int major=100,minor=64; public Scrollbar majorBar, minorBar, lengBar, convBar, rollBar, spinBar, convFBar, rollFBar, spinFBar; public TextField inputBox; public CheckboxGroup drawType, symmGroup; public Checkbox reverseBox; String theBox,symmName; Image offscreenImg; Graphics offscreenGraphics; public void init() { if(!isStandalone){ offscreenImg=createImage(this.size().width,this.size().height); offscreenGraphics=offscreenImg.getGraphics();} // Create lookup tables for colour and trig functions for (i=0; i