package timedistortion;

public class Ictx {
	public int width, height, len;
	public PixelData[] pd_cube;

	public Ictx(PixelData[] pd_cube, int len) {
		this.pd_cube = pd_cube;
		this.len = len;
	}

	public PixelData at(float i) {
		return pd_cube[bounded(i)];
		
	}
	public int bounded(float pos) {
		if(pos < 0)
			return 0;
		if(pos >=  pd_cube.length)
			return pd_cube.length - 1;
		return (int)pos;
	}

	@Override
	public String toString() {
		return "Ictx [width=" + width + ", height=" + height + ", len=" + len + "]";
	}
}
