-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUsageExample.dib
45 lines (36 loc) · 969 Bytes
/
UsageExample.dib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!csharp
#r "nuget: Hypar.Elements, *-*"
#!csharp
#r "./bin/Debug/netstandard2.0/lir.dll"
#!csharp
using Elements.LIR;
#!csharp
Polygon pgon = new Polygon
(
(9,-7),
(12,-6),
(8,3),
(10,6),
(12,7),
(1,9),
(-8,7),
(-6,6),
(-4,6),
(-6,2),
(-6,0),
(-7,-5),
(-2,-7),
(1,-3),
(5,-7),
(8,-4)
);
// Compute the largest XY-Aligned rectangle that can be drawn inside the polygon.
LargestInteriorRectangle.CalculateLargestInteriorRectangle(pgon, out var best);
// Compute the largest rectangle that can be drawn inside the polygon at any angle.
LargestInteriorRectangle.CalculateLargestInteriorRectangleWithAngleSweep(pgon, 1, out var best2);
var mc = new ModelCurve(pgon, BuiltInMaterials.XAxis);
var mc2 = new ModelCurve(best.Polygon, BuiltInMaterials.YAxis);
var mc3 = new ModelCurve(best2.Polygon, BuiltInMaterials.ZAxis);
var model = new Model();
model.AddElements(mc, mc2, mc3);
return model;