forked from ricktu288/ray-optics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
349 lines (334 loc) · 13.4 KB
/
index.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ray Optics Simulation</title>
<meta property="og:title" content="Ray Optics Simulation">
<meta property="og:type" content="website">
<meta property="og:url" content="https://ricktu288.github.io/ray-optics/">
<meta property="og:image" content="https://ricktu288.github.io/ray-optics/image.png">
<meta property="og:description" content="An open-source web app to simulate reflection and refraction of light.">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="icon" href="icon128.png" type="image/png">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-82058200-1', 'auto');
ga('send', 'pageview');
</script>
<style>
.carousel-inner > .item > img {
width: 1280px;
}
.thumbnail.right-caption > img {
float: left;
margin-right: 9px;
}
.thumbnail {
margin-bottom: 5px;
}
.tool-title {
font-size: 16pt;
margin-top: 0px;
margin-bottom: 0px;
}
.mode-title {
font-size: 16pt;
margin-top: 0px;
margin-bottom: 0px;
}
</style>
</head>
<body>
<div class="container">
<center>
<h1><b><span id="title">Ray Optics Simulation</span></b></h1>
<p id="description">
An open-source web application to simulate reflection and refraction of light.<br>
Written in HTML, CSS and JavaScript.
</p>
<p>
<a href="simulator/" target="_blank" class="btn btn-success btn-lg" id="start">Start Application</a>
<a href="https://github.com/ricktu288/ray-optics" class="btn btn-primary btn-lg" id="github_link">View on GitHub</a>
<a href="simulator_old/" target="_blank" class="btn btn-info btn-lg" id="start-old">Mobile Version</a>
</p>
</center>
<br>
<div id="screenshots" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#screenshots" data-slide-to="0" class="active"></li>
<li data-target="#screenshots" data-slide-to="1"></li>
<li data-target="#screenshots" data-slide-to="2"></li>
<li data-target="#screenshots" data-slide-to="3"></li>
<li data-target="#screenshots" data-slide-to="4"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="img/1.png" alt="1.png">
</div>
<div class="item">
<img src="img/3.png" alt="3.png">
</div>
<div class="item">
<img src="img/2.png" alt="2.png">
</div>
<div class="item">
<img src="img/4.png" alt="4.png">
</div>
<div class="item">
<img src="img/5.png" alt="5.png">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#screenshots" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#screenshots" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="row" style="font-size: 10pt">
<div class="col-sm-6">
<div class="col-sm-12">
<h2 id="tools">Tools</h2>
<div class="row thumbnail right-caption">
<img src="img/ray.png" alt="ray" class="img-rounded">
<div class="caption">
<p class="tool-title" id="ray">Ray</p>
<span id="ray_desc">
A single ray of light defined by two points.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/beam.png" alt="Beam" class="img-rounded">
<div class="caption">
<p class="tool-title" id="beam">Beam</p>
<span id="beam_desc">
A parallel beam of rays emerges from a line-segment,
with density controlled by the "Ray density" slider.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/point_source.png" alt="Point Source" class="img-rounded">
<div class="caption">
<p class="tool-title" id="point_source">Point Source</p>
<span id="point_source_desc">
Rays emerge from a single point,
with number controlled by the "Ray density" slider.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/mirror.png" alt="Mirror" class="img-rounded">
<div class="caption">
<p class="tool-title" id="mirror">Mirror</p>
<span id="mirror_desc">
Simulate the reflection of light on a mirror.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/mirror_arc.png" alt="Mirror (Arc)" class="img-rounded">
<div class="caption">
<p class="tool-title" id="mirror_arc">Mirror (Arc)</p>
<span id="mirror_arc_desc">
A mirror whose shape is part of a circle,
which is defined by three points.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/ideal_curved_mirror.png" alt="Ideal curved mirror" class="img-rounded">
<div class="caption">
<p class="tool-title" id="ideal_curved_mirror">Ideal curved mirror</p>
<span id="ideal_curved_mirror_desc">
The idealized "curved" mirror which obeys exactly the mirror equation (1/p + 1/q = 1/f).
The focal length (in pixels) can be set directly.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/glass_halfplane.png" alt="Glass" class="img-rounded">
<div class="caption">
<p class="tool-title" id="glass_halfplane">Glass</p>
<span id="glass_halfplane_desc">
Simulate the the refraction and reflection of light on a surface.
The intensities are calculated by assuming unpolarized.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/glass_circle.png" alt="Glass (Circle)" class="img-rounded">
<div class="caption">
<p class="tool-title" id="glass_circle">Glass (Circle)</p>
<span id="glass_circle_desc">
Glass with circle shape, defind by its center and a point on the surface.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/glass.png" alt="Glass (Other shapes)" class="img-rounded">
<div class="caption">
<p class="tool-title" id="glass">Glass (Other shapes)</p>
<span id="glass_desc">
Glass with any shapes constructed from line segments and circular arcs,
including prisms and "spherical" lenses.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/ideal_lens.png" alt="Glass (Ideal lens)" class="img-rounded">
<div class="caption">
<p class="tool-title" id="ideal_lens">Glass (Ideal lens)</p>
<span id="ideal_lens_desc">
An ideal lens which obeys exactly the thin lens equation (1/p + 1/q = 1/f).
The focal length (in pixels) can be set directly.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/blocker.png" alt="Blocker" class="img-rounded">
<div class="caption">
<p class="tool-title" id="blocker">Blocker</p>
<span id="blocker_desc">
A line-segment light blocker which absorbes the incident rays.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/ruler.png" alt="Ruler" style="width:100px;" class="img-rounded">
<div class="caption" class="img-rounded">
<p class="tool-title" id="ruler">Ruler</p>
<span id="ruler_desc">
A ruler from a point for zero and another point.
The scale is in pixels.
</span>
</div>
</div>
<div class="row thumbnail right-caption">
<img src="img/protractor.png" alt="Protractor" style="width:100px;" class="img-rounded">
<div class="caption" class="img-rounded">
<p class="tool-title" id="protractor">Protractor</p>
<span id="protractor_desc">
A protractor defined from center and another point for the zero direction.
The scale is in degrees.
</span>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="col-sm-12">
<h2 id="views">Views</h2>
<div class="row thumbnail">
<div class="caption">
<p class="mode-title" id="rays">Rays</p>
<span id="rays_desc">
Show the rays. When the "Ray density" is high, they appears to be continuous.
</span>
</div>
<img src="img/low_density.png" alt="Low density" class="img-rounded">
<img src="img/high_density.png" alt="High density" style="margin-top:5px" class="img-rounded">
</div>
<div class="row thumbnail">
<div class="caption">
<p class="mode-title" id="extended_rays">Extended Rays</p>
<span id="extended_rays_desc">
Show both the rays and its extension.
Orange indicates backward extensions, and gray indicates forward ones.
</span>
</div>
<img src="img/extended_rays.png" alt="Extended rays" class="img-rounded">
</div>
<div class="row thumbnail">
<div class="caption">
<p class="mode-title" id="all_images">All Images</p>
<span id="all_images_desc">
Show the position of all images.
Yellow points indicate real images, orange indicate virtual images,
and gray (none in this picture) indicate virtual objects.
Note that some images cannot be detected if "Ray density" is not high enough.
</span>
</div>
<img src="img/all_images.png" alt="All images" class="img-rounded">
</div>
<div class="row thumbnail">
<div class="caption">
<p class="mode-title" id="seen_by_observer">Seen by observer</p>
<span id="seen_by_observer_desc">
Simulate the rays and images seen from some position.
The blue circle is the observer.
Any rays crossing it are considered to be "observed".
The observer do not know where the rays actually begin,
but may think they begin at some point(s) if they intersect there.
The rays are shown in blue, and the point(s) in orange.
</span>
</div>
<img src="img/seen_by_observer.png" alt="Seen by obeserver" class="img-rounded">
</div>
</div>
</div>
</div>
<div style="float: right;">
<div class="dropup">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
<span id="language">Language</span>
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="#" onclick="setLang('en');event.preventDefault();">English</a></li>
<li><a href="#" onclick="setLang('zh-TW');event.preventDefault();">正體中文</a></li>
<li><a href="#" onclick="setLang('zh-CN');event.preventDefault();">简体中文</a></li>
</ul>
</div>
</div>
</div>
<script src="locales/en.js"></script>
<script src="locales/zh_CN.js"></script>
<script src="locales/zh_TW.js"></script>
<script>
var default_lang = 'en';
var browser_lang = '';
function setLang(lang) {
document.body.style.fontFamily = locales[lang].font.message;
document.title = locales[lang]["page_title"].message;
if (lang != default_lang) {
document.getElementById('start').href = 'simulator/?' + lang;
} else {
document.getElementById('start').href = 'simulator/';
}
if (lang != default_lang) {
document.getElementById('start-old').href = 'simulator_old/?' + lang;
} else {
document.getElementById('start-old').href = 'simulator_old/';
}
for (item in locales[lang]) {
if (document.getElementById(item)) {
document.getElementById(item).innerHTML = locales[lang][item].message;
}
}
}
if (navigator.language) {
browser_lang = navigator.language;
if (browser_lang.toLowerCase() == 'zh-tw') {
default_lang = 'zh-TW';
}
if (browser_lang.toLowerCase() == 'zh-cn') {
default_lang = 'zh-CN';
}
}
setLang(default_lang);
</script>
</body>
</html>