jsxgraph 1.14.0 → 1.14.1

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +33 -3
  2. package/distrib/docs/3d_linspace3d.js.html +16 -10
  3. package/distrib/docs/3d_point3d.js.html +0 -5
  4. package/distrib/docs/3d_sphere3d.js.html +92 -69
  5. package/distrib/docs/3d_view3d.js.html +24 -16
  6. package/distrib/docs/Angle.html +7 -7
  7. package/distrib/docs/CircumcircleSector.html +2 -2
  8. package/distrib/docs/Conic.html +1 -1
  9. package/distrib/docs/Ellipse.html +23 -1
  10. package/distrib/docs/Hyperbola.html +24 -1
  11. package/distrib/docs/JXG.Board.infobox.html +1 -1
  12. package/distrib/docs/JXG.Board_.html +130 -130
  13. package/distrib/docs/JXG.CanvasRenderer.html +10 -10
  14. package/distrib/docs/JXG.Composition.html +3 -3
  15. package/distrib/docs/JXG.GeometryElement.html +26 -26
  16. package/distrib/docs/JXG.Math.Numerics.html +45 -47
  17. package/distrib/docs/JXG.Math.Statistics.html +14 -15
  18. package/distrib/docs/JXG.Math.Tiling.html +3 -7
  19. package/distrib/docs/JXG.Math.html +101 -83
  20. package/distrib/docs/JXG.Point3D.html +2 -2
  21. package/distrib/docs/JXG.SVGRenderer.html +12 -12
  22. package/distrib/docs/JXG.Sphere3D.html +1255 -2
  23. package/distrib/docs/JXG.View3D.html +29 -29
  24. package/distrib/docs/JXG.html +20 -20
  25. package/distrib/docs/MajorSector.html +1 -1
  26. package/distrib/docs/MinorSector.html +1 -1
  27. package/distrib/docs/NonReflexAngle.html +1 -1
  28. package/distrib/docs/Parabola.html +1 -1
  29. package/distrib/docs/Point3D.html +1 -1
  30. package/distrib/docs/ReflexAngle.html +1 -1
  31. package/distrib/docs/Sector.html +12 -12
  32. package/distrib/docs/Sphere3D.html +17 -1
  33. package/distrib/docs/View3D.html +1 -1
  34. package/distrib/docs/base_board.js.html +63 -13
  35. package/distrib/docs/base_composition.js.html +3 -3
  36. package/distrib/docs/base_constants.js.html +1 -1
  37. package/distrib/docs/base_element.js.html +2 -1
  38. package/distrib/docs/base_text.js.html +2 -2
  39. package/distrib/docs/element_conic.js.html +35 -1
  40. package/distrib/docs/element_sector.js.html +6 -3
  41. package/distrib/docs/index.html +1 -1
  42. package/distrib/docs/math_math.js.html +64 -35
  43. package/distrib/docs/math_numerics.js.html +13 -12
  44. package/distrib/docs/math_statistics.js.html +19 -19
  45. package/distrib/docs/math_tiling.js.html +6 -288
  46. package/distrib/docs/parser_jessiecode.js.html +1 -1
  47. package/distrib/docs/renderer_canvas.js.html +7 -6
  48. package/distrib/docs/renderer_svg.js.html +15 -7
  49. package/distrib/docs/scripts/jsxgraphcore.js +2 -2
  50. package/distrib/docs/styles/jsxgraph.css +1 -1
  51. package/distrib/docs/utils_type.js.html +11 -4
  52. package/distrib/geogebra.min.js +1 -1
  53. package/distrib/geonext.min.js +1 -1
  54. package/distrib/index.d.ts +11 -0
  55. package/distrib/intergeo.min.js +1 -1
  56. package/distrib/jsxgraph.css +1 -1
  57. package/distrib/jsxgraphcore.js +2 -2
  58. package/distrib/jsxgraphcore.mjs +2 -2
  59. package/distrib/jsxgraphcore.mjs.map +1 -1
  60. package/distrib/jsxgraphsrc.js +380 -496
  61. package/distrib/jsxgraphsrc.mjs +380 -496
  62. package/distrib/jsxgraphsrc.mjs.map +1 -1
  63. package/package.json +10 -12
  64. package/src/3d/linspace3d.js +16 -10
  65. package/src/3d/point3d.js +0 -5
  66. package/src/3d/sphere3d.js +92 -69
  67. package/src/3d/view3d.js +24 -16
  68. package/src/base/board.js +63 -13
  69. package/src/base/composition.js +3 -3
  70. package/src/base/constants.js +1 -1
  71. package/src/base/element.js +2 -1
  72. package/src/base/text.js +2 -2
  73. package/src/element/conic.js +35 -1
  74. package/src/element/sector.js +6 -3
  75. package/src/index.d.ts +11 -0
  76. package/src/math/math.js +64 -35
  77. package/src/math/numerics.js +13 -12
  78. package/src/math/statistics.js +19 -19
  79. package/src/math/tiling.js +6 -288
  80. package/src/parser/jessiecode.js +1 -1
  81. package/src/renderer/canvas.js +7 -6
  82. package/src/renderer/svg.js +15 -7
  83. package/src/utils/type.js +11 -4
  84. package/src/unused/bst.js +0 -475
  85. package/src/unused/heap.js +0 -135
  86. package/src/unused/locus.js +0 -162
  87. package/src/unused/server/JXG.py +0 -74
  88. package/src/unused/server/JXGServer.py +0 -94
  89. package/src/unused/server/JXGServerModule.py +0 -9
  90. package/src/unused/server/README.md +0 -63
  91. package/src/unused/server/RStats.py +0 -45
  92. package/src/unused/server/YahooFinance.py +0 -81
  93. package/src/unused/server/fft.py +0 -136
  94. package/src/unused/server/geoloci.py +0 -210
  95. package/src/unused/server/jxggroebner.py +0 -219
  96. package/src/unused/server/jxgtestplugin.py +0 -19
  97. package/src/unused/server/server.js +0 -280
  98. package/src/unused/sketch.js +0 -2895
  99. package/src/unused/symbolic.js +0 -416
