Esempio n. 1
0
 @Override
 public int hashCode() {
   int res = 17;
   res = 37 * res + m_p1.hashCode();
   res = 37 * res + m_p2.hashCode();
   return res;
 }
Esempio n. 2
0
 public double euclideanDistance() {
   double out = 0.0d;
   long[] p1 = new long[numDimensions()];
   m_p1.localize(p1);
   long[] p2 = new long[numDimensions()];
   m_p2.localize(p2);
   for (int i = 0; i < numDimensions(); i++) {
     out += (p1[i] - p2[i]) * ((p1[i] - p2[i]));
   }
   return Math.sqrt(out);
 }
Esempio n. 3
0
  @Override
  public boolean equals(Object arg) {
    if (arg == null || !(arg instanceof SplitLine)) {
      return false;
    }
    SplitLine<T> res = (SplitLine<T>) arg;

    if (res.numDimensions() != numDimensions()) return false;

    long[] p1 = new long[res.numDimensions()];
    res.getPoints().getFirst().localize(p1);
    long[] p2 = new long[res.numDimensions()];
    res.getPoints().getSecond().localize(p2);

    long[] m1 = new long[numDimensions()];
    m_p1.localize(m1);
    long[] m2 = new long[numDimensions()];
    m_p2.localize(m2);

    if (Arrays.equals(p1, m1) && Arrays.equals(p2, m2)
        || Arrays.equals(p1, m2) && Arrays.equals(p2, m1)) return true;
    else return false;
  }
Esempio n. 4
0
 public SplitLine(int index, RandomAccessible<T> ra, long[] p1, long[] p2) {
   this(index, ra, Point.wrap(p1), Point.wrap(p2));
 }