function RoomPackager.RegionFromBasePlate(Y,T)local J=Y:TopCornersOfBasePlate(T)local I=J[1]local G=I.X local h=I.Z local P=I.X local K=I.Z for T,Y in pairs(J)do G=math.min(G,Y.X)h=math.min(h,Y.Z)P=math.max(P,Y.X)K=math.max(K,Y.Z)end local U=J[1].Y local D=Vector3.new(G,U,h)local o=U+64 local u=Vector3.new(P,o,K)local e=Region3.new(D,u)return e end

function RoomPackager:RegionFromBasePlate(basePlate)
	local topCorners = self:TopCornersOfBasePlate(basePlate)
	
	--we farm the min and max x's and z's from the top corners
	--to get x and z coordinates for the region3 that will contain the room
	--we choose an arbitrary corner so that the initial values are in the data set
	local arbitraryCorner = topCorners[1]
	local minX = arbitraryCorner.X
	local minZ = arbitraryCorner.Z
	local maxX = arbitraryCorner.X
	local maxZ = arbitraryCorner.Z
	for _, corner in pairs(topCorners) do
		minX = math.min(minX, corner.X)
		minZ = math.min(minZ, corner.Z)
		maxX = math.max(maxX, corner.X)
		maxZ = math.max(maxZ, corner.Z)
	end
	
	--construct the region using these new corners we have constructed
	--keeping in mind that all corners in topCorners *should* have the same y value
	local minY = topCorners[1].Y
	local lowerCorner = Vector3.new(minX, minY, minZ)
	local maxY = minY + 64
	local upperCorner = Vector3.new(maxX, maxY, maxZ)
	local region = Region3.new(lowerCorner, upperCorner)
	
	return region
end
