ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/proteinstructure/Box.java
Revision: 226
Committed: Fri Jul 6 13:43:30 2007 UTC (17 years, 2 months ago) by duarte
File size: 1420 byte(s)
Log Message:
First geometric hashing implementation for calculating graph (with new class Box). Only does non-crossed cts
Geometrich hashing graph calculation kept in a separate method than normal get_graph. Still either of the methods can be used.
Using javax.vectormath objects for the vectors (distance method also from that)
Using TreeMap for get_coords_for_ct
Line User Rev File contents
1 duarte 226 package proteinstructure;
2    
3     import java.util.TreeMap;
4     import javax.vecmath.Point3d;
5     import javax.vecmath.Point3i;
6    
7     public class Box {
8    
9     Point3i floor;
10    
11     private TreeMap<Integer,Point3d> pointsInBox;
12    
13     public Box(Point3i floor){
14     this.floor=floor;
15     pointsInBox = new TreeMap<Integer, Point3d>();
16     }
17    
18     public void putPoint(int serial, Point3d point){
19     pointsInBox.put(serial, point);
20     }
21    
22     public void getDistancesWithinBox(double[][] distMatrix){ //we pass a reference to the distMatrix that we alter within this method
23     for (int i_serial:pointsInBox.keySet()) {
24     for (int j_serial:pointsInBox.keySet()) {
25     if (j_serial>i_serial){
26     // this only works if previously we have made sure that atom serials are sequential from 0 to MAXATOMSERIAL
27     distMatrix[i_serial][j_serial] = pointsInBox.get(i_serial).distance(pointsInBox.get(j_serial));
28     }
29     }
30     }
31    
32     }
33    
34     public void getDistancesToNeighborBox(Box nbBox ,double[][] distMatrix){
35     for (int i_serial:pointsInBox.keySet()){
36     for (int j_serial:nbBox.pointsInBox.keySet()){
37     if (j_serial>i_serial){
38     // this only works if previously we have made sure that atom serials are sequential from 0 to MAXATOMSERIAL
39     if (distMatrix[i_serial][j_serial]==0.0){ // i.e. if we haven't passed through this cell yet
40     distMatrix[i_serial][j_serial] = pointsInBox.get(i_serial).distance(nbBox.pointsInBox.get(j_serial));
41     }
42     }
43     }
44     }
45     }
46    
47     }