-
Notifications
You must be signed in to change notification settings - Fork 21
/
Voronoi.html
215 lines (186 loc) · 12.2 KB
/
Voronoi.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Voronoi Sketch Generator">
<meta name="author" content="Hans Kellner">
<title>Voronoi Sketch Generator</title>
<link rel="canonical" href="https://github.com/hanskellner/Fusion360Voronoi">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
<link rel="stylesheet" href="./dist/bootstrap-4.5.3-dist/css/bootstrap.min.css">
<link rel="stylesheet" href="./css/styles.css">
</head>
<body>
<div class="wrapper">
<!-- Sidebar -->
<nav id="sidebar">
<div class="sidebar-header">
<h4>Settings</h4>
</div>
<div class="sidebar-content">
<form>
<div class="form-group">
<label for="edgeStyleSelect">Cell Style</label>
<select class="form-control" id="edgeStyleSelect" aria-describedby="edgeStyleHelp">
<option value="0">Curved</option>
<option value="1">Straight</option>
<option value="2">Circle</option>
<option value="3">Square</option>
<option value="4">Rounded Square</option>
<option value="5">Star</option>
<option value="6">Triangle</option>
<option value="7">Pentagon</option>
<option value="8">Hexagon</option>
<option value="9">Octagon</option>
</select>
<small id="edgeStyleHelp" class="form-text text-muted">Set edges or symbol cell style</small>
</div>
<div class="form-group">
<label for="cellCountRange">Cell Count</label>
<div class="d-flex justify-content-center">
<div class="w-75">
<input type="range" class="form-control custom-range" id="cellCountRange" min="2" max="500" value="100" aria-describedby="cellCountHelp">
</div>
<span class="font-weight-bold text-primary ml-2" id="cellCountValueSpan" style="display: inline-block; width: 2em;"></span>
</div>
<small id="cellCountHelp" class="form-text text-muted">Number of cells</small>
</div>
<div class="form-group">
<label for="cellGapRange">Cell Gap</label>
<div class="d-flex justify-content-center">
<div class="w-75">
<input type="range" class="form-control custom-range" id="cellGapRange" min="0" max="20" value="1" step="0.1" aria-describedby="cellGapHelp">
</div>
<span class="font-weight-bold text-primary ml-2" id="cellGapValueSpan" style="display: inline-block; width: 2em;"></span>
</div>
<small id="cellGapHelp" class="form-text text-muted">Gap between cells (mm)</small>
</div>
<div class="form-group">
<label for="cellScaleRange">Shape Scale</label>
<div class="d-flex justify-content-center">
<div class="w-75">
<input type="range" class="form-control custom-range" id="cellScaleRange" min="25" max="125" value="100" aria-describedby="cellScaleHelp" disabled="disable">
</div>
<span class="font-weight-bold text-primary ml-2" id="cellScaleValueSpan" style="display: inline-block; width: 2em;"></span>
</div>
<small id="cellScaleHelp" class="form-text text-muted">Scale amount for shapes</small>
</div>
<div class="form-group">
<label for="lloydsRange">Relaxation</label>
<div class="d-flex justify-content-center">
<div class="w-75">
<input type="range" class="form-control custom-range" id="lloydsRange" min="0" max="1000" value="200" aria-describedby="lloydsHelp">
</div>
<span class="font-weight-bold text-primary ml-2" id ="lloydsValueSpan" style="display: inline-block; width: 2em;"></span>
</div>
<small id="lloydsHelp" class="form-text text-muted">Relax the cell placement</small>
</div>
<div class="form-group form-row mb-0">
<div class="col-sm-1 ml-4 mr-0 px-0">
<input type="checkbox" class="form-check-input" id="clipCellsOutsideCheckbox" data-bind="value:clipCellsOutsideCheckbox" aria-describedby="clipCellsOutsideHelp" checked disabled="disable">
</div>
<label for="clipCellsOutsideCheckbox" class="col-sm-8 form-check-label pl-0">Clip Outside</label>
</div>
<div class="form-row ml-0 mt-0 mb-2">
<small id="clipCellsOutsideHelp" class="form-text text-muted">Clip cells outside of profile</small>
</div>
<div class="form-group form-row mb-0">
<div class="col-sm-1 ml-4 mr-0 px-0">
<input type="checkbox" class="form-check-input" id="clipCellsIntersectCheckbox" data-bind="value:clipCellsIntersectCheckbox" aria-describedby="clipCellsIntersectHelp" disabled="disable">
</div>
<label for="clipCellsIntersectCheckbox" class="col-sm-8 form-check-label pl-0">Clip Intersecting</label>
</div>
<div class="form-row ml-0 mt-0 mb-2">
<small id="clipCellsIntersectHelp" class="form-text text-muted">Clip cells intersecting profile</small>
</div>
<div class="form-group form-row mb-0">
<div class="col-sm-1 ml-4 mr-0 px-0">
<input type="checkbox" class="form-check-input" id="pageBorderCheckbox" data-bind="value:pageBorderCheckbox" aria-describedby="pageBorderHelp">
</div>
<label for="pageBorderCheckbox" class="col-sm-8 form-check-label pl-0">Show Border</label>
</div>
<div class="form-row ml-0 mt-0 mb-2">
<small id="pageBorderHelp" class="form-text text-muted">Show profile/page border</small>
</div>
<div class="form-group form-row mb-0">
<label for="pagePaddingInput" class="col-sm-6 col-form-label">Padding</label>
<div class="col-sm-5">
<input type="number" class="form-control" id="pagePaddingInput" data-bind="value:pagePaddingInput" min="0" value="0" step="0.1" aria-describedby="pagePaddingHelp">
</div>
</div>
<div class="form-row ml-0 mt-0 mb-2">
<small id="pagePaddingHelp" class="form-text text-muted">Padding around border<span class="units"></span></small>
</div>
<div class="form-group">
<label for="viewScaleRange">Zoom Amount</label>
<div class="d-flex justify-content-center">
<div class="w-75">
<input type="range" class="form-control custom-range" id="viewScaleRange" min="1" max="200" value="100" aria-describedby="viewScaleHelp">
</div>
<span class="font-weight-bold text-primary ml-2" id ="viewScaleValueSpan" style="display: inline-block; width: 2em;"></span>
</div>
<small id="viewScaleHelp" class="form-text text-muted">Zoom in or out of view</small>
</div>
<div class="form-group form-row mb-0">
<div class="col-sm-1 ml-4 mr-0 px-0">
<input type="checkbox" class="form-check-input" id="enableCellEditorCheckbox" data-bind="value:enableCellEditorCheckbox" aria-describedby="enableCellEditorHelp">
</div>
<label for="enableCellEditorCheckbox" class="col-sm-8 form-check-label pl-0">Enable Cell Editor</label>
</div>
<div class="form-row ml-0 mt-0 mb-2">
<small id="enableCellEditorHelp" class="form-text text-muted">Enable editing of cells</small>
</div>
</form>
</div>
</nav>
<!-- Page Content -->
<div id="containerMain" class="p-2">
<nav class="navbar navbar-expand navbar-light bg-light">
<button type="button" id="sidebarCollapse" class="btn btn-info ml-0">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-sliders" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M11.5 2a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM9.05 3a2.5 2.5 0 0 1 4.9 0H16v1h-2.05a2.5 2.5 0 0 1-4.9 0H0V3h9.05zM4.5 7a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM2.05 8a2.5 2.5 0 0 1 4.9 0H16v1H6.95a2.5 2.5 0 0 1-4.9 0H0V8h2.05zm9.45 4a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm-2.45 1a2.5 2.5 0 0 1 4.9 0H16v1h-2.05a2.5 2.5 0 0 1-4.9 0H0v-1h9.05z"/>
</svg>
</button>
<span class="navbar-brand ml-2 mb-0 h1">Voronoi Sketch Generator</span>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarMain" aria-controls="navbarMain" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMain">
<form class="form-inline my-2 my-md-0">
<button class="btn btn-outline-secondary my-2 my-sm-0 ml-3" type="button" id="downloadSVGBtn" style="display: none;">Download SVG</button>
<button class="btn btn-outline-success my-2 my-sm-0 ml-3" type="submit" id="publishToFusionBtn" style="display: none;">Publish to Fusion 360</button>
</form>
</div>
</nav>
<div class="m-3">
<canvas id="voronoiCanvas"></canvas>
<p style="text-align: center">This is the <a href="https://github.com/hanskellner/Fusion360Voronoi" target="_blank">Voronoi</a> add-in for Fusion 360 // By <a href="https://twitter.com/hanskellner" target="_blank">@hanskellner</a></p>
<p id="debug_text"></p>
</div>
</div>
</div>
<script type="text/javascript" src="dist/jquery-3.5.1.slim.min.js"></script>
<script type="text/javascript" src="dist/popper.min.js"></script>
<script type="text/javascript" src="dist/bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="dist/paper/paper-full.min.js"></script>
<script type="text/javascript" src="dist/d3-delaunay/d3-delaunay.js"></script>
<script type="text/javascript" src="dist/d3-delaunay/d3-polygon.v1.min.js"></script>
<script type="text/javascript" src="js/voronoi-editor.js"></script>
</body>
</html>