-
Notifications
You must be signed in to change notification settings - Fork 40
/
fuel.html
225 lines (201 loc) · 16.3 KB
/
fuel.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
216
217
218
219
220
221
222
223
224
225
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<title> fuel | CADtoon</title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<style>
body {
font-family: "Roboto";
background: white;
}
td {
padding: 1em;
text-align: right;
}
.left {
position: fixed;
left: 40px;
width: 480px;
margin: 0 auto;
}
.right {
position: absolute;
left: 560px;
top: 60px;
}
h1 {
font-size: 3em;
}
h2 {
font-size: 2em;
}
.note {
margin-top: -1.5em;
}
#constraints {
width: 100%;
height: 30em;
font-family: monospace;
}
.num {
font-family: monospace;
width: 40px;
float: right;
padding-top: 5px;
text-align: left;
padding-left: 5px;
}
</style>
</head>
<body>
<div id='ractivecontainer'></div>
<script id='ractivetemplate' type='text/ractive'>
<div class="left">
<h1> fuel </h1><br><br><br>
<svg width="300" height="300" version="1.1">
<g transform="scale(3.00)">
<g transform="translate(0,-952.36218)">
<g transform="matrix(0.35423407,0,0,0.42994087,-35.858031,688.41834)">
<g class="plane" transform="matrix({{plane.scalex * plane.scale}}, 0, 0, {{plane.scaley * plane.scale}}, {{plane.x + 126.01282195 * (1-plane.scalex * plane.scale)}}, {{plane.y + 662.03094 * (1-plane.scaley * plane.scale)}})">
<path d="m 232.14732,750.54867 0,-126.8125 c 0,-13.41493 20,-12.7923 20,0 l 0,126.8125 z" style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" transform="matrix({{fuse.scalex * fuse.scale}}, 0, 0, {{fuse.scaley * fuse.scale}}, {{fuse.x + 242.14732 * (1-fuse.scalex * fuse.scale)}}, {{fuse.y + 687.14242 * (1-fuse.scaley * fuse.scale)}})" class="fuse"></path>
<path d="m 303.49107,650.87477 a 5.0005,3.6595115 0 0 0 -4.90625,3.70488 l 0,14.63658 a 5.0005,3.6595115 0 1 0 10,0 l 0,-14.63658 a 5.0005,3.6595115 0 0 0 -5.09375,-3.70488 z" style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" transform="matrix({{engine2.scalex * engine2.scale}}, 0, 0, {{engine2.scaley * engine2.scale}}, {{engine2.x + 303.58482 * (1-engine2.scalex * engine2.scale)}}, {{engine2.y + 660.0455 * (1-engine2.scaley * engine2.scale)}})" class="engine2"></path>
<path d="m 182.05357,650.87478 a 5.0005,3.7433229 0 0 0 -4.90625,3.78974 l 0,14.97179 a 5.0005,3.7433229 0 1 0 10,0 l 0,-14.97179 a 5.0005,3.7433229 0 0 0 -5.09375,-3.78974 z" style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" transform="matrix({{engine1.scalex * engine1.scale}}, 0, 0, {{engine1.scaley * engine1.scale}}, {{engine1.x + 182.14732 * (1-engine1.scalex * engine1.scale)}}, {{engine1.y + 660.255545 * (1-engine1.scaley * engine1.scale)}})" class="engine1"></path>
<path d="m 239.64285,741.66071 -27.5,7.14286 0,10.71428 60,0 0,-10.71428 -27.5,-7.14286 -5,0 z" style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"></path>
<path d="m 239.64285,741.66071 -27.5,7.14286 0,10.71428 60,0 0,-10.71428 -27.5,-7.14286 -5,0 z" style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"></path>
<g transform="translate(116.42857,10)">
<g class="wing" transform="matrix({{wing.scalex * wing.scale}}, 0, 0, {{wing.scaley * wing.scale}}, {{wing.x + 126.01282195 * (1-wing.scalex * wing.scale)}}, {{wing.y + 662.03094 * (1-wing.scaley * wing.scale)}})">
<path style="fill:#000000;fill-opacity:1;stroke:none" d="m 5.6979239,661.98376 0,11.62951 239.9543361,0 0,-11.62951 z" transform="matrix({{wingrect.scalex * wingrect.scale}}, 0, 0, {{wingrect.scaley * wingrect.scale}}, {{wingrect.x + 125.67509195 * (1-wingrect.scalex * wingrect.scale)}}, {{wingrect.y + 667.798515 * (1-wingrect.scaley * wingrect.scale)}})" class="wingrect"></path>
<path style="fill:#000000;fill-opacity:1;stroke:none" d="m 116.35246,650.44861 -109.9790744,11.62951 239.9543344,0 -109.97907,-11.62951 z" transform="matrix({{wingtaper.scalex * wingtaper.scale}}, 0, 0, {{wingtaper.scaley * wingtaper.scale}}, {{wingtaper.x + 126.3505528 * (1-wingtaper.scalex * wingtaper.scale)}}, {{wingtaper.y + 656.263365 * (1-wingtaper.scaley * wingtaper.scale)}})" class="wingtaper"></path>
</g>
</g>
</g>
</g>
<g transform="matrix(0.33791059,0,0,0.33791059,-39.058658,848.18441)">
<g class="airfoil" transform="matrix({{airfoil.scalex * airfoil.scale}}, 0, 0, {{airfoil.scaley * airfoil.scale}}, {{airfoil.x + 263.55751 * (1-airfoil.scalex * airfoil.scale)}}, {{airfoil.y + 555.132635 * (1-airfoil.scaley * airfoil.scale)}})">
<path d="m 116.59001,559.39951 c 0.16625,-9.0575 20.87875,-15.98625 45.98625,-19.4375 42.72125,-4.05625 87.9375,-5.07375 135.115,0.2375 16.51085,1.7946 34.20674,3.82764 51.79946,6.65278 21.25232,3.41282 42.35407,7.98155 61.03429,14.68222 -28.6475,-2.54375 -65.85625,2.9375 -112.59625,8.76875 -49.39875,4.5325 -90.3825,4.37125 -135.3525,0 -31.0175,-2.06125 -46.1475,-5.23625 -45.98625,-10.90375 z" style="fill:#cccccc;stroke:#646464;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"></path>
<path d="m 162.57626,539.96201 0,30.10625 c 44.24875,4.74 89.445,4.74 135.58875,0 l 0,-29.86875 c -45.43375,-4.61 -82.8075,-5.17625 -135.58875,-0.2375 z" style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.85749996;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"></path>
<path d="m 162.57626,539.96201 0,30.10625 c 44.24874,4.74 89.445,4.74 135.58875,0 l 0,-29.86875 c -45.43376,-4.61 -82.80751,-5.17625 -135.58875,-0.2375 z" style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.85749996;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" transform="matrix({{shearinner.scalex * shearinner.scale}}, 0, 0, {{shearinner.scaley * shearinner.scale}}, {{shearinner.x + 230.370635 * (1-shearinner.scalex * shearinner.scale)}}, {{shearinner.y + 555.015135 * (1-shearinner.scaley * shearinner.scale)}})" class="shearinner"></path>
</g>
</g>
</g>
</g>
</svg>
</div><div class="right">
<table id="controls" style="margin: 0 auto;">
<tr><td>
<h2> airfoil </h2></td><td>
scale <input value='{{airfoil.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*airfoil.scale)/100}}</div><br>
scalex <input value='{{airfoil.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*airfoil.scalex)/100}}</div><br>
scaley <input value='{{airfoil.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*airfoil.scaley)/100}}</div><br>
x <input value='{{airfoil.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*airfoil.x)/100}}</div><br>
y <input value='{{airfoil.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*airfoil.y)/100}}</div><br>
</td></tr>
<tr><td>
<h2> engine1 </h2></td><td>
scale <input value='{{engine1.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*engine1.scale)/100}}</div><br>
scalex <input value='{{engine1.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*engine1.scalex)/100}}</div><br>
scaley <input value='{{engine1.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*engine1.scaley)/100}}</div><br>
x <input value='{{engine1.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*engine1.x)/100}}</div><br>
y <input value='{{engine1.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*engine1.y)/100}}</div><br>
</td></tr>
<tr><td>
<h2> engine2 </h2></td><td>
scale <input value='{{engine2.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*engine2.scale)/100}}</div><br>
scalex <input value='{{engine2.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*engine2.scalex)/100}}</div><br>
scaley <input value='{{engine2.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*engine2.scaley)/100}}</div><br>
x <input value='{{engine2.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*engine2.x)/100}}</div><br>
y <input value='{{engine2.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*engine2.y)/100}}</div><br>
</td></tr>
<tr><td>
<h2> fuse </h2></td><td>
scale <input value='{{fuse.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*fuse.scale)/100}}</div><br>
scalex <input value='{{fuse.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*fuse.scalex)/100}}</div><br>
scaley <input value='{{fuse.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*fuse.scaley)/100}}</div><br>
x <input value='{{fuse.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*fuse.x)/100}}</div><br>
y <input value='{{fuse.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*fuse.y)/100}}</div><br>
</td></tr>
<tr><td>
<h2> plane </h2></td><td>
scale <input value='{{plane.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*plane.scale)/100}}</div><br>
scalex <input value='{{plane.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*plane.scalex)/100}}</div><br>
scaley <input value='{{plane.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*plane.scaley)/100}}</div><br>
x <input value='{{plane.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*plane.x)/100}}</div><br>
y <input value='{{plane.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*plane.y)/100}}</div><br>
</td></tr>
<tr><td>
<h2> shearinner </h2></td><td>
scale <input value='{{shearinner.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*shearinner.scale)/100}}</div><br>
scalex <input value='{{shearinner.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*shearinner.scalex)/100}}</div><br>
scaley <input value='{{shearinner.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*shearinner.scaley)/100}}</div><br>
x <input value='{{shearinner.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*shearinner.x)/100}}</div><br>
y <input value='{{shearinner.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*shearinner.y)/100}}</div><br>
</td></tr>
<tr><td>
<h2> wing </h2></td><td>
scale <input value='{{wing.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wing.scale)/100}}</div><br>
scalex <input value='{{wing.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wing.scalex)/100}}</div><br>
scaley <input value='{{wing.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wing.scaley)/100}}</div><br>
x <input value='{{wing.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*wing.x)/100}}</div><br>
y <input value='{{wing.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*wing.y)/100}}</div><br>
</td></tr>
<tr><td>
<h2> wingrect </h2></td><td>
scale <input value='{{wingrect.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wingrect.scale)/100}}</div><br>
scalex <input value='{{wingrect.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wingrect.scalex)/100}}</div><br>
scaley <input value='{{wingrect.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wingrect.scaley)/100}}</div><br>
x <input value='{{wingrect.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*wingrect.x)/100}}</div><br>
y <input value='{{wingrect.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*wingrect.y)/100}}</div><br>
</td></tr>
<tr><td>
<h2> wingtaper </h2></td><td>
scale <input value='{{wingtaper.scale}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wingtaper.scale)/100}}</div><br>
scalex <input value='{{wingtaper.scalex}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wingtaper.scalex)/100}}</div><br>
scaley <input value='{{wingtaper.scaley}}' type="range" min="0" max="2" step="0.05"><div class="num">{{Math.round(100*wingtaper.scaley)/100}}</div><br>
x <input value='{{wingtaper.x}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*wingtaper.x)/100}}</div><br>
y <input value='{{wingtaper.y}}' type="range" min="-150" max="150" step="1"><div class="num">{{Math.round(100*wingtaper.y)/100}}</div><br>
</td></tr>
</table>
<h2> constraints </h2>
<div class="note">access variables by <tt>fuel.id.attribute</tt>, e.g.:<br> <tt>fuel.wingrect.scaley = 1 - fuel.wingtaper.scaley</tt></div>
<textarea id="constraints" onchange="updateCbox();"></textarea>
</div>
</script>
<script src='http://cdn.ractivejs.org/latest/ractive.min.js'></script>
<script>
var fuel = {
airfoil: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
engine1: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
engine2: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
fuse: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
plane: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
shearinner: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
wing: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
wingrect: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
wingtaper: {scalex: 1, scaley: 1, scale: 1, x:0, y:0},
}
var cbox = null
var updateCbox = function () {
if (!constraining) {
constraining = true;
try {
eval(cbox.value)
cbox.style.backgroundColor = "#fff"
}
catch(e) { cbox.style.backgroundColor = "#fdd" }
constraining = false;
}
}
var constraining = false;
var ractive = new Ractive({
el: 'ractivecontainer',
template: '#ractivetemplate',
magic: true,
data: fuel,
onchange: updateCbox
});
var cbox = document.getElementById("constraints")
updateCbox()
</script>
</body>
</html>