Normand Briere
2019-10-20 49d9c15d375942997692f7fccfb697665d0cb59e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Hyper-Point class supporting KDTree class
 
//package edu.wlu.cs.levy.CG;
 
class HPoint {
 
    protected double [] coord;
 
    protected HPoint(int n) {
   coord = new double [n];
    }
 
    protected HPoint(double [] x) {
 
   coord = new double[x.length];
   for (int i=0; i<x.length; ++i) coord[i] = x[i];
    }
 
    protected Object clone() {
 
   return new HPoint(coord);
    }
 
    protected boolean equals(HPoint p) {
 
   // seems faster than java.util.Arrays.equals(), which is not 
   // currently supported by Matlab anyway
   for (int i=0; i<coord.length; ++i)
       if (coord[i] != p.coord[i])
       return false;
 
   return true;
    }
 
    protected static double sqrdist(HPoint x, HPoint y) {
   
   return EuclideanDistance.sqrdist(x.coord, y.coord);
    }
    
 
 
    public String toString() {
   String s = "";
   for (int i=0; i<coord.length; ++i) {
       s = s + coord[i] + " ";
   }
   return s;
    }
 
}