// Hyper-Rectangle class supporting KDTree class //package edu.wlu.cs.levy.CG; class HRect { protected HPoint min; protected HPoint max; protected HRect(int ndims) { min = new HPoint(ndims); max = new HPoint(ndims); } protected HRect(HPoint vmin, HPoint vmax) { min = (HPoint)vmin.clone(); max = (HPoint)vmax.clone(); } protected Object clone() { return new HRect(min, max); } // from Moore's eqn. 6.6 protected HPoint closest(HPoint t) { HPoint p = new HPoint(t.coord.length); for (int i=0; i=max.coord[i]) { p.coord[i] = max.coord[i]; } else { p.coord[i] = t.coord[i]; } } return p; } // used in initial conditions of KDTree.nearest() protected static HRect infiniteHRect(int d) { HPoint vmin = new HPoint(d); HPoint vmax = new HPoint(d); for (int i=0; i= newmax.coord[i]) return null; } return new HRect(newmin, newmax); } // currently unused protected double area () { double a = 1; for (int i=0; i