@@ -704,12 +704,12 @@ Mat.Statistics = {
704
704
  * The Theil-Sen estimator can be used to determine a more robust linear regression of a set of sample
705
705
  * points than least squares regression in {@link JXG.Math.Numerics.regressionPolynomial}.
706
706
  *
707
- * If the function should be applied to an array a of points, a the coords array can be generated with
708
- * JavaScript array.map:
707
+ * If the function should be applied to an array `a` of *points*, a coords array can be generated with
708
+ * JavaScript `array.map`:
709
709
  *
710
- * <pre>
710
+ * ```
711
711
  * JXG.Math.Statistics.TheilSenRegression(a.map(el => el.coords));
712
- * </pre>
712
+ * ```
713
713
  *
714
714
  * @param {Array} coords Array of {@link JXG.Coords}.
715
715
  * @returns {Array} A stdform array of the regression line.
@@ -717,10 +717,10 @@ Mat.Statistics = {
717
717
  *
718
718
  * @example
719
719
  * var board = JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-6,6,6,-6], axis : true });
720
- * var a=[];
721
- * a[0]=board.create('point', [0,0]);
722
- * a[1]=board.create('point', [3,0]);
723
- * a[2]=board.create('point', [0,3]);
720
+ * var a = [];
721
+ * a[0] = board.create('point', [0, 0]);
722
+ * a[1] = board.create('point', [3, 0]);
723
+ * a[2] = board.create('point', [0, 3]);
724
724
  *
