/// <summary> /// /// </summary> /// <param name="suite"></param> /// <returns></returns> private void PlaceByAxis() { if (Rooms.Count == 0) { return; } var area = 0.0; foreach (var room in Rooms) { area += room.Area; } var roomRows = new List <RoomRow>(); while (RoomsPlaced.Count < Rooms.Count) { roomRows.Clear(); Perimeter = Shaper.RectangleByArea(area * 0.5, Ratio); var roomRow = new RoomRow(Perimeter); roomRows.Add(roomRow); var i = 0; while (i < Rooms.Count) { if (!roomRow.AddRoomFitted(Rooms[i], false)) { break; } i++; } if (i == Rooms.Count) { return; } var compass = Perimeter.Compass(); var row = new Line(compass.SE, compass.SW); var matchRow = new RoomRow(row, area / row.Length()); roomRows.Add(matchRow); while (i < Rooms.Count) { if (!matchRow.AddRoomFitted(Rooms[i], false)) { break; } i++; } Ratio += 0.1; } Rooms.Clear(); foreach (var roomRow in roomRows) { foreach (var room in roomRow.Rooms) { Rooms.Add(room); } } Perimeter = Footprint; }