-- private functions


local type = type;
local unpack = unpack;
local insert = table.insert;
local R3 = Region3.new;

local v3 = Vector3.new;

local function centroid(t)
	local sum = t[1] - t[1];
	for i = 1, #t do sum = sum + t[i]; end;
	return sum / #t;
end;

local function classify(part)
	if (part.ClassName == "Part") then
		if (part.Shape == Enum.PartType.Block) then
			return region3.block(part.CFrame, part.Size);
		elseif (part.Shape == Enum.PartType.Cylinder) then
			return region3.cylinder(part.CFrame, part.Size);
		elseif (part.Shape == Enum.PartType.Ball) then
			return region3.ellipsoid(part.CFrame, part.Size);
		end;
	elseif (part.ClassName == "WedgePart") then
		return region3.wedge(part.CFrame, part.Size);
	elseif (part.ClassName == "CornerWedgePart") then
		return region3.cornerWedge(part.CFrame, part.Size);
	elseif (part:IsA("BasePart")) then -- mesh, CSG, truss, etc... just use block
		return region3.block(part.CFrame, part.Size);
	end;
end;
