linear interpolation between sparse annotation element values.
[jalview.git] / src / MCview / Bond.java
1 /*
2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18 */
19 package MCview;
20
21 import java.awt.*;
22
23
24 public class Bond {
25     float[] start;
26     float[] end;
27     Color startCol = Color.lightGray;
28     Color endCol= Color.lightGray;
29     public Atom at1;
30     public Atom at2;
31
32     public Bond(float[] start, float[] end, Atom at1, Atom at2) {
33         this.start = start;
34         this.end = end;
35         this.startCol = at1.color;
36         this.endCol = at2.color;
37         this.at1 = at1;
38         this.at2 = at2;
39     }
40
41   /*  public Bond(Bond bond) {
42         this.start = new float[3];
43
44         this.start[0] = bond.start[0];
45         this.start[1] = bond.start[1];
46         this.start[2] = bond.start[2];
47
48         this.end = new float[3];
49
50         this.end[0] = bond.end[0];
51         this.end[1] = bond.end[1];
52         this.end[2] = bond.end[2];
53
54         this.startCol = bond.startCol;
55         this.endCol = bond.endCol;
56     }
57
58     public float length() {
59         float len = ((end[0] - start[0]) * (end[0] - start[0])) +
60             ((end[1] - start[1]) * (end[1] - start[1])) +
61             ((end[2] - start[2]) * (end[2] - start[2]));
62
63         len = (float) (Math.sqrt(len));
64
65         return len;
66     }*/
67
68     public void translate(float x, float y, float z) {
69         start[0] = (start[0] + x);
70         end[0] = (end[0] + x);
71
72         start[1] = (start[1] + y);
73         end[1] = (end[1] + y);
74
75         start[2] = (start[2] + z);
76         end[2] = (end[2] + z);
77     }
78 }