circular-mirror 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +16 -159
- package/js/main.js +112 -103
- package/package.json +20 -4
- package/CONTRIBUTING.md +0 -66
- package/DOCUMENTATION.md +0 -164
- package/css/README.md +0 -1
- package/css/bg.png +0 -0
- package/css/bg2.png +0 -0
- package/css/caiuss.min.css +0 -4
- package/css/octicons/LICENSE.txt +0 -9
- package/css/octicons/octicons-local.ttf +0 -0
- package/css/octicons/octicons.css +0 -235
- package/css/octicons/octicons.eot +0 -0
- package/css/octicons/octicons.less +0 -233
- package/css/octicons/octicons.svg +0 -198
- package/css/octicons/octicons.ttf +0 -0
- package/css/octicons/octicons.woff +0 -0
- package/css/octicons/sprockets-octicons.scss +0 -230
- package/css/style.css +0 -16
- package/index.html +0 -46
- package/js/jquery-1.8.3.min.js +0 -9343
- package/js/jquery.min.js +0 -2628
- package/theory +0 -105
package/js/main.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
$(document).ready(function () {
|
|
4
2
|
|
|
5
3
|
// Constants
|
|
6
4
|
var ERROR_MESSAGES = {
|
|
7
|
-
NOT_SUPPORTED: "The angle is not supported yet."
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
NOT_SUPPORTED: "The angle is not supported yet."
|
|
6
|
+
, NEGATIVE_ANGLE: "The angle is negative. Put a positive one less than 90 degrees."
|
|
7
|
+
, INVALID_ANGLE: "The angle cannot be 90 degrees or greater."
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
// Globals
|
|
13
|
-
var canvas,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
yO,
|
|
24
|
-
variableInterval,
|
|
25
|
-
delay;
|
|
11
|
+
var canvas, context
|
|
12
|
+
, cWidth, cHeight
|
|
13
|
+
, lineColor = "#2980b9"
|
|
14
|
+
, r
|
|
15
|
+
, marginLeft
|
|
16
|
+
, xP, yP
|
|
17
|
+
, xO, yO
|
|
18
|
+
, variableInterval
|
|
19
|
+
, delay
|
|
20
|
+
;
|
|
26
21
|
|
|
27
22
|
// Utils
|
|
28
23
|
/**
|
|
@@ -49,12 +44,12 @@ $(document).ready(function () {
|
|
|
49
44
|
* @param {Number} timing The interval value.
|
|
50
45
|
* @return {Object} The object containing the variable interval methods.
|
|
51
46
|
*/
|
|
52
|
-
function setVariableInterval(callbackFunc, timing) {
|
|
47
|
+
function setVariableInterval (callbackFunc, timing) {
|
|
53
48
|
var variableInterval = {
|
|
54
49
|
interval: timing,
|
|
55
50
|
callback: callbackFunc,
|
|
56
51
|
stopped: false,
|
|
57
|
-
runLoop: function
|
|
52
|
+
runLoop: function() {
|
|
58
53
|
if (variableInterval.stopped) return;
|
|
59
54
|
|
|
60
55
|
var result = variableInterval.callback.call(variableInterval);
|
|
@@ -65,15 +60,15 @@ $(document).ready(function () {
|
|
|
65
60
|
|
|
66
61
|
variableInterval.loop();
|
|
67
62
|
},
|
|
68
|
-
stop: function
|
|
63
|
+
stop: function() {
|
|
69
64
|
this.stopped = true;
|
|
70
65
|
window.clearTimeout(this.timeout);
|
|
71
66
|
},
|
|
72
|
-
start: function
|
|
67
|
+
start: function() {
|
|
73
68
|
this.stopped = false;
|
|
74
69
|
return this.loop();
|
|
75
70
|
},
|
|
76
|
-
loop: function
|
|
71
|
+
loop: function() {
|
|
77
72
|
this.timeout = window.setTimeout(this.runLoop, this.interval);
|
|
78
73
|
return this;
|
|
79
74
|
}
|
|
@@ -139,7 +134,7 @@ $(document).ready(function () {
|
|
|
139
134
|
* @param {Number} toy The target `y` value.
|
|
140
135
|
* @return {undefined}
|
|
141
136
|
*/
|
|
142
|
-
function canvasArrow(context, fromx, fromy, tox, toy)
|
|
137
|
+
function canvasArrow(context, fromx, fromy, tox, toy){
|
|
143
138
|
context.beginPath();
|
|
144
139
|
var headlen = 5;
|
|
145
140
|
var angle = Math.atan2(toy - fromy, tox - fromx);
|
|
@@ -167,7 +162,7 @@ $(document).ready(function () {
|
|
|
167
162
|
context = canvas.getContext('2d');
|
|
168
163
|
|
|
169
164
|
context.save();
|
|
170
|
-
context.scale(1
|
|
165
|
+
context.scale(1,-1);
|
|
171
166
|
context.translate(300, -300);
|
|
172
167
|
|
|
173
168
|
cWidth = canvas.width;
|
|
@@ -195,6 +190,7 @@ $(document).ready(function () {
|
|
|
195
190
|
line(-200, 200, -200, -200, 2, "#c0392b");
|
|
196
191
|
}
|
|
197
192
|
|
|
193
|
+
|
|
198
194
|
/**
|
|
199
195
|
* draw
|
|
200
196
|
* Starts drawing the things.
|
|
@@ -209,9 +205,10 @@ $(document).ready(function () {
|
|
|
209
205
|
variableInterval.stop();
|
|
210
206
|
}
|
|
211
207
|
|
|
212
|
-
var angle = parseFloat($("#angleValue").val())
|
|
213
|
-
|
|
214
|
-
|
|
208
|
+
var angle = parseFloat($("#angleValue").val())
|
|
209
|
+
, err = badAngle(angle)
|
|
210
|
+
, A = null
|
|
211
|
+
;
|
|
215
212
|
|
|
216
213
|
if (err) {
|
|
217
214
|
return showError(err);
|
|
@@ -233,7 +230,7 @@ $(document).ready(function () {
|
|
|
233
230
|
|
|
234
231
|
// Another hack.
|
|
235
232
|
if (angle > 84.7) {
|
|
236
|
-
angle = 84.7
|
|
233
|
+
angle = 84.7
|
|
237
234
|
}
|
|
238
235
|
|
|
239
236
|
// Draw the lines
|
|
@@ -255,7 +252,7 @@ $(document).ready(function () {
|
|
|
255
252
|
$("#angleValue").focus();
|
|
256
253
|
|
|
257
254
|
// Keyboard shortcuts
|
|
258
|
-
$(document).on("keydown", function
|
|
255
|
+
$(document).on("keydown", function(e) {
|
|
259
256
|
|
|
260
257
|
// SHIFT ==> Draw
|
|
261
258
|
if (e.keyCode === 16) {
|
|
@@ -269,21 +266,21 @@ $(document).ready(function () {
|
|
|
269
266
|
});
|
|
270
267
|
|
|
271
268
|
// Draw
|
|
272
|
-
$("#angleValue").on("keydown", function
|
|
273
|
-
if
|
|
269
|
+
$("#angleValue").on("keydown", function(evt) {
|
|
270
|
+
if(evt.keyCode === 13) {
|
|
274
271
|
$("#drawButton").click();
|
|
275
272
|
}
|
|
276
273
|
});
|
|
277
274
|
|
|
278
275
|
// Reset button
|
|
279
|
-
$("#resetButton").on("click", function
|
|
276
|
+
$("#resetButton").on("click", function() {
|
|
280
277
|
$("#myCanvas").remove();
|
|
281
278
|
$("article .container").append("<canvas id='myCanvas' width='600' height='600'></canvas>");
|
|
282
279
|
init();
|
|
283
280
|
});
|
|
284
281
|
|
|
285
282
|
// Download button
|
|
286
|
-
$(".btn-download").on("click", function
|
|
283
|
+
$(".btn-download").on("click", function() {
|
|
287
284
|
var imageLink = canvas.toDataURL();
|
|
288
285
|
window.open(imageLink);
|
|
289
286
|
});
|
|
@@ -305,31 +302,40 @@ $(document).ready(function () {
|
|
|
305
302
|
|
|
306
303
|
angle = Math.abs(angle);
|
|
307
304
|
|
|
308
|
-
var data = [
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
305
|
+
var data = [
|
|
306
|
+
{
|
|
307
|
+
"angles": [0, 6, 10, 18, 30, 36, 40, 45, 50, 60, 70, 54],
|
|
308
|
+
"value": 20
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"angles": [2, 55, 58, 62, 63, 65],
|
|
312
|
+
"value": 100
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"angles": [3, 42, 15],
|
|
316
|
+
"value": 16
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"angles": [20, 22, 23, 29, 47, 51, 52, 57, 45.8],
|
|
320
|
+
"value": 130
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"angles": [11, 48],
|
|
324
|
+
"value": 80
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"angles": [7],
|
|
328
|
+
"value": 151
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"angles": [5, 9],
|
|
332
|
+
"value": 410
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"angles": [35, 49],
|
|
336
|
+
"value": 76
|
|
337
|
+
}
|
|
338
|
+
]
|
|
333
339
|
|
|
334
340
|
for (var i in data) {
|
|
335
341
|
if (data[i].angles.indexOf(angle) !== -1) {
|
|
@@ -411,32 +417,34 @@ $(document).ready(function () {
|
|
|
411
417
|
}
|
|
412
418
|
|
|
413
419
|
// First point
|
|
414
|
-
var xA = parseFloat(point.x)
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
420
|
+
var xA = parseFloat(point.x)
|
|
421
|
+
, yA = parseFloat(point.y)
|
|
422
|
+
, m = (yA / (200 + xA))
|
|
423
|
+
, firstP = firstPoint(m, xA, yA)
|
|
424
|
+
;
|
|
418
425
|
|
|
419
426
|
// Draw line
|
|
420
427
|
line(xA, yA, firstP.x, firstP.y, 2, lineColor);
|
|
421
428
|
|
|
422
429
|
// Update variables
|
|
423
430
|
var A = {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
431
|
+
x: xP
|
|
432
|
+
, y: yP
|
|
433
|
+
}
|
|
434
|
+
, B = firstP
|
|
435
|
+
, C = {}
|
|
436
|
+
, R = 200
|
|
437
|
+
, t = 0
|
|
438
|
+
, withTemp = 1000
|
|
439
|
+
, temp = {
|
|
440
|
+
x: A.x.toFixed(7)
|
|
441
|
+
, y: A.y.toFixed(7)
|
|
442
|
+
}
|
|
443
|
+
, pointP = JSON.stringify(temp)
|
|
444
|
+
, L = Math.sqrt(Math.pow((A.x - B.x), 2) + Math.pow((A.y - B.y), 2))
|
|
445
|
+
;
|
|
438
446
|
|
|
439
|
-
variableInterval = setVariableInterval(function
|
|
447
|
+
variableInterval = setVariableInterval(function() {
|
|
440
448
|
interval = this.interval;
|
|
441
449
|
|
|
442
450
|
// Get the next point
|
|
@@ -444,8 +452,8 @@ $(document).ready(function () {
|
|
|
444
452
|
|
|
445
453
|
// Convert to string the next point
|
|
446
454
|
temp = {
|
|
447
|
-
x: C.x
|
|
448
|
-
|
|
455
|
+
x: C.x
|
|
456
|
+
, y: C.y
|
|
449
457
|
};
|
|
450
458
|
|
|
451
459
|
var strC = JSON.stringify(temp);
|
|
@@ -464,7 +472,8 @@ $(document).ready(function () {
|
|
|
464
472
|
|
|
465
473
|
if (!drawValue.code) {
|
|
466
474
|
line(B.x, B.y, C.x, C.y, 2, lineColor);
|
|
467
|
-
}
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
468
477
|
if (drawValue.code == 1) {
|
|
469
478
|
variableInterval.stop();
|
|
470
479
|
callback(drawValue.message);
|
|
@@ -488,6 +497,7 @@ $(document).ready(function () {
|
|
|
488
497
|
t++;
|
|
489
498
|
}, delay);
|
|
490
499
|
|
|
500
|
+
|
|
491
501
|
// Point P
|
|
492
502
|
circle(xP, yP, 2, 3, '#003300');
|
|
493
503
|
}
|
|
@@ -508,23 +518,20 @@ $(document).ready(function () {
|
|
|
508
518
|
*/
|
|
509
519
|
function M(A, B, R, L) {
|
|
510
520
|
|
|
511
|
-
var xA = A.x,
|
|
512
|
-
|
|
513
|
-
var xB = B.x,
|
|
514
|
-
yB = B.y;
|
|
521
|
+
var xA = A.x, yA = A.y;
|
|
522
|
+
var xB = B.x, yB = B.y;
|
|
515
523
|
|
|
516
524
|
var Ls = Math.pow(L, 2);
|
|
517
525
|
var Rs = Math.pow(R, 2);
|
|
518
526
|
var k = 2 * Rs - Ls;
|
|
519
527
|
|
|
520
528
|
var a = 4 * Math.pow(R, 2);
|
|
521
|
-
var b = -4 * k * yB;
|
|
529
|
+
var b = - 4 * k * yB;
|
|
522
530
|
var c = Math.pow(k, 2) - Math.pow(R, 2) * 4 * Math.pow(xB, 2);
|
|
523
531
|
|
|
524
532
|
var delta = Math.pow(b, 2) - 4 * a * c;
|
|
525
533
|
|
|
526
|
-
var x = 0,
|
|
527
|
-
y = 0;
|
|
534
|
+
var x = 0, y = 0;
|
|
528
535
|
var FIXED = 20;
|
|
529
536
|
|
|
530
537
|
if (xB != 0) {
|
|
@@ -532,21 +539,23 @@ $(document).ready(function () {
|
|
|
532
539
|
x = ((k - 2 * y * yB) / (2 * xB)).toFixed(FIXED);
|
|
533
540
|
|
|
534
541
|
// TODO: Is this the best method?
|
|
535
|
-
var yR = Math.round(y * 100)
|
|
536
|
-
var xR = Math.round(x * 100)
|
|
537
|
-
var xAR = Math.round(xA * 100)
|
|
538
|
-
var yAR = Math.round(yA * 100)
|
|
542
|
+
var yR = Math.round(y * 100)/100;
|
|
543
|
+
var xR = Math.round(x * 100)/100;
|
|
544
|
+
var xAR = Math.round(xA * 100)/100;
|
|
545
|
+
var yAR = Math.round(yA * 100)/100;
|
|
539
546
|
|
|
540
547
|
if (yR == yAR && xR == xAR) {
|
|
541
548
|
y = ((-b - Math.sqrt(delta)) / (2 * a)).toFixed(FIXED);
|
|
542
549
|
x = ((k - 2 * y * yB) / (2 * xB)).toFixed(FIXED);
|
|
543
550
|
}
|
|
544
|
-
}
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
545
553
|
// TODO: There can be other cases.
|
|
546
554
|
if (round(xB, 0) == 0 && round(yB, 0) == 200) {
|
|
547
555
|
x = 200;
|
|
548
556
|
y = 0;
|
|
549
|
-
}
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
550
559
|
x = -200;
|
|
551
560
|
y = 0;
|
|
552
561
|
}
|
|
@@ -586,8 +595,8 @@ $(document).ready(function () {
|
|
|
586
595
|
var yM = m * (200 + xM);
|
|
587
596
|
|
|
588
597
|
return {
|
|
589
|
-
"x":
|
|
590
|
-
"y":
|
|
598
|
+
"x":xM,
|
|
599
|
+
"y":yM
|
|
591
600
|
};
|
|
592
601
|
}
|
|
593
602
|
|
|
@@ -602,13 +611,13 @@ $(document).ready(function () {
|
|
|
602
611
|
// 1 PI ........... 180 deg
|
|
603
612
|
// x PI ........... angle deg
|
|
604
613
|
|
|
605
|
-
var angleRad = Math.PI * angle / 180;
|
|
614
|
+
var angleRad = (Math.PI * angle) / 180;
|
|
606
615
|
var tg = Math.tan(angleRad);
|
|
607
616
|
var yA = xA * tg;
|
|
608
617
|
|
|
609
618
|
return {
|
|
610
|
-
x: xA - 200
|
|
611
|
-
|
|
619
|
+
x: xA - 200
|
|
620
|
+
, y: yA
|
|
612
621
|
};
|
|
613
622
|
}
|
|
614
623
|
|
|
@@ -627,7 +636,7 @@ $(document).ready(function () {
|
|
|
627
636
|
if (n1 || n2) {
|
|
628
637
|
return {
|
|
629
638
|
"message": "There is a NaN.",
|
|
630
|
-
"code": 1
|
|
639
|
+
"code": 1,
|
|
631
640
|
};
|
|
632
641
|
}
|
|
633
642
|
|
|
@@ -637,17 +646,17 @@ $(document).ready(function () {
|
|
|
637
646
|
if (!(sum1 <= R && sum2 <= R)) {
|
|
638
647
|
return {
|
|
639
648
|
"message": "Something is wrong. Sum1 or sum2 is higher than R^2.",
|
|
640
|
-
"code": 2
|
|
649
|
+
"code": 2,
|
|
641
650
|
};
|
|
642
651
|
}
|
|
643
652
|
|
|
644
653
|
// Default, return true
|
|
645
654
|
return {
|
|
646
|
-
"message": "That's correct. Let's draw the line!"
|
|
655
|
+
"message": "That's correct. Let's draw the line!",
|
|
647
656
|
};
|
|
648
657
|
}
|
|
649
658
|
|
|
650
659
|
init();
|
|
651
660
|
$("html").hide().fadeIn(1000);
|
|
652
661
|
handlers();
|
|
653
|
-
});
|
|
662
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "circular-mirror",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Simulates the reflections of a ray of light inside of a circular mirror.",
|
|
5
5
|
"main": "js/main.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,10 +15,26 @@
|
|
|
15
15
|
"mirror",
|
|
16
16
|
"simulation"
|
|
17
17
|
],
|
|
18
|
-
"author": "Ionică Bizău <bizauionica@gmail.com>",
|
|
18
|
+
"author": "Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/PhysicsProjects/Circular-Mirror/issues"
|
|
22
22
|
},
|
|
23
|
-
"homepage": "https://github.com/PhysicsProjects/Circular-Mirror"
|
|
24
|
-
|
|
23
|
+
"homepage": "https://github.com/PhysicsProjects/Circular-Mirror",
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/",
|
|
26
|
+
"app/",
|
|
27
|
+
"lib/",
|
|
28
|
+
"dist/",
|
|
29
|
+
"src/",
|
|
30
|
+
"scripts/",
|
|
31
|
+
"resources/",
|
|
32
|
+
"menu/",
|
|
33
|
+
"cli.js",
|
|
34
|
+
"index.js",
|
|
35
|
+
"index.d.ts",
|
|
36
|
+
"bloggify.js",
|
|
37
|
+
"bloggify.json",
|
|
38
|
+
"bloggify/"
|
|
39
|
+
]
|
|
40
|
+
}
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# :eight_spoked_asterisk: :stars: :sparkles: :dizzy: :star2: :star2: :sparkles: :dizzy: :star2: :star2: Contributing :star: :star2: :dizzy: :sparkles: :star: :star2: :dizzy: :sparkles: :stars: :eight_spoked_asterisk:
|
|
2
|
-
|
|
3
|
-
So, you want to contribute to this project! That's awesome. However, before
|
|
4
|
-
doing so, please read the following simple steps how to contribute. This will
|
|
5
|
-
make the life easier and will avoid wasting time on things which are not
|
|
6
|
-
requested. :sparkles:
|
|
7
|
-
|
|
8
|
-
## Discuss the changes before doing them
|
|
9
|
-
- First of all, open an issue in the repository, using the [bug tracker][1],
|
|
10
|
-
describing the contribution you would like to make, the bug you found or any
|
|
11
|
-
other ideas you have. This will help us to get you started on the right
|
|
12
|
-
foot.
|
|
13
|
-
|
|
14
|
-
- If it makes sense, add the platform and software information (e.g. operating
|
|
15
|
-
system, Node.JS version etc.), screenshots (so we can see what you are
|
|
16
|
-
seeing).
|
|
17
|
-
|
|
18
|
-
- It is recommended to wait for feedback before continuing to next steps.
|
|
19
|
-
However, if the issue is clear (e.g. a typo) and the fix is simple, you can
|
|
20
|
-
continue and fix it.
|
|
21
|
-
|
|
22
|
-
## Fixing issues
|
|
23
|
-
- Fork the project in your account and create a branch with your fix:
|
|
24
|
-
`some-great-feature` or `some-issue-fix`.
|
|
25
|
-
|
|
26
|
-
- Commit your changes in that branch, writing the code following the
|
|
27
|
-
[code style][2]. If the project contains tests (generally, the `test`
|
|
28
|
-
directory), you are encouraged to add a test as well. :memo:
|
|
29
|
-
|
|
30
|
-
- If the project contains a `package.json` or a `bower.json` file add yourself
|
|
31
|
-
in the `contributors` array (or `authors` in the case of `bower.json`;
|
|
32
|
-
if the array does not exist, create it):
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"contributors": [
|
|
37
|
-
"Your Name <and@email.address> (http://your.website)"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Creating a pull request
|
|
43
|
-
|
|
44
|
-
- Open a pull request, and reference the initial issue in the pull request
|
|
45
|
-
message (e.g. *fixes #<your-issue-number>*). Write a good description and
|
|
46
|
-
title, so everybody will know what is fixed/improved.
|
|
47
|
-
|
|
48
|
-
- If it makes sense, add screenshots, gifs etc., so it is easier to see what
|
|
49
|
-
is going on.
|
|
50
|
-
|
|
51
|
-
## Wait for feedback
|
|
52
|
-
Before accepting your contributions, we will review them. You may get feedback
|
|
53
|
-
about what should be fixed in your modified code. If so, just keep committing
|
|
54
|
-
in your branch and the pull request will be updated automatically.
|
|
55
|
-
|
|
56
|
-
## Everyone is happy!
|
|
57
|
-
Finally, your contributions will be merged, and everyone will be happy! :smile:
|
|
58
|
-
Contributions are more than welcome!
|
|
59
|
-
|
|
60
|
-
Thanks! :sweat_smile:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
[1]: https://github.com/PhysicsProjects/Circular-Mirror/issues
|
|
65
|
-
|
|
66
|
-
[2]: https://github.com/IonicaBizau/code-style
|
package/DOCUMENTATION.md
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
## Documentation
|
|
2
|
-
|
|
3
|
-
You can see below the API reference of this module.
|
|
4
|
-
|
|
5
|
-
### `round(num, decimals)`
|
|
6
|
-
Rounds a number.
|
|
7
|
-
|
|
8
|
-
#### Params
|
|
9
|
-
|
|
10
|
-
- **Number** `num`: The input number.
|
|
11
|
-
- **Number** `decimals`: How many decimals.
|
|
12
|
-
|
|
13
|
-
#### Return
|
|
14
|
-
- **Number** The rounded number.
|
|
15
|
-
|
|
16
|
-
### `setVariableInterval(callbackFunc, timing)`
|
|
17
|
-
Sets a variable interval.
|
|
18
|
-
|
|
19
|
-
#### Params
|
|
20
|
-
|
|
21
|
-
- **Function** `callbackFunc`: The callback function.
|
|
22
|
-
- **Number** `timing`: The interval value.
|
|
23
|
-
|
|
24
|
-
#### Return
|
|
25
|
-
- **Object** The object containing the variable interval methods.
|
|
26
|
-
|
|
27
|
-
### `circle(x, y, r, w, color)`
|
|
28
|
-
Draws a circle on the canvas.
|
|
29
|
-
|
|
30
|
-
#### Params
|
|
31
|
-
|
|
32
|
-
- **Number** `x`: The x value.
|
|
33
|
-
- **Number** `y`: The y value.
|
|
34
|
-
- **Number** `r`: The radius value.
|
|
35
|
-
- **Number** `w`: The line width.
|
|
36
|
-
- **String** `color`: The color.
|
|
37
|
-
|
|
38
|
-
#### Return
|
|
39
|
-
- ****
|
|
40
|
-
|
|
41
|
-
### `line(x1, y1, x2, y2, w, color)`
|
|
42
|
-
Draws a line on the canvas.
|
|
43
|
-
|
|
44
|
-
#### Params
|
|
45
|
-
|
|
46
|
-
- **Number** `x1`: The source `x` value.
|
|
47
|
-
- **Number** `y1`: The source `y` value.
|
|
48
|
-
- **Number** `x2`: The target `x` value.
|
|
49
|
-
- **Number** `y2`: The target `y` value.
|
|
50
|
-
- **Number** `w`: The line width.
|
|
51
|
-
- **String** `color`: The color.
|
|
52
|
-
|
|
53
|
-
#### Return
|
|
54
|
-
- ****
|
|
55
|
-
|
|
56
|
-
### `canvasArrow(context, fromx, fromy, tox, toy)`
|
|
57
|
-
Draws an arrow on the canvas.
|
|
58
|
-
|
|
59
|
-
#### Params
|
|
60
|
-
|
|
61
|
-
- **Object** `context`: The canvas context.
|
|
62
|
-
- **Number** `fromx`: The source `x` value.
|
|
63
|
-
- **Number** `fromy`: The source `y` value.
|
|
64
|
-
- **Number** `tox`: The target `x` value.
|
|
65
|
-
- **Number** `toy`: The target `y` value.
|
|
66
|
-
|
|
67
|
-
#### Return
|
|
68
|
-
- ****
|
|
69
|
-
|
|
70
|
-
### `init()`
|
|
71
|
-
This function is called to reinit the canvas.
|
|
72
|
-
|
|
73
|
-
#### Return
|
|
74
|
-
- ****
|
|
75
|
-
|
|
76
|
-
### `draw()`
|
|
77
|
-
Starts drawing the things.
|
|
78
|
-
|
|
79
|
-
#### Return
|
|
80
|
-
- ****
|
|
81
|
-
|
|
82
|
-
### `handlers()`
|
|
83
|
-
This function appends the DOM handlers.
|
|
84
|
-
|
|
85
|
-
#### Return
|
|
86
|
-
- ****
|
|
87
|
-
|
|
88
|
-
### `getLimit(angle)`
|
|
89
|
-
This is a **hack**. This roundes the angle in a format that is supported by the application.
|
|
90
|
-
|
|
91
|
-
#### Params
|
|
92
|
-
|
|
93
|
-
- **Number** `angle`: The angle that should be rounded.
|
|
94
|
-
|
|
95
|
-
#### Return
|
|
96
|
-
- **Number** A rounded angle that is supported by the application.
|
|
97
|
-
|
|
98
|
-
### `badAngle(angle)`
|
|
99
|
-
Checks if the angle is supported.
|
|
100
|
-
|
|
101
|
-
#### Params
|
|
102
|
-
|
|
103
|
-
- **Number** `angle`: The angle that should be checked.
|
|
104
|
-
|
|
105
|
-
#### Return
|
|
106
|
-
- **String** An error (string) or `null`.
|
|
107
|
-
|
|
108
|
-
### `showError(message)`
|
|
109
|
-
Shows an error message.
|
|
110
|
-
|
|
111
|
-
#### Params
|
|
112
|
-
|
|
113
|
-
- **String** `message`: The error message.
|
|
114
|
-
|
|
115
|
-
#### Return
|
|
116
|
-
- ****
|
|
117
|
-
|
|
118
|
-
### `start(point, callback)`
|
|
119
|
-
Draws the lines on the canvas.
|
|
120
|
-
|
|
121
|
-
#### Params
|
|
122
|
-
|
|
123
|
-
- **Point** `point`: The current point.
|
|
124
|
-
- **Function** `callback`: The callback function.
|
|
125
|
-
|
|
126
|
-
#### Return
|
|
127
|
-
- ****
|
|
128
|
-
|
|
129
|
-
### `M(A:, B:, R:, L:)`
|
|
130
|
-
THE MOST IMPORTANT FUNCTION.
|
|
131
|
-
It always returns the next point.
|
|
132
|
-
------------
|
|
133
|
-
(xM(n - 1), yM(n - 1)) ---> |? ? ?|
|
|
134
|
-
(xM(n), yM(n)) ---> | M | ---> (xM(n + 1), yM(n + 1))
|
|
135
|
-
Radius ---> |? ? ?|
|
|
136
|
-
Length of segments ---> ------------
|
|
137
|
-
|
|
138
|
-
#### Params
|
|
139
|
-
|
|
140
|
-
- **Object** `A:`: first point
|
|
141
|
-
- **Object** `B:`: second point
|
|
142
|
-
- **Object** `R:`: radius of big circle
|
|
143
|
-
- **Object** `L:`: length of segments
|
|
144
|
-
|
|
145
|
-
### `firstPoint(m, x1, y1)`
|
|
146
|
-
The function that returns ONLY the first point.
|
|
147
|
-
|
|
148
|
-
#### Params
|
|
149
|
-
|
|
150
|
-
- **Object** `m`:
|
|
151
|
-
- **Object** `x1`:
|
|
152
|
-
- **Object** `y1`:
|
|
153
|
-
|
|
154
|
-
### `getA()`
|
|
155
|
-
Function that returns a point giving the angle
|
|
156
|
-
|------|
|
|
157
|
-
xA ----> | |===> (xA, yA)
|
|
158
|
-
angle (deg) ----> | |
|
|
159
|
-
|------|
|
|
160
|
-
|
|
161
|
-
### `check()`
|
|
162
|
-
Verify if the numbers are correct.
|
|
163
|
-
If not, return an false value.
|
|
164
|
-
|
package/css/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
If you intend to install Octicons locally, install `octicons-local.ttf`. It should appear as “github-octicons” in your font list. It is specially designed not to conflict with GitHub's web fonts.
|
package/css/bg.png
DELETED
|
Binary file
|
package/css/bg2.png
DELETED
|
Binary file
|