
function BoxAligned(Min, Max)
{
	this.Type = "BoxAligned";
	this.Min = Min;
	this.Max = Max;
	
	this.GetCenter = function() 
	{ 
		return [(this.Min[0]+Max[0])/2, (this.Min[1]+this.Max[1])/2, (this.Min[2]+this.Max[2])/2]; 
	}
	this.GetSize = function()
	{
		return [this.Max[0]-this.Min[0], this.Max[1]-this.Min[1], this.Max[2]-this.Min[2]];
	}
	this.GetHalfSize = function()
	{
		return [(this.Max[0]-this.Min[0])*0.5, (this.Max[1]-this.Min[1])*0.5, (this.Max[2]-this.Min[2])*0.5];
	}
	this.SetCenter = function(center)
	{
		var hs = this.GetHalfSize();
		this.Min = [center[0]-hs[0], center[1]-hs[1], center[2]-hs[2]];
		this.Max = [center[0]+hs[0], center[1]+hs[1], center[2]+hs[2]];
	}
}