Skip to content
This repository was archived by the owner on Nov 24, 2021. It is now read-only.

Commit 634531b

Browse files
committed
add scratch file for creating triangulation
1 parent d6482f9 commit 634531b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

scratch.jl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
activenv("diss")
2+
using Revise
3+
4+
using Random
5+
6+
using PipeLayout
7+
8+
using AbstractPlotting
9+
using CairoMakie
10+
using FileIO
11+
12+
13+
function data(N=7)
14+
Random.seed!(0);
15+
WIDTH = 500
16+
HEIGHT = 300
17+
18+
x = round.(0.95 * WIDTH * rand(N))
19+
y = round.(0.95 * HEIGHT * rand(N))
20+
points = collect([x y]')
21+
end
22+
23+
function draw(path, trimesh)
24+
scene = PipeLayout.empty_scene()
25+
topo = convert(Topology, trimesh)
26+
PipeLayout.draw!(scene, topo)
27+
save(File(format"PNG", path), scene)
28+
nothing
29+
end
30+
31+
points = data()
32+
del = PipeLayout.delaunay_triangulation(points)
33+
draw("del.png", del)
34+
35+
six = PipeLayout.refine_sixths(del)
36+
draw("six.png", six)
37+
38+
six2 = PipeLayout.refine_sixths(del, minimum_angle=15)
39+
draw("six2.png", six2)
40+
s = PipeLayout.TriangleSwitches(minimum_angle=20, maximum_area=2000)
41+
ref = PipeLayout.refine(six2, s)
42+
draw("ref.png", ref)

0 commit comments

Comments
 (0)