import java.awt.*; import java.lang.Math; public class atom { public int xpos; public int ypos; public int old_xpos; public int old_ypos; public static double pathRadius1; //pixels public static double pathRadius2; public static double realRadius = 1; //Angstroms //Compute coordinates for an atom on a circuit public void atomPosition(double angle) { old_xpos = xpos; old_ypos = ypos; xpos = rint(pathRadius1*Math.sin(Math.PI*angle/180.0)); ypos = rint(pathRadius2*Math.cos(Math.PI*angle/180.0)); } //Round to integer to fix up a problem in Netscape where rint truncates! public int rint(double toRound) { int result=0; if (toRound <= 0.0) result = ((int)(toRound - 0.5)); if (toRound > 0.0) result = ((int)(toRound + 0.5)); return result; } }