725
725
  * board.create('line', [
726
726
  * () => JXG.Math.Statistics.TheilSenRegression(a.map(el => el.coords))
@@ -774,7 +774,7 @@ Mat.Statistics = {
774
774
 
775
775
  /**
776
776
  * Generate values of a standard normal random variable with the Marsaglia polar method, see
777
- * <a href="https://en.wikipedia.org/wiki/Marsaglia_polar_method">https://en.wikipedia.org/wiki/Marsaglia_polar_method</a>.
777
+ * {@link https://en.wikipedia.org/wiki/Marsaglia_polar_method}..
778
778
  * See also D. E. Knuth, The art of computer programming, vol 2, p. 117.
779
779
  *
780
780
  * @param {Number} mean mean value of the normal distribution
@@ -864,7 +864,7 @@ Mat.Statistics = {
864
864
  },
865
865
 
866
866
  /**
867
- * Generate value of a uniform distributed random variable in the interval [a, b].
867
+ * Generate value of a uniform distributed random variable in the interval `[a, b]`.
868
868
  * @param {Number} a
869
869
  * @param {Number} b
870
870
  * @returns Number
@@ -876,7 +876,7 @@ Mat.Statistics = {
876
876
 
877
877
  /**
878
878
  * Generate value of a random variable with exponential distribution, i.e.
879
- * \\(f(x; \lambda) = \lambda * e^(-\lambda x)\\) if \\(x \geq 0\\) and \\(f(x; \lambda) = 0\\) if \\(x < 0\\).
879
+ * \\(f(x; \lambda) = \lambda \cdot e^{-\lambda x}\\) if \\(x \geq 0\\) and \\(f(x; \lambda) = 0\\) if \\(x < 0\\).
880
880
  * See <a href="https://en.wikipedia.org/wiki/Exponential_distribution">https://en.wikipedia.org/wiki/Exponential_distribution</a>.
881
881
  * Algorithm: D.E. Knuth, TAOCP 2, p. 128.
882
882
  *
@@ -945,7 +945,7 @@ Mat.Statistics = {
945
945
 
946
946
  /**
947
947
  * Generate value of a random variable with gamma distribution of order alpha.
948
- * See <a href="https://en.wikipedia.org/wiki/Gamma_distribution">https://en.wikipedia.org/wiki/Gamma_distribution</a>.
948
+ * See {@link https://en.wikipedia.org/wiki/Gamma_distribution}.
949
949
  * Algorithm: D.E. Knuth, TAOCP 2, p. 129.
950
950
 
951
951
  * @param {Number} a shape, \\( > 0\\)
@@ -1061,7 +1061,7 @@ Mat.Statistics = {
1061
1061
 
1062
1062
  /**
1063
1063
  * Generate value of a random variable with beta distribution with shape parameters alpha and beta.
1064
- * See <a href="https://en.wikipedia.org/wiki/Beta_distribution">https://en.wikipedia.org/wiki/Beta_distribution</a>.
1064
+ * See {@link https://en.wikipedia.org/wiki/Beta_distribution}.
1065
1065
  *
1066
1066
  * @param {Number} alpha \\(< 0\\)
1067
1067
  * @param {Number} beta \\(< 0\\)
@@ -1084,7 +1084,7 @@ Mat.Statistics = {
1084
1084
 
1085
1085
  /**
1086
1086
  * Generate value of a random variable with chi-square distribution with k degrees of freedom.
1087
- * See <a href="https://en.wikipedia.org/wiki/Chi-squared_distribution">https://en.wikipedia.org/wiki/Chi-squared_distribution</a>.
1087
+ * See {@link https://en.wikipedia.org/wiki/Chi-squared_distribution}.
1088
1088
  *
1089
1089
  * @param {Number} k \\(>0\\)
1090
1090
  * @returns Number
@@ -1102,7 +1102,7 @@ Mat.Statistics = {
1102
1102
 
1103
1103
  /**
1104
1104
  * Generate value of a random variable with F-distribution with d<sub>1</sub> and d<sub>2</sub> degrees of freedom.
1105
- * See <a href="https://en.wikipedia.org/wiki/F-distribution">https://en.wikipedia.org/wiki/F-distribution</a>.
1105
+ * See {@link https://en.wikipedia.org/wiki/F-distribution}.
1106
1106
  * @param {Number} d1 \\(>0\\)
1107
1107
  * @param {Number} d2 \\(>0\\)
1108
1108
  * @returns Number
@@ -1124,7 +1124,7 @@ Mat.Statistics = {
1124
1124
 
1125
1125
  /**
1126
1126
  * Generate value of a random variable with Students-t-distribution with ν degrees of freedom.
1127
- * See <a href="https://en.wikipedia.org/wiki/Student%27s_t-distribution">https://en.wikipedia.org/wiki/Student%27s_t-distribution</a>.
1127
+ * See {@link https://en.wikipedia.org/wiki/Student%27s_t-distribution}.
1128
1128
  * @param {Number} nu \\(>0\\)
1129
1129
  * @returns Number
1130
1130
  * @memberof JXG.Math.Statistics
@@ -1145,8 +1145,8 @@ Mat.Statistics = {
1145
1145
 
1146
1146
  /**
1147
1147
  * Generate values for a random variable in binomial distribution with parameters \\(n\\) and \\(p\\).
1148
- * See <a href="https://en.wikipedia.org/wiki/Binomial_distribution">https://en.wikipedia.org/wiki/Binomial_distribution</a>.
1149
- * It uses algorithm BG from <a href="https://dl.acm.org/doi/pdf/10.1145/42372.42381">https://dl.acm.org/doi/pdf/10.1145/42372.42381</a>.
1148
+ * See {@link https://en.wikipedia.org/wiki/Binomial_distribution}.
1149
+ * It uses algorithm BG from {@link https://dl.acm.org/doi/pdf/10.1145/42372.42381}.
1150
1150
  *
1151
1151
  * @param {Number} n Number of trials (n >= 0)
1152
1152
  * @param {Number} p Probability (0 <= p <= 1)
@@ -1270,7 +1270,7 @@ Mat.Statistics = {
1270
1270
 
1271
1271
  /**
1272
1272
  * Generate values for a random variable in geometric distribution with probability \\(p\\).
1273
- * See <a href="https://en.wikipedia.org/wiki/Geometric_distribution">https://en.wikipedia.org/wiki/Geometric_distribution</a>.
1273
+ * See {@link https://en.wikipedia.org/wiki/Geometric_distribution}.
1274
1274
  *
1275
1275
  * @param {Number} p (0 <= p <= 1)
1276
1276
  * @returns Number
@@ -131,11 +131,11 @@ import Mat from "./math.js";
131
131
  Mat.Tiling = {
132
132
  /**
133
133
  * Triangulate (partition it into triangles) a given two dimensional domain.
134
- * The number of triangles the original rectangle is divided into depends on the parameters stepsU and stepsV.
135
- * Input are the ranges of u and v, as well as stepsU and stepsV which are static.
136
- * If the optional parameter stepsV is not given or is equal to 0, the rectangle is partitioned into
134
+ * The number of triangles the original rectangle is divided into depends on the parameters` `stepsU` and `stepsV`.
135
+ * Input are the ranges of \\(u\\) and \\(v\\), as well as `stepsU` and `stepsV` which are static.
136
+ * If the optional parameter `stepsV` is not given or is equal to 0, the rectangle is partitioned into
137
137
  * nearly equilateral triangles.
138
- * Otherwise, the shape of the triangles depends on the ratio of stepsU / stepsV.
138
+ * Otherwise, the shape of the triangles depends on the ratio of `stepsU / stepsV`.
139
139
  *
140
140
  * @param {JXG.ParametricSurface3D|JXG.Plane3D} el element which is displayed using a polyhedron3d.
141
141
  * From this element its function F is used.
@@ -291,8 +291,8 @@ Mat.Tiling = {
291
291
 
292
292
  /**
293
293
  * Rectangulate (partition it into rectangles) a given two dimensional domain.
294
- * The number of rectangles the original rectangle is divided into depends on the parameters stepsU and stepsV.
295
- * Input are the ranges of u and v, as well as stepsU and stepsV which are static.
294
+ * The number of rectangles the original rectangle is divided into depends on the parameters `stepsU` and `stepsV`.
295
+ * Input are the ranges of \\(u\\) and \\(v\\), as well as `stepsU` and `stepsV` which are static.
296
296
  *
297
297
  * @param {JXG.ParametricSurface3D|JXG.Plane3D} el element which is displayed using a polyhedron3d.
298
298
  * From this element its function F is used.
@@ -416,288 +416,6 @@ Mat.Tiling = {
416
416
  }
417
417
  return [vertices, faces];
418
418
  }
419
-
420
- // triangulation_old: function (p1, p2, p3, p4, stepsU, stepsV) {
421
- // // Vectors used for checking if the given coordinates create a rectangle
422
- // var vec1 = [p2[0] - p1[0], p2[1] - p1[1]],
423
- // vec2 = [p3[0] - p2[0], p3[1] - p2[1]],
424
- // vec3 = [p4[0] - p3[0], p4[1] - p3[1]],
425
- // vec4 = [p1[0] - p4[0], p1[1] - p4[1]],
426
-
427
- // coords = [],
428
- // faces = [],
429
- // width, height,
430
- // wSide, hSide,
431
- // triangleWidth, triangleHeight,
432
- // s1, s2,
433
- // i, j,
434
- // numRows,
435
- // widthX, widthY, heightX, heightY,
436
- // oddPoints,
437
- // evenPoints;
438
-
439
- // // Check if the given coordinates create a rectangle, otherwise an exception is thrown
440
- // if (
441
- // vec1[0] * vec4[0] + vec1[1] * vec4[1] !== 0 ||
442
- // vec2[0] * vec1[0] + vec2[1] * vec1[1] !== 0 ||
443
- // vec3[0] * vec2[0] + vec3[1] * vec2[1] !== 0 ||
444
- // vec4[0] * vec3[0] + vec4[1] * vec3[1] !== 0
445
- // ) {
446
- // throw new Error(" the board created is not rectangle ");
447
- // }
448
-
449
- // // Set initial values for wSide, hSide
450
- // wSide = [0, 0];
451
- // hSide = [0, 0];
452
-
453
- // // Check for longer side of rectangle:
454
- // // longer side is appointed height, shorter side is appointed width
455
- // s1 = Math.sqrt((p2[0] - p1[0]) * (p2[0] - p1[0]) + (p2[1] - p1[1]) * (p2[1] - p1[1]));
456
- // s2 = Math.sqrt((p3[0] - p2[0]) * (p3[0] - p2[0]) + (p3[1] - p2[1]) * (p3[1] - p2[1]));
457
- // if (s1 <= s2) {
458
- // width = s1;
459
- // height = s2;
460
- // // Determine start and end points of the width-side and height-side
461
- // wSide = [p1, p2];
462
- // hSide = [p2, p3];
463
- // } else {
464
- // width = s2;
465
- // height = s1;
466
- // // Determine start and end points of the width-side and height-side
467
- // wSide = [p2, p3];
468
- // hSide = [p1, p2];
469
- // }
470
- // // Calculate height and width of the triangles and number of rows
471
- // triangleWidth = width / stepsU;
472
-
473
- // if (stepsV === undefined || stepsV === 0) {
474
- // // Equilateral triangles, depending on parameter "stepsU"
475
- // triangleHeight = (triangleWidth * Math.sqrt(3)) / 2;
476
- // numRows = Math.round(height / triangleHeight);
477
- // } else {
478
- // // Two parameters stepsU, stepsV
479
- // numRows = stepsV;
480
- // triangleHeight = height / numRows;
481
- // }
482
-
483
- // // Calculate values of "shifting vectors"
484
- // widthX = (wSide[1][0] - wSide[0][0]) / stepsU;
485
- // widthY = (wSide[1][1] - wSide[0][1]) / stepsU;
486
- // heightX = (hSide[1][0] - hSide[0][0]) / numRows;
487
- // heightY = (hSide[1][1] - hSide[0][1]) / numRows;
488
-
489
- // oddPoints = [];
490
- // evenPoints = [];
491
-
492
- // // Push coordinates of the base point (p1)
493
- // coords.push([p1[0], p1[1]]);
494
- // evenPoints.push(coords.length - 1);
495
-
496
- // // Calculate point coordinates of layer 0 and store indices in evenPoints
497
- // for (i = 1; i <= stepsU; i++) {
498
- // coords.push([p1[0] + i * widthX, p1[1] + i * widthY]); // Points first line
499
- // evenPoints.push(coords.length - 1);
500
- // }
501
-
502
- // for (i = 1; i <= numRows; i++) {
503
- // if (i % 2 === 0) {
504
- // // Points and faces of layers with an even index
505
-
506
- // evenPoints = [];
507
- // // Calculate first point coordinates within the layer
508
- // coords.push([
509
- // p1[0] + i * heightX,
510
- // p1[1] + i * heightY
511
- // ]);
512
- // // evenPoints stores index of the first point of the layer
513
- // evenPoints.push(coords.length - 1);
514
- // // Calculate all other point coordinates within the layer
515
- // for (j = 1; j <= stepsU; j++) {
516
- // coords.push([
517
- // coords[evenPoints[0]][0] + j * widthX,
518
- // coords[evenPoints[0]][1] + j * widthY
519
- // ]);
520
- // //evenPoints stores index of the most recently calculated point of the layer
521
- // evenPoints.push(coords.length - 1);
522
- // }
523
- // // Connect the faces of the row by grouping indices of points
524
- // faces.push([evenPoints[0], oddPoints[0], oddPoints[1]]);
525
- // for (j = 1; j <= stepsU; j++) {
526
- // faces.push([evenPoints[j - 1], oddPoints[j], evenPoints[j]]);
527
- // faces.push([evenPoints[j], oddPoints[j], oddPoints[j + 1]]);
528
- // }
529
- // } else {
530
- // // Points and faces of layers with an odd index
531
-
532
- // oddPoints = [];
533
- // // Calculate first point coordinates within the layer
534
- // coords.push([
535
- // p1[0] + i * heightX,
536
- // p1[1] + i * heightY
537
- // ]);
538
- // // oddPoints stores index of the first point of the layer
539
- // oddPoints.push(coords.length - 1);
540
- // // Calculate all other point coordinates within the layer except for the last point
541
- // for (j = 1; j <= stepsU; j++) {
542
- // coords.push([
543
- // coords[oddPoints[0]][0] + j * widthX - widthX / 2,
544
- // coords[oddPoints[0]][1] + j * widthY - widthY / 2
545
- // ]);
546
- // // oddPoints stores index of the most recently calculated point of the layer
547
- // oddPoints.push(coords.length - 1);
548
- // }
549
- // // Calculate last point coordinates within the layer
550
- // coords.push([
551
- // coords[oddPoints[0]][0] + stepsU * widthX,
552
- // coords[oddPoints[0]][1] + stepsU * widthY
553
- // ]);
554
- // // oddPoints stores index of last point within the layer
555
- // oddPoints.push(coords.length - 1);
556
- // // Connect the faces of the row by grouping indices of points
557
- // faces.push([oddPoints[0], evenPoints[0], oddPoints[1]]);
558
- // for (j = 1; j <= stepsU; j++) {
559
- // faces.push([oddPoints[j], evenPoints[j - 1], evenPoints[j]]);
560
- // faces.push([oddPoints[j], evenPoints[j], oddPoints[j + 1]]);
561
- // }
562
- // }
563
- // }
564
-
565
- // return [coords, faces];
566
- // },
567
-
568
- // rectangulation_old: function (p1, p2, p3, p4, stepsU, stepsV) {
569
- // // Vectors used for checking if the given coordinates create a rectangle
570
- // var vec1 = [p2[0] - p1[0], p2[1] - p1[1]],
571
- // vec2 = [p3[0] - p2[0], p3[1] - p2[1]],
572
- // vec3 = [p4[0] - p3[0], p4[1] - p3[1]],
573
- // vec4 = [p1[0] - p4[0], p1[1] - p4[1]],
574
-
575
- // coords = [],
576
- // faces = [],
577
- // wSide, hSide,
578
- // s1, s2,
579
- // i, j,
580
- // widthX, widthY,
581
- // heightX, heightY,
582
- // startPointLayer;
583
-
584
- // // Check if the given coordinates create a rectangle, otherwise an exception is thrown
585
- // if (
586
- // vec1[0] * vec4[0] + vec1[1] * vec4[1] !== 0 ||
587
- // vec2[0] * vec1[0] + vec2[1] * vec1[1] !== 0 ||
588
- // vec3[0] * vec2[0] + vec3[1] * vec2[1] !== 0 ||
589
- // vec4[0] * vec3[0] + vec4[1] * vec3[1] !== 0
590
- // ) {
591
- // throw new Error("rectangulation_old: area is not rectangle ");
592
- // // console.log("rectangulation_old: area is not rectangle ");
593
- // }
594
-
595
- // // Set initial values for wSide, hSide
596
- // wSide = [0, 0];
597
- // hSide = [0, 0];
598
-
599
- // // Check for longer side of rectangle:
600
- // // longer side is appointed height, shorter side is appointed width
601
- // // s1 = Math.sqrt((p2[0] - p1[0]) * (p2[0] - p1[0]) + (p2[1] - p1[1]) * (p2[1] - p1[1]));
602
- // // s2 = Math.sqrt((p3[0] - p2[0]) * (p3[0] - p2[0]) + (p3[1] - p2[1]) * (p3[1] - p2[1]));
603
- // s1 = Mat.hypot(vec1[0], vec1[1]);
604
- // s2 = Mat.hypot(vec2[0], vec2[1]);
605
-
606
- // if (s1 <= s2) {
607
- // // Determine start and end points of the width-side and height-side
608
- // wSide = [p1, p2];
609
- // hSide = [p2, p3];
610
- // } else {
611
- // // Determine start and end points of the width-side and height-side
612
- // wSide = [p2, p3];
613
- // hSide = [p1, p2];
614
- // }
615
-
616
- // // Calculate values of "shifting vectors"
617
- // widthX = (wSide[1][0] - wSide[0][0]) / stepsV;
618
- // widthY = (wSide[1][1] - wSide[0][1]) / stepsV;
619
- // heightX = (hSide[1][0] - hSide[0][0]) / stepsU;
620
- // heightY = (hSide[1][1] - hSide[0][1]) / stepsU;
621
-
622
- // // Initialize startPointLayer that stores coordinates of the first point of the current layer
623
- // startPointLayer = [];
624
-
625
- // // Push coordinates of base point (p1)
626
- // coords.push([p1[0], p1[1]]);
627
- // startPointLayer = coords[0];
628
-
629
- // // Calculate point coordinates of layer 0
630
- // for (j = 1; j <= stepsV; j++) {
631
- // coords.push([startPointLayer[0] + j * widthX, startPointLayer[1] + j * widthY]);
632
- // }
633
-
634
- // for (i = 1; i <= stepsU; i++) {
635
- // startPointLayer = [];
636
-
637
- // // Calculate point coordinates of first point of layer
638
- // coords.push([
639
- // p1[0] + i * heightX,
640
- // p1[1] + i * heightY
641
- // ]);
642
- // startPointLayer = coords[coords.length - 1];
643
-
644
- // // Calculating remaining point coordinates of layer
645
- // for (j = 1; j <= stepsV; j++) {
646
- // coords.push([
647
- // startPointLayer[0] + j * widthX,
648
- // startPointLayer[1] + j * widthY
649
- // ]);
650
- // }
651
-
652
- // // Connect rectangles by grouping indices of points
653
- // for (
654
- // j = coords.length - stepsV - 1;
655
- // j < coords.length - 1;
656
- // j++
657
- // ) {
658
- // faces.push([j, j - stepsV - 1, j - stepsV, j + 1]);
659
- // }
660
- // }
661
-
662
- // return [coords, faces];
663
- // },
664
-
665
- // /**
666
- // * This function creates an array of dynamic 3-dimensional points
667
- // * based on an array of pairs of two coordinates.
668
- // * It uses a mathematical function to assign a third coordinate (the z-coordinate)
669
- // * to each pair of two coordinates.
670
- // * The 3-dimensional points are not stored directly.
671
- // * Instead the array stores JavaScript functions that utilize the mentioned mathematical function
672
- // * to return an array of three coordinates.
673
- // * This allows the recognition and proper visualization of changes to the underlying
674
- // * mathematical function.
675
- // * @name mapMeshTo3D
676
- // * @param {Array} surface
677
- // * @param {Parametricsurface3d} el
678
- // * @returns {Array} dynamicPoints array of [x, y, z] coordinates
679
- // *
680
- // * @private
681
- // * @memberof JXG.Math.Tiling
682
- // */
683
- // mapMeshTo3D: function (surface, el) {
684
- // var dynamicPoints = [], i;
685
-
686
- // for (i = 0; i < surface[0].length; i++) {
687
- // dynamicPoints.push(
688
- // (function (u, v) {
689
- // return function(x, y) { return el.F(u, v); };
690
- // })(surface[0][i][0], surface[0][i][1])
691
- // ); // Capture values explicitly
692
- // // dynamicPoints.push(
693
- // // (function (u, v) {
694
- // // return function(x, y) { return el.F(Type.evaluate(u), Type.evaluate(v)); };
695
- // // })(surface[0][i][0], surface[0][i][1])
696
- // // ); // Capture values explicitly
697
- // }
698
-
699
- // return dynamicPoints;
700
- // }
701
419
  };
702
420
 
703
421
  export default Mat.Tiling;
@@ -3558,7 +3558,7 @@ upcomingInput:function () {
3558
3558
  showPosition:function () {
3559
3559
  var pre = this.pastInput();
3560
3560
  var c = new Array(pre.length + 1).join("-");
3561
- return pre + this.upcomingInput() + "\n" + c+"^";
3561
+ return JXG.escapeHTML(pre + this.upcomingInput() + "\n" + c+"^");
3562
3562
  },
3563
3563
  next:function () {
3564
3564
  if (this.done) {
@@ -291,7 +291,7 @@ JXG.extend(
291
291
  * Set the gradient angle for linear color gradients.
292
292
  *
293
293
  * @private
294
- * @param {JXG.GeometryElement} node An arbitrary JSXGraph element, preferably one with an area.
294
+ * @param {JXG.GeometryElement} el An arbitrary JSXGraph element, preferably one with an area.
295
295
  * @param {Number} radians angle value in radians. 0 is horizontal from left to right, Pi/4 is vertical from top to bottom.
296
296
  */
297
297
  updateGradientAngle: function (el, radians) {
@@ -347,7 +347,7 @@ JXG.extend(
347
347
  * Set circles for radial color gradients.
348
348
  *
349
349
  * @private
350
- * @param {SVGnode} node SVG gradient node
350
+ * @param {JXG.GeometryElement} el An arbitrary JSXGraph element, preferably one with an area.
351
351
  * @param {Number} cx Canvas value x1 (but value between 0 and 1)
352
352
  * @param {Number} cy Canvas value y1 (but value between 0 and 1)
353
353
  * @param {Number} r Canvas value r1 (but value between 0 and 1)
@@ -360,19 +360,20 @@ JXG.extend(
360
360
  c1, c2,
361
361
  cxs, cys, rs,
362
362
  fxs, fys, frs,
363
- dx, dy;
363
+ dx, dy, d;
364
364
 
365
365
  c1 = new Coords(Const.COORDS_BY_USER, [bb[0], bb[1]], el.board);
366
366
  c2 = new Coords(Const.COORDS_BY_USER, [bb[2], bb[3]], el.board);
367
367
  dx = c2.scrCoords[1] - c1.scrCoords[1];
368
368
  dy = c1.scrCoords[2] - c2.scrCoords[2];
369
-
370
369
  cxs = c1.scrCoords[1] + dx * cx;
371
370
  cys = c2.scrCoords[2] + dy * cy;
372
371
  fxs = c1.scrCoords[1] + dx * fx;
373
372
  fys = c2.scrCoords[2] + dy * fy;
374
- rs = r * (dx + dy) * 0.5;
375
- frs = fr * (dx + dy) * 0.5;
373
+
374
+ d = Math.abs(dx) + Math.abs(dy);
375
+ rs = Math.max(r * d * 0.5, 0);
376
+ frs = Math.max(fr * d * 0.5, 0);
376
377
 
377
378
  return this.context.createRadialGradient(fxs, fys, frs, cxs, cys, rs);
378
379
  },
@@ -338,7 +338,7 @@ JXG.SVGRenderer = function (container, dim) {
338
338
  var id = this.uniqName('ClipFull'),
339
339
  node1 = this.container.ownerDocument.createElementNS(this.svgNamespace, 'clipPath'),
340
340
  node2 = this.container.ownerDocument.createElementNS(this.svgNamespace, 'rect'),
341
- style, rx, ry;
341
+ style, r;
342
342
  node1.setAttributeNS(null, 'id', id);
343
343
 
344
344
  node2.setAttributeNS(null, 'x', 0);
@@ -348,10 +348,9 @@ JXG.SVGRenderer = function (container, dim) {
348
348
 
349
349
  // Inherit border-radius
350
350
  style = getComputedStyle(this.container);
351
- rx = Type.exists(style['border-radius']) ? parseFloat(style['border-radius']) : 0;
352
- ry = rx;
353
- node2.setAttributeNS(null, 'rx', rx);
354
- node2.setAttributeNS(null, 'ry', ry);
351
+ r = (Type.exists(style['border-radius']) && style['border-radius'] !== '') ? parseFloat(style['border-radius']) : 0;
352
+ node2.setAttributeNS(null, 'rx', r);
353
+ node2.setAttributeNS(null, 'ry', r);
355
354
 
356
355
  node1.appendChild(node2);
357
356
  return node1;
@@ -1039,7 +1038,7 @@ JXG.extend(
1039
1038
 
1040
1039
  // Already documented in JXG.AbstractRenderer
1041
1040
  setLayer: function (el, level) {
1042
- var node;
1041
+ var node, elNode;
1043
1042
  if (!Type.exists(level)) {
1044
1043
  level = 0;
1045
1044
  } else if (level >= Options.layer.numlayers) {
@@ -1047,8 +1046,16 @@ JXG.extend(
1047
1046
  }
1048
1047
 
1049
1048
  node = this.layer[level];
1049
+ // if ('moveBefore' in Element.prototype) {
1050
1050
  if (Type.exists(node.moveBefore)) {
1051
- node.moveBefore(el.rendNode, null);
1051
+ // node.moveBefore(el.rendNode, null);
1052
+ elNode = el.rendNode;
1053
+ if (elNode.isConnected && node.isConnected &&
1054
+ (elNode.ownerDocument === node.ownerDocument)) {
1055
+ node.moveBefore(elNode, null);
1056
+ } else {
1057
+ node.insertBefore(elNode, null);
1058
+ }
1052
1059
  } else {
1053
1060
  node.appendChild(el.rendNode);
1054
1061
  }
@@ -1335,6 +1342,7 @@ JXG.extend(
1335
1342
  i = 0;
1336
1343
  while (i < len) {
1337
1344
  if (el.points[i] === undefined) {
1345
+ i++;
1338
1346
  continue;
1339
1347
  }
1340
1348
  scr = el.points[i].scrCoords;