// Path: src/com/htssoft/sploosh/ThreadVars.java
// public class ThreadVars {
// 	public Vector3f temp0 = new Vector3f();
// 	public Vector3f temp1 = new Vector3f();
// 	public Vector3f temp2 = new Vector3f();
// 	
// 	public Vector3f[] vec = new Vector3f[6];
// 	{
// 		for (int i = 0; i < vec.length; i++){
// 			vec[i] = new Vector3f();
// 		}
// 	}
// 	
// 	public Matrix3f mat = new Matrix3f();
// }


import com.htssoft.sploosh.ThreadVars;
import com.jme3.bounding.BoundingBox;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
package com.htssoft.sploosh.space;


/**
 * This is not used currently. Nor does it work.
 * 
 * It may be used in the future to accelerate velocity calculations.
 * 
 * Or, it may not, since then we'd be stuffed into a predefined volume.
 * 
 * Dunno.
 * */
public class UniformGrid<T> {
	protected int[] nCells = new int[3];
	protected BoundingBox bounds = new BoundingBox();
	protected Vector3f extent = new Vector3f();
	protected T[] values;
	protected T defaultValue;
	
	@SuppressWarnings("unchecked")
	public UniformGrid(Vector3f min, Vector3f max, int cellsPerUnit, T defaultValue){
		bounds.setMinMax(min, max);
		extent.set(max).subtractLocal(min);
		this.defaultValue = defaultValue;
		
		nCells[0] = (int) (FastMath.ceil(extent.x * cellsPerUnit));
		nCells[1] = (int) (FastMath.ceil(extent.y * cellsPerUnit));
		nCells[2] = (int) (FastMath.ceil(extent.z * cellsPerUnit));
		
		values = (T[]) new Object[nCells[0] * nCells[1] * nCells[2]];
	}
	
// Path: src/com/htssoft/sploosh/ThreadVars.java
// public class ThreadVars {
// 	public Vector3f temp0 = new Vector3f();
// 	public Vector3f temp1 = new Vector3f();
// 	public Vector3f temp2 = new Vector3f();
// 	
// 	public Vector3f[] vec = new Vector3f[6];
// 	{
// 		for (int i = 0; i < vec.length; i++){
// 			vec[i] = new Vector3f();
// 		}
// 	}
// 	
// 	public Matrix3f mat = new Matrix3f();
// }


// Path: src/com/htssoft/sploosh/space/UniformGrid.java
import com.htssoft.sploosh.ThreadVars;
import com.jme3.bounding.BoundingBox;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;

package com.htssoft.sploosh.space;


/**
 * This is not used currently. Nor does it work.
 * 
 * It may be used in the future to accelerate velocity calculations.
 * 
 * Or, it may not, since then we'd be stuffed into a predefined volume.
 * 
 * Dunno.
 * */
public class UniformGrid<T> {
	protected int[] nCells = new int[3];
	protected BoundingBox bounds = new BoundingBox();
	protected Vector3f extent = new Vector3f();
	protected T[] values;
	protected T defaultValue;
	
	@SuppressWarnings("unchecked")
	public UniformGrid(Vector3f min, Vector3f max, int cellsPerUnit, T defaultValue){
		bounds.setMinMax(min, max);
		extent.set(max).subtractLocal(min);
		this.defaultValue = defaultValue;
		
		nCells[0] = (int) (FastMath.ceil(extent.x * cellsPerUnit));
		nCells[1] = (int) (FastMath.ceil(extent.y * cellsPerUnit));
		nCells[2] = (int) (FastMath.ceil(extent.z * cellsPerUnit));
		
		values = (T[]) new Object[nCells[0] * nCells[1] * nCells[2]];
	}
	
	public void insert(T value, Vector3f position, ThreadVars vars){