Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix room orientation #62

Merged
merged 4 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public CirculationSegment(ThickenedPolyline @geometry, Profile @profile, double
this.Geometry = @geometry;
}


// Empty constructor
public CirculationSegment()
: base()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hypar.Elements" Version="2.0.0" />
<PackageReference Include="Hypar.Functions" Version="1.6.0" />
<!-- <PackageReference Include="Hypar.Space.LayoutFunctionCommon" Version="1.4.0" /> -->
</ItemGroup>
<ItemGroup>
<!-- <ProjectReference Include="..\..\..\Elements\Elements\src\Elements.csproj" /> -->
<ProjectReference Include="..\..\LayoutFunctionCommon\LayoutFunctionCommon.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Hypar.Elements" Version="2.0.0" />
<PackageReference Include="Hypar.Functions" Version="1.8.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public LevelElements(IList<Element> @elements, System.Guid @level, System.Guid @
this.Level = @level;
}


// Empty constructor
public LevelElements()
: base()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public LevelVolume(Profile @profile, double @height, double @area, string @build
this.PlanView = @planView;
}


// Empty constructor
public LevelVolume()
: base()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, dou
this.HyparSpaceType = @hyparSpaceType;
}


// Empty constructor
public SpaceBoundary()
: base()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public ThickenedPolyline(Polyline @polyline, double? @width, bool? @flip, double
this.RightWidth = @rightWidth;
}


// Empty constructor
public ThickenedPolyline()
{
Expand Down
9 changes: 8 additions & 1 deletion LayoutFunctions/ClassroomLayout/src/Function.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ public async Task<ClassroomLayoutOutputs> Handler(ClassroomLayoutInputs args, IL

if(this.store == null)
{
this.store = new S3ModelStore<ClassroomLayoutInputs>(RegionEndpoint.GetBySystemName("us-west-1"));
if (args.SignedResourceUrls == null)
{
this.store = new S3ModelStore<ClassroomLayoutInputs>(RegionEndpoint.GetBySystemName("us-west-1"));
}
else
{
this.store = new UrlModelStore<ClassroomLayoutInputs>();
}
}

var l = new InvocationWrapper<ClassroomLayoutInputs,ClassroomLayoutOutputs> (store, ClassroomLayout.Execute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
<ItemGroup>
<PackageReference Include="Hypar.Elements" Version="2.0.0" />
<PackageReference Include="Hypar.Elements.Components" Version="2.0.0" />
<PackageReference Include="Hypar.Functions" Version="1.6.0" />
<PackageReference Include="Elements.LargestInteriorRectangle" Version="1.0.1" />
<PackageReference Include="Elements.LargestInteriorRectangle" Version="2.0.0" />
<!-- <ProjectReference Include="../../../Elements/Elements/src/Elements.csproj" />
<ProjectReference Include="../../../Elements/Elements.Components/src/Elements.Components.csproj" /> -->
</ItemGroup>
Expand Down
17 changes: 13 additions & 4 deletions LayoutFunctions/LayoutFunctionCommon/WallGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static class WallGeneration
{
var wallCandidateOptions = new List<(Line OrientationGuideEdge, List<(Line Line, string Type)> WallCandidates)>();
var allSegments = room.Boundary.Perimeter.Segments().Select(s => s.TransformedLine(room.Transform)).ToList();
var orientationGuideEdges = SortEdgesByPrimaryAccess(allSegments, corridorSegments, levelProfile);
var orientationGuideEdges = SortEdgesByPrimaryAccess(allSegments, corridorSegments, levelProfile, 0.3);
foreach (var orientationGuideEdge in orientationGuideEdges)
{
var wallCandidateLines = new List<(Line line, string type)>
Expand Down Expand Up @@ -379,9 +379,10 @@ public static Line FindEdgeAdjacentToSegments(IEnumerable<Line> edgesToClassify,
for (int i = 0; i < allEdges.Count; i++)
{
var edge = allEdges[i];
var midpt = edge.Mid();
var midpt = edge.Mid().Project(Plane.XY);
foreach (var seg in segmentsToTestAgainst)
{
var segProjected = seg.Projected(Plane.XY);
var dist = midpt.DistanceTo(seg);
// if two segments are basically the same distance to the corridor segment,
// prefer the longer one.
Expand Down Expand Up @@ -444,14 +445,22 @@ public static Line FindEdgeAdjacentToSegments(IEnumerable<Line> edgesToClassify,
{
var edgesByDist = edgesToClassify.Select(e =>
{
var midpt = e.Mid();
var midpt = e.Mid().Project(Plane.XY);
(Line line, double dist) edge = (e, segmentsToTestAgainst.Min(s => midpt.DistanceTo(s)));
return edge;
});

if (maxDist != 0)
{
edgesByDist = edgesByDist.Where(e => e.dist < maxDist);
var edgesUnderMaxDist = edgesByDist.Where(e => e.dist < maxDist);
if (edgesUnderMaxDist.Count() > 0)
{
edgesByDist = edgesUnderMaxDist;
}
else
{
Console.WriteLine($"no matches under max dist — using all edges: {maxDist}");
}
}

var comparer = new EdgesComparer();
Expand Down
65 changes: 43 additions & 22 deletions LayoutFunctions/MeetingRoomLayout/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/test/bin/Debug/netcoreapp3.1/MeetingRoomLayout.Tests.dll",
"args": [],
"cwd": "${workspaceFolder}/test",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/test/bin/Debug/netcoreapp3.1/MeetingRoomLayout.Tests.dll",
"args": [],
"cwd": "${workspaceFolder}/test",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"name": "Attach to Hypar Run",
"type": "coreclr",
"request": "attach",
"processName": "MeetingRoomLayout.Server"
},
{
"name": "Launch Hypar Run (Run once only)",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/server/bin/Debug/net6.0/MeetingRoomLayout.Server.dll",
"args": [
"--workflow-id",
"${input:workflowId}"
],
"preLaunchTask": "server-build"
}
],
"inputs": [
{
"id": "workflowId",
"type": "promptString",
"description": "Enter the workflow id to run."
}
]
}
90 changes: 50 additions & 40 deletions LayoutFunctions/MeetingRoomLayout/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,52 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/test/MeetingRoomLayout.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/test/MeetingRoomLayout.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/test/MeetingRoomLayout.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/test/MeetingRoomLayout.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/test/MeetingRoomLayout.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/test/MeetingRoomLayout.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "server-build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/server/MeetingRoomLayout.Server.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
Loading
Loading