| Class | Line # | Actions | |||
|---|---|---|---|---|---|
| Bond | 25 | 12 | 2 |
| 1 | /* | |
| 2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
| 3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
| 4 | * | |
| 5 | * This file is part of Jalview. | |
| 6 | * | |
| 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. | |
| 11 | * | |
| 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. | |
| 16 | * | |
| 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. | |
| 20 | */ | |
| 21 | package mc_view; | |
| 22 | ||
| 23 | import java.awt.Color; | |
| 24 | ||
| 25 | public class Bond | |
| 26 | { | |
| 27 | float[] start; | |
| 28 | ||
| 29 | float[] end; | |
| 30 | ||
| 31 | Color startCol = Color.lightGray; | |
| 32 | ||
| 33 | Color endCol = Color.lightGray; | |
| 34 | ||
| 35 | public Atom at1; | |
| 36 | ||
| 37 | public Atom at2; | |
| 38 | ||
| 39 | 0 | public Bond(Atom at1, Atom at2) |
| 40 | { | |
| 41 | 0 | this.start = new float[] { at1.x, at1.y, at1.z }; |
| 42 | 0 | this.end = new float[] { at2.x, at2.y, at2.z }; |
| 43 | 0 | this.startCol = at1.color; |
| 44 | 0 | this.endCol = at2.color; |
| 45 | 0 | this.at1 = at1; |
| 46 | 0 | this.at2 = at2; |
| 47 | } | |
| 48 | ||
| 49 | /* | |
| 50 | * public Bond(Bond bond) { this.start = new float[3]; | |
| 51 | * | |
| 52 | * this.start[0] = bond.start[0]; this.start[1] = bond.start[1]; this.start[2] | |
| 53 | * = bond.start[2]; | |
| 54 | * | |
| 55 | * this.end = new float[3]; | |
| 56 | * | |
| 57 | * this.end[0] = bond.end[0]; this.end[1] = bond.end[1]; this.end[2] = | |
| 58 | * bond.end[2]; | |
| 59 | * | |
| 60 | * this.startCol = bond.startCol; this.endCol = bond.endCol; } | |
| 61 | * | |
| 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])); | |
| 65 | * | |
| 66 | * len = (float) (Math.sqrt(len)); | |
| 67 | * | |
| 68 | * return len; } | |
| 69 | */ | |
| 70 | ||
| 71 | 0 | public void translate(float x, float y, float z) |
| 72 | { | |
| 73 | 0 | start[0] = start[0] + x; |
| 74 | 0 | end[0] = end[0] + x; |
| 75 | ||
| 76 | 0 | start[1] = start[1] + y; |
| 77 | 0 | end[1] = end[1] + y; |
| 78 | ||
| 79 | 0 | start[2] = start[2] + z; |
| 80 | 0 | end[2] = end[2] + z; |
| 81 | } | |
| 82 | } |