public PointNode( BoundingBoxTree.Node bbtNode, float size, float[] xyz, float[] rgb) BoundingBox bb = bbtNode.getBoundingBox(); _bs = new BoundingSphere(bb); _np = bbtNode.getSize();
public QuadNode(BoundingBoxTree.Node bbtNode, int[] ijkl, float[] xyz, float[] uvw, float[] rgb) BoundingBox bb = bbtNode.getBoundingBox(); _bs = new BoundingSphere(bb); _nq = bbtNode.getSize();
public TriangleNode(BoundingBoxTree.Node bbtNode, int[] ijk, float[] xyz, float[] uvw, float[] rgb) BoundingBox bb = bbtNode.getBoundingBox(); _bs = new BoundingSphere(bb); _nt = bbtNode.getSize();
public PointNode( BoundingBoxTree.Node bbtNode, float[] xyz, float[] rgb) { BoundingBox bb = bbtNode.getBoundingBox(); _bs = new BoundingSphere(bb); _np = bbtNode.getSize(); int np = _np; int nv = np; int nc = np; int[] index = bbtNode.getIndices(); _vb = Direct.newFloatBuffer(3*nv); _cb = (rgb!=null)?Direct.newFloatBuffer(3*nc):null; for (int ip=0,iv=0,ic=0; ip<np; ++ip) { int i = 3*index[ip]; _vb.put(iv++,xyz[i+X]); _vb.put(iv++,xyz[i+Y]); _vb.put(iv++,xyz[i+Z]); if (_cb!=null) { _cb.put(ic++,rgb[i+R]); _cb.put(ic++,rgb[i+G]); _cb.put(ic++,rgb[i+B]); } } }
private void test(BoundingBoxTree.Node node, int minSize, float[] x, float[] y, float[] z) { int[] i = node.getIndices(); int n = i.length; assertTrue(minSize<=n); BoundingBox bb = node.getBoundingBox(); for (int j=0; j<n; ++j) { int ij = i[j]; assertTrue(bb.contains(x[ij],y[ij],z[ij])); } BoundingBoxTree.Node left = node.getLeft(); BoundingBoxTree.Node right = node.getRight(); if (left!=null) { assertTrue(bb.contains(left.getBoundingBox())); assertTrue(bb.contains(right.getBoundingBox())); test(left,minSize,x,y,z); test(right,minSize,x,y,z); } else { assertTrue(n/2<minSize); } } }