Check startup file is not null
[jalview.git] / src / MCview / Bond.jsave
1 package MCview;\r\r
2 \r\r
3 import java.awt.*;\r\r
4 \r\r
5 public class Bond {\r\r
6 \r\r
7   float start[];\r\r
8   float end[];\r\r
9 \r\r
10   Color startCol;\r\r
11   Color endCol;\r\r
12 \r\r
13   public myAtom at1;\r\r
14   public myAtom at2;\r\r
15 \r\r
16   public Bond(float[] start, float[] end, myAtom at1, myAtom at2) {\r\r
17      this.start = start;\r\r
18      this.end = end;\r\r
19      this.startCol = at1.color;\r\r
20      this.endCol = at2.color;\r\r
21      this.at1 = at1;\r\r
22      this.at2 = at2;\r\r
23   }\r\r
24   public Bond(Bond bond) {\r\r
25      this.start = new float[3];\r\r
26      this.start[0] = bond.start[0];\r\r
27      this.start[1] = bond.start[1];\r\r
28      this.start[2] = bond.start[2];\r\r
29      this.end = new float[3];\r\r
30      this.end[0] = bond.end[0];\r\r
31      this.end[1] = bond.end[1];\r\r
32      this.end[2] = bond.end[2];\r\r
33      this.startCol = bond.startCol;\r\r
34      this.endCol = bond.endCol;\r\r
35   }\r\r
36 \r\r
37   public void print() {\r\r
38      System.out.println("Start " + start[0] + " "+ start[1] + " " + start[2]);\r\r
39      System.out.println("End   " + end[0] + " "+ end[1] + " " + end[2]);\r\r
40   }\r\r
41   \r\r
42   public float length() {\r\r
43      float len = (end[0] - start[0])*(end[0] - start[0]) +\r\r
44                   (end[1] - start[1])*(end[1] - start[1]) +\r\r
45                   (end[2] - start[2])*(end[2] - start[2]);\r\r
46      len = (float)(Math.sqrt(len));\r\r
47      return len;\r\r
48   }\r\r
49   public void translate(float x, float y, float z) {\r\r
50      start[0] = (start[0] + x);\r\r
51      end[0] = (end[0] + x);\r\r
52      start[1] =(start[1] + y);\r\r
53      end[1] = (end[1] + y);\r\r
54      start[2] = (start[2] + z);\r\r
55      end[2] = (end[2] + z);\r\r
56   }\r\r
57 }\r\r