/** * Constructs a bounding box tree for points with specified coordinates. * The (x,y,z) coordinates are packed into the specified array such * that (xyz[0],xyz[1],xyz[2]) are the (x,y,z) coordinates of the * 1st point, (xyz[3],xyz[4],xyz[5]) are the (x,y,z) coordinates of * the 2nd point, and so on. * @param minSize the minimum number of points in a child node. * @param xyz array of packed (x,y,z) coordinates. */ public BoundingBoxTree(int minSize, float[] xyz) { Check.argument(minSize>0,"minSize>0"); _n = xyz.length/3; _i = rampint(0,1,_n); _x = copy(_n,0,3,xyz); _y = copy(_n,1,3,xyz); _z = copy(_n,2,3,xyz); _root = new Node(); _root._bb = new BoundingBox(_x,_y,_z); _root._kmin = 0; _root._kmax = _n-1; split(minSize,_root); _x = _y = _z = null; }
/** * Constructs a bounding box tree for points with specified coordinates. * @param minSize the minimum number of points in a child node. * @param x array of x coordinates. * @param y array of y coordinates. * @param z array of z coordinates. */ public BoundingBoxTree(int minSize, float[] x, float[] y, float[] z) { Check.argument(minSize>0,"minSize>0"); Check.argument(x.length==y.length,"x.length==y.length"); Check.argument(x.length==z.length,"x.length==z.length"); _n = x.length; _i = rampint(0,1,_n); _x = copy(x); _y = copy(y); _z = copy(z); _root = new Node(); _root._bb = new BoundingBox(_x,_y,_z); _root._kmin = 0; _root._kmax = _n-1; split(minSize,_root); _x = _y = _z = null; }