/*
Copyright F. P. Marin ( April 07 13:12:53 1998 )
E-mail: felix@bloch.ciens.ucv.ve
Permission to use, copy, modify and distribute this software and its
documentation for NON-COMERCIAL purposes and without fee is hereby
granted provided that this copyright notice appears in all copies.
F. P. Marin makes no representations or warranties about the suitability
of the software, either express or implied, including but no limited to
the implied warranties of merchantability, fitness for a particular
purpose, or non-infringement. F. P. Marin shall not be liable for any
damage suffered by license as a result of using, modifying or
distributing this software or its derivatives.
HTML code is
*/
import java.awt.Graphics;
import java.awt.Color;
public class Cube extends java.applet.Applet implements Runnable
{
double x[],y[],z[];
final double ONE3=1.0/3.0,PHASE=Math.PI/360.0,TWO3=2.0/3.0;
final double SINP=Math.sin(PHASE),COSP=Math.cos(PHASE);
int c,delay;
Thread cube=null;
public void init()
{
int dl;
String s=getParameter("side");
c=( s!=null ) ? Integer.parseInt(s):500;
resize(c,c);
s=getParameter("delay");
delay=( s!=null ) ? Integer.parseInt(s):100;
x=new double[8];
y=new double[8];
z=new double[8];
c/=2;
dl=c/3;
x[0]=x[2]=x[4]=x[6]=y[0]=y[1]=y[4]=y[5]=z[0]=z[1]=z[2]=z[3]=-dl;
x[1]=x[3]=x[5]=x[7]=y[2]=y[3]=y[6]=y[7]=z[4]=z[5]=z[6]=z[7]=dl;
rotatecube();
}
public void rotatecube()
{
double r,temp;
int i;
r=Math.random();
if ( r