Skip to content

Commit

Permalink
Support relative transforms on rooms
Browse files Browse the repository at this point in the history
Needs more testing, and this likely breaks something related to corridor-finding/exterior-edge-finding/etc
  • Loading branch information
serenayl committed Jul 11, 2024
1 parent 16a4136 commit 4d5276e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions LayoutFunctions/LayoutFunctionCommon/LayoutStrategies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ public static void LimitWallCandidateOptionsByConfigId<TSpaceBoundary>(List<(Roo
// If a set of wall candidate options are provided, limit to the one that aligns with the boundary's first edge.
// In the future, as room shapes become more editable, we might want to pass in an explicit "orientation edge" instead of just using the first edge.
var roomOrientationEdge = room.Boundary.Perimeter.Segments().First();
// // If we keep passing in already-transformed lines, we need to compare against the transformed first segment.
// var roomOrientationEdge = room.Boundary.Perimeter.Segments().First().TransformedLine(room.Transform);
for (int i = wallCandidateOptions.Count - 1; i >= 0; i--)
{
var (OrientationGuideEdge, _) = wallCandidateOptions[i];
Expand Down
2 changes: 1 addition & 1 deletion LayoutFunctions/LayoutFunctionCommon/WallGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static List<RoomEdge> FindWallCandidates(ISpaceBoundary room, Profile lev
var thicknesses = room.Boundary.GetEdgeThickness();
var allSegments = room.Boundary.Perimeter.Segments().Select((s, i) => new RoomEdge
{
Line = s.TransformedLine(room.Transform),
Line = new Line(s.Start, s.End),
Thickness = thicknesses?.ElementAtOrDefault(i)
}).ToList();
var orientationGuideEdges = SortEdgesByPrimaryAccess(allSegments, corridorSegments, levelProfile, 0.3);
Expand Down
2 changes: 0 additions & 2 deletions LayoutFunctions/MeetingRoomLayout/src/MeetingRoomLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public override LayoutGenerationResult StandardLayoutOnAllLevels(string programT
seatsTable = new Dictionary<string, RoomTally>();

var result = base.StandardLayoutOnAllLevels(programTypeName, inputModels, (object)overrides, createWalls, configs);


result.OutputModel.AddElements(seatsTable.Select(kvp => kvp.Value).OrderByDescending(a => a.SeatsCount));
return result;
}
Expand Down
7 changes: 6 additions & 1 deletion LayoutFunctions/WallsLOD200/src/WallsLOD200.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ public static WallsLOD200Outputs Execute(Dictionary<string, Model> inputModels,
foreach (var group in wallGroups)
{
var level = levels.FirstOrDefault(l => l.Id.ToString() == group.Key.ToString()) ?? new Level(0, 3, null);
var lines = UnifyLines(group.ToList().Select(g => g.CenterLine).ToList());
var lines = UnifyLines(group.ToList().Select(wall =>
{
var transform = new Transform(wall.Transform);
transform.Move(0, 0, -level.Elevation); // To keep the level.Elevation logic below, negate the wall's Z-position.
return wall.CenterLine.TransformedLine(transform);
}).ToList());
var roundedZLines = lines.Select(l =>
{
var roundedStart = new Vector3(l.Start.X, l.Start.Y, Math.Round(l.Start.Z, 5));
Expand Down

0 comments on commit 4d5276e

Please sign in to comment.