2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.awt.Color;
31 Color startCol = Color.lightGray;
33 Color endCol = Color.lightGray;
39 public Bond(Atom at1, Atom at2)
41 this.start = new float[] { at1.x, at1.y, at1.z };
42 this.end = new float[] { at2.x, at2.y, at2.z };
43 this.startCol = at1.color;
44 this.endCol = at2.color;
50 * public Bond(Bond bond) { this.start = new float[3];
52 * this.start[0] = bond.start[0]; this.start[1] = bond.start[1]; this.start[2]
55 * this.end = new float[3];
57 * this.end[0] = bond.end[0]; this.end[1] = bond.end[1]; this.end[2] =
60 * this.startCol = bond.startCol; this.endCol = bond.endCol; }
62 * public float length() { float len = ((end[0] - start[0]) * (end[0] -
63 * start[0])) + ((end[1] - start[1]) * (end[1] - start[1])) + ((end[2] -
64 * start[2]) * (end[2] - start[2]));
66 * len = (float) (Math.sqrt(len));
71 public void translate(float x, float y, float z)
73 start[0] = start[0] + x;
76 start[1] = start[1] + y;
79 start[2] = start[2] + z;