-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
63 lines (51 loc) · 1.66 KB
/
Program.cs
File metadata and controls
63 lines (51 loc) · 1.66 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Diagnostics;
using System.Linq;
using netDxf.Tables;
using netDxf;
namespace SearchAThing.Sci.Examples
{
class Program
{
static void Main(string[] args)
{
var doc = new netDxf.DxfDocument();
var N = 20;
var l = 100;
var samples_rows = 10;
var samples_cols = 10;
var lay_bbox = new Layer("bbox") { Color = AciColor.Yellow };
var lay_hull = new Layer("hull") { Color = AciColor.Cyan };
var rnd = new Random(0);
var sr = 0;
var sc = 0;
for (int i = 0; i < samples_rows * samples_cols; ++i)
{
var delta = new Vector3D(sc * l * 1.2, sr * l * 1.2);
var pts = Vector3D.Random(N, 0, l, 0, l, 0, 0, random: rnd).Select(w => w + delta).ToList();
foreach (var p in pts)
{
doc.AddEntity(p);
}
var bbox = pts.BBox();
bbox.DrawCuboid(doc, lay_bbox);
var hull = pts.ConvexHull2D().PolygonSegments(.1);
foreach (var seg in hull)
{
doc.AddEntity(seg, lay_hull);
}
++sc;
if (sc == samples_cols)
{
sc = 0;
++sr;
}
}
doc.DrawingVariables.PdMode = netDxf.Header.PointShape.CircleCross;
doc.DrawingVariables.PdSize = 1;
doc.Viewport.ShowGrid = false;
doc.Save("out.dxf", true);
Process.Start("out.dxf");
}
}
}