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.
- package/CHANGELOG.md +33 -3
- package/distrib/docs/3d_linspace3d.js.html +16 -10
- package/distrib/docs/3d_point3d.js.html +0 -5
- package/distrib/docs/3d_sphere3d.js.html +92 -69
- package/distrib/docs/3d_view3d.js.html +24 -16
- package/distrib/docs/Angle.html +7 -7
- package/distrib/docs/CircumcircleSector.html +2 -2
- package/distrib/docs/Conic.html +1 -1
- package/distrib/docs/Ellipse.html +23 -1
- package/distrib/docs/Hyperbola.html +24 -1
- package/distrib/docs/JXG.Board.infobox.html +1 -1
- package/distrib/docs/JXG.Board_.html +130 -130
- package/distrib/docs/JXG.CanvasRenderer.html +10 -10
- package/distrib/docs/JXG.Composition.html +3 -3
- package/distrib/docs/JXG.GeometryElement.html +26 -26
- package/distrib/docs/JXG.Math.Numerics.html +45 -47
- package/distrib/docs/JXG.Math.Statistics.html +14 -15
- package/distrib/docs/JXG.Math.Tiling.html +3 -7
- package/distrib/docs/JXG.Math.html +101 -83
- package/distrib/docs/JXG.Point3D.html +2 -2
- package/distrib/docs/JXG.SVGRenderer.html +12 -12
- package/distrib/docs/JXG.Sphere3D.html +1255 -2
- package/distrib/docs/JXG.View3D.html +29 -29
- package/distrib/docs/JXG.html +20 -20
- package/distrib/docs/MajorSector.html +1 -1
- package/distrib/docs/MinorSector.html +1 -1
- package/distrib/docs/NonReflexAngle.html +1 -1
- package/distrib/docs/Parabola.html +1 -1
- package/distrib/docs/Point3D.html +1 -1
- package/distrib/docs/ReflexAngle.html +1 -1
- package/distrib/docs/Sector.html +12 -12
- package/distrib/docs/Sphere3D.html +17 -1
- package/distrib/docs/View3D.html +1 -1
- package/distrib/docs/base_board.js.html +63 -13
- package/distrib/docs/base_composition.js.html +3 -3
- package/distrib/docs/base_constants.js.html +1 -1
- package/distrib/docs/base_element.js.html +2 -1
- package/distrib/docs/base_text.js.html +2 -2
- package/distrib/docs/element_conic.js.html +35 -1
- package/distrib/docs/element_sector.js.html +6 -3
- package/distrib/docs/index.html +1 -1
- package/distrib/docs/math_math.js.html +64 -35
- package/distrib/docs/math_numerics.js.html +13 -12
- package/distrib/docs/math_statistics.js.html +19 -19
- package/distrib/docs/math_tiling.js.html +6 -288
- package/distrib/docs/parser_jessiecode.js.html +1 -1
- package/distrib/docs/renderer_canvas.js.html +7 -6
- package/distrib/docs/renderer_svg.js.html +15 -7
- package/distrib/docs/scripts/jsxgraphcore.js +2 -2
- package/distrib/docs/styles/jsxgraph.css +1 -1
- package/distrib/docs/utils_type.js.html +11 -4
- package/distrib/geogebra.min.js +1 -1
- package/distrib/geonext.min.js +1 -1
- package/distrib/index.d.ts +11 -0
- package/distrib/intergeo.min.js +1 -1
- package/distrib/jsxgraph.css +1 -1
- package/distrib/jsxgraphcore.js +2 -2
- package/distrib/jsxgraphcore.mjs +2 -2
- package/distrib/jsxgraphcore.mjs.map +1 -1
- package/distrib/jsxgraphsrc.js +380 -496
- package/distrib/jsxgraphsrc.mjs +380 -496
- package/distrib/jsxgraphsrc.mjs.map +1 -1
- package/package.json +10 -12
- package/src/3d/linspace3d.js +16 -10
- package/src/3d/point3d.js +0 -5
- package/src/3d/sphere3d.js +92 -69
- package/src/3d/view3d.js +24 -16
- package/src/base/board.js +63 -13
- package/src/base/composition.js +3 -3
- package/src/base/constants.js +1 -1
- package/src/base/element.js +2 -1
- package/src/base/text.js +2 -2
- package/src/element/conic.js +35 -1
- package/src/element/sector.js +6 -3
- package/src/index.d.ts +11 -0
- package/src/math/math.js +64 -35
- package/src/math/numerics.js +13 -12
- package/src/math/statistics.js +19 -19
- package/src/math/tiling.js +6 -288
- package/src/parser/jessiecode.js +1 -1
- package/src/renderer/canvas.js +7 -6
- package/src/renderer/svg.js +15 -7
- package/src/utils/type.js +11 -4
- package/src/unused/bst.js +0 -475
- package/src/unused/heap.js +0 -135
- package/src/unused/locus.js +0 -162
- package/src/unused/server/JXG.py +0 -74
- package/src/unused/server/JXGServer.py +0 -94
- package/src/unused/server/JXGServerModule.py +0 -9
- package/src/unused/server/README.md +0 -63
- package/src/unused/server/RStats.py +0 -45
- package/src/unused/server/YahooFinance.py +0 -81
- package/src/unused/server/fft.py +0 -136
- package/src/unused/server/geoloci.py +0 -210
- package/src/unused/server/jxggroebner.py +0 -219
- package/src/unused/server/jxgtestplugin.py +0 -19
- package/src/unused/server/server.js +0 -280
- package/src/unused/sketch.js +0 -2895
- package/src/unused/symbolic.js +0 -416
|
@@ -703,6 +703,10 @@ var sphere = view.create(
|
|
|
703
703
|
|
|
704
704
|
<p class="columntext"><a href="JXG.GeometryElement.html#quadraticform">quadraticform</a></p>
|
|
705
705
|
|
|
706
|
+
<p class="columntext"><a href="JXG.Sphere3D.html#range_u">range_u</a></p>
|
|
707
|
+
|
|
708
|
+
<p class="columntext"><a href="JXG.Sphere3D.html#range_v">range_v</a></p>
|
|
709
|
+
|
|
706
710
|
<p class="columntext"><a href="JXG.GeometryElement.html#rendNode">rendNode</a></p>
|
|
707
711
|
|
|
708
712
|
<p class="columntext"><a href="JXG.GeometryElement.html#stdform">stdform</a></p>
|
|
@@ -749,6 +753,12 @@ var sphere = view.create(
|
|
|
749
753
|
|
|
750
754
|
<p class="columntext"><a href="JXG.Sphere3D.html#Radius">Radius</a></p>
|
|
751
755
|
|
|
756
|
+
<p class="columntext"><a href="JXG.Sphere3D.html#X">X</a></p>
|
|
757
|
+
|
|
758
|
+
<p class="columntext"><a href="JXG.Sphere3D.html#Y">Y</a></p>
|
|
759
|
+
|
|
760
|
+
<p class="columntext"><a href="JXG.Sphere3D.html#Z">Z</a></p>
|
|
761
|
+
|
|
752
762
|
<p class="columntext"><a href="JXG.GeometryElement.html#_set">_set</a></p>
|
|
753
763
|
|
|
754
764
|
<p class="columntext"><a href="JXG.GeometryElement.html#addChild">addChild</a></p>
|
|
@@ -769,6 +779,8 @@ var sphere = view.create(
|
|
|
769
779
|
|
|
770
780
|
<p class="columntext"><a href="JXG.GeometryElement.html#bounds">bounds</a></p>
|
|
771
781
|
|
|
782
|
+
<p class="columntext"><a href="JXG.Sphere3D.html#buildProjection">buildProjection</a></p>
|
|
783
|
+
|
|
772
784
|
<p class="columntext"><a href="JXG.GeometryElement.html#clearTrace">clearTrace</a></p>
|
|
773
785
|
|
|
774
786
|
<p class="columntext"><a href="JXG.GeometryElement.html#clearTransforms">clearTransforms</a></p>
|
|
@@ -787,6 +799,8 @@ var sphere = view.create(
|
|
|
787
799
|
|
|
788
800
|
<p class="columntext"><a href="JXG.GeometryElement.html#evalVisProp">evalVisProp</a></p>
|
|
789
801
|
|
|
802
|
+
<p class="columntext"><a href="JXG.Sphere3D.html#focusFn">focusFn</a></p>
|
|
803
|
+
|
|
790
804
|
<p class="columntext"><a href="JXG.GeometryElement.html#formatNumberLocale">formatNumberLocale</a></p>
|
|
791
805
|
|
|
792
806
|
<p class="columntext"><a href="JXG.GeometryElement.html#fullUpdate">fullUpdate</a></p>
|
|
@@ -819,6 +833,8 @@ var sphere = view.create(
|
|
|
819
833
|
|
|
820
834
|
<p class="columntext"><a href="JXG.GeometryElement.html#hideElement">hideElement</a></p>
|
|
821
835
|
|
|
836
|
+
<p class="columntext"><a href="JXG.Sphere3D.html#innerVertexFn">innerVertexFn</a></p>
|
|
837
|
+
|
|
822
838
|
<p class="columntext"><a href="JXG.GeometryElement.html#noHighlight">noHighlight</a></p>
|
|
823
839
|
|
|
824
840
|
<p class="columntext"><a href="JXG.GeometryElement.html#normalize">normalize</a></p>
|
|
@@ -1069,7 +1085,7 @@ var sphere = view.create(
|
|
|
1069
1085
|
|
|
1070
1086
|
<dt class="tag-source">Source</dt>
|
|
1071
1087
|
<dd class="tag-source">
|
|
1072
|
-
<a href="3d_sphere3d.js.html">3d/sphere3d.js</a>, <a href="3d_sphere3d.js.html#
|
|
1088
|
+
<a href="3d_sphere3d.js.html">3d/sphere3d.js</a>, <a href="3d_sphere3d.js.html#line430">line 430</a>
|
|
1073
1089
|
</dd>
|
|
1074
1090
|
|
|
1075
1091
|
|
package/distrib/docs/View3D.html
CHANGED
|
@@ -4698,7 +4698,7 @@ Suppress label with <code>withLabel: false</code>.</p></dd>
|
|
|
4698
4698
|
|
|
4699
4699
|
<dt class="tag-source">Source</dt>
|
|
4700
4700
|
<dd class="tag-source">
|
|
4701
|
-
<a href="3d_view3d.js.html">3d/view3d.js</a>, <a href="3d_view3d.js.html#
|
|
4701
|
+
<a href="3d_view3d.js.html">3d/view3d.js</a>, <a href="3d_view3d.js.html#line2320">line 2320</a>
|
|
4702
4702
|
</dd>
|
|
4703
4703
|
|
|
4704
4704
|
|
|
@@ -4503,6 +4503,9 @@ JXG.extend(
|
|
|
4503
4503
|
var w = width,
|
|
4504
4504
|
h = height,
|
|
4505
4505
|
// bb,
|
|
4506
|
+
bbox,
|
|
4507
|
+
offX = 0,
|
|
4508
|
+
offY = 0,
|
|
4506
4509
|
css,
|
|
4507
4510
|
width_adjustment, height_adjustment;
|
|
4508
4511
|
|
|
@@ -4539,7 +4542,38 @@ JXG.extend(
|
|
|
4539
4542
|
|
|
4540
4543
|
// If bounding box is not yet initialized, do it now.
|
|
4541
4544
|
if (isNaN(this.getBoundingBox()[0])) {
|
|
4542
|
-
|
|
4545
|
+
// This is not enough
|
|
4546
|
+
// this.setBoundingBox(this.attr.boundingbox, this.keepaspectratio, 'keep');
|
|
4547
|
+
// Instead, we do the same as in JXG.JSXGraphinitBoard():
|
|
4548
|
+
bbox = this.attr.boundingbox;
|
|
4549
|
+
if (Type.exists(bbox) && this.keepaspectratio) {
|
|
4550
|
+
/*
|
|
4551
|
+
* If the boundingbox attribute is given and the ratio of height and width of the
|
|
4552
|
+
* sides defined by the bounding box and the ratio of the dimensions of the div tag
|
|
4553
|
+
* which contains the board do not coincide, then the smaller side is chosen.
|
|
4554
|
+
*/
|
|
4555
|
+
this.unitX = w / (bbox[2] - bbox[0]);
|
|
4556
|
+
this.unitY = h / (bbox[1] - bbox[3]);
|
|
4557
|
+
|
|
4558
|
+
if (Math.abs(this.unitX) < Math.abs(this.unitY)) {
|
|
4559
|
+
this.unitY = (Math.abs(this.unitX) * this.unitY) / Math.abs(this.unitY);
|
|
4560
|
+
// Add the additional units in equal portions above and below
|
|
4561
|
+
offY = (h / this.unitY - (bbox[1] - bbox[3])) * 0.5;
|
|
4562
|
+
} else {
|
|
4563
|
+
this.unitX = (Math.abs(this.unitY) * this.unitX) / Math.abs(this.unitX);
|
|
4564
|
+
// Add the additional units in equal portions left and right
|
|
4565
|
+
offX = (w / this.unitX - (bbox[2] - bbox[0])) * 0.5;
|
|
4566
|
+
}
|
|
4567
|
+
} else {
|
|
4568
|
+
this.unitX = w / (bbox[2] - bbox[0]);
|
|
4569
|
+
this.unitY = h / (bbox[1] - bbox[3]);
|
|
4570
|
+
}
|
|
4571
|
+
this.origin.scrCoords = [1,
|
|
4572
|
+
-this.unitX * (bbox[0] - offX),
|
|
4573
|
+
this.unitY * (bbox[1] + offY)
|
|
4574
|
+
];
|
|
4575
|
+
this.canvasWidth = w;
|
|
4576
|
+
this.canvasHeight = h;
|
|
4543
4577
|
}
|
|
4544
4578
|
|
|
4545
4579
|
// Do nothing if the dimension did not change since being visible
|
|
@@ -4580,16 +4614,21 @@ JXG.extend(
|
|
|
4580
4614
|
}
|
|
4581
4615
|
|
|
4582
4616
|
this.resizeObserver = new ResizeObserver(function (entries) {
|
|
4583
|
-
var bb;
|
|
4617
|
+
// var bb;
|
|
4618
|
+
|
|
4619
|
+
// Take the last observed size
|
|
4620
|
+
that._lastContentRect = entries[entries.length - 1].contentRect;
|
|
4584
4621
|
if (!that._isResizing) {
|
|
4585
4622
|
that._isResizing = true;
|
|
4586
|
-
bb = entries[0].contentRect;
|
|
4623
|
+
// bb = entries[0].contentRect;
|
|
4587
4624
|
window.setTimeout(function () {
|
|
4625
|
+
var bb = that._lastContentRect;
|
|
4588
4626
|
try {
|
|
4589
4627
|
that.updateContainerDims(bb.width, bb.height);
|
|
4590
4628
|
} catch (e) {
|
|
4591
|
-
JXG.debug(e); // Used to log errors during board.update()
|
|
4592
|
-
|
|
4629
|
+
// JXG.debug(e); // Used to log errors during board.update()
|
|
4630
|
+
console.error(e);
|
|
4631
|
+
// that.stopResizeObserver();
|
|
4593
4632
|
} finally {
|
|
4594
4633
|
that._isResizing = false;
|
|
4595
4634
|
}
|
|
@@ -5622,7 +5661,7 @@ JXG.extend(
|
|
|
5622
5661
|
* @private
|
|
5623
5662
|
*/
|
|
5624
5663
|
_removeObj: function (object, saveMethod) {
|
|
5625
|
-
var el,
|
|
5664
|
+
var el, i, pos;
|
|
5626
5665
|
|
|
5627
5666
|
if (Type.isArray(object)) {
|
|
5628
5667
|
for (i = 0; i < object.length; i++) {
|
|
@@ -5640,6 +5679,16 @@ JXG.extend(
|
|
|
5640
5679
|
return this;
|
|
5641
5680
|
}
|
|
5642
5681
|
|
|
5682
|
+
// Already removed (e.g. reached again through a parent's childElements
|
|
5683
|
+
// or View3D.removeObject). Removing it twice used to splice a live element.
|
|
5684
|
+
if (object._pos === -1 && this.objects[object.id] !== object) {
|
|
5685
|
+
return this;
|
|
5686
|
+
}
|
|
5687
|
+
|
|
5688
|
+
if (object.is3D && Type.exists(object.view.objects[object.id])) {
|
|
5689
|
+
JXG.warn("board.removeObject() of 3D object " + object.id + ". Use view3d.removeObject() instead.");
|
|
5690
|
+
}
|
|
5691
|
+
|
|
5643
5692
|
try {
|
|
5644
5693
|
// remove all children.
|
|
5645
5694
|
for (el in object.childElements) {
|
|
@@ -5689,15 +5738,16 @@ JXG.extend(
|
|
|
5689
5738
|
}
|
|
5690
5739
|
|
|
5691
5740
|
// remove the object itself from our control structures
|
|
5692
|
-
if
|
|
5693
|
-
|
|
5741
|
+
// Trust _pos only if it still points at the object, and reset it
|
|
5742
|
+
// afterwards, so a stale index can never splice another element.
|
|
5743
|
+
pos = this.objectsList[object._pos] === object ? object._pos : this.objectsList.indexOf(object);
|
|
5744
|
+
if (pos > -1) {
|
|
5745
|
+
this.objectsList.splice(pos, 1);
|
|
5694
5746
|
// Quadratic complexity for reindexing the positions:
|
|
5695
|
-
for (i =
|
|
5696
|
-
|
|
5697
|
-
if (o._pos > -1) {
|
|
5698
|
-
o._pos--;
|
|
5699
|
-
}
|
|
5747
|
+
for (i = pos; i < this.objectsList.length; i++) {
|
|
5748
|
+
this.objectsList[i]._pos = i;
|
|
5700
5749
|
}
|
|
5750
|
+
object._pos = -1;
|
|
5701
5751
|
} else if (object.type !== Const.OBJECT_TYPE_TURTLE) {
|
|
5702
5752
|
JXG.debug(
|
|
5703
5753
|
'Board.removeObject: object ' + object.id + ' not found in list.'
|
|
@@ -265,9 +265,9 @@ JXG.extend(
|
|
|
265
265
|
/** @lends JXG.Composition.prototype */ {
|
|
266
266
|
/**
|
|
267
267
|
* Adds an element to the composition container.
|
|
268
|
-
* @param {String} what Descriptive name for the element, e.g.
|
|
269
|
-
* access the element later on. There are some reserved names:
|
|
270
|
-
* updateRenderer
|
|
268
|
+
* @param {String} what Descriptive name for the element, e.g. `startpoint` or `area`. This is used to
|
|
269
|
+
* access the element later on. There are some reserved names: `elements`, `add`, `remove`, `update`, `prepareUpdate`,
|
|
270
|
+
* `updateRenderer`, `highlight`, `noHighlight`, and all names that would form invalid object property names in
|
|
271
271
|
* JavaScript.
|
|
272
272
|
* @param {JXG.GeometryElement|JXG.Composition} element A reference to the element that is to be added. This can be
|
|
273
273
|
* another composition, too.
|
|
@@ -2553,7 +2553,8 @@ JXG.extend(
|
|
|
2553
2553
|
} else if (this.elementClass === Const.OBJECT_CLASS_CIRCLE) {
|
|
2554
2554
|
x = this.center.X();
|
|
2555
2555
|
y = this.center.Y();
|
|
2556
|
-
|
|
2556
|
+
r = this.Radius(); // this.radius
|
|
2557
|
+
bb = [x - r, y + r, x + r, y - r];
|
|
2557
2558
|
} else if (this.elementClass === Const.OBJECT_CLASS_CURVE) {
|
|
2558
2559
|
le = this.points.length;
|
|
2559
2560
|
if (le === 0) {
|
|
@@ -1846,8 +1846,8 @@ JXG.createHTMLSlider = function (board, parents, attributes) {
|
|
|
1846
1846
|
}
|
|
1847
1847
|
|
|
1848
1848
|
// Backwards compatibility
|
|
1849
|
-
attr.anchor = attr.parent
|
|
1850
|
-
attr.fixed = attr.fixed
|
|
1849
|
+
attr.anchor = Type.def(attr.parent, attr.anchor);
|
|
1850
|
+
attr.fixed = Type.def(attr.fixed, true);
|
|
1851
1851
|
|
|
1852
1852
|
par = [
|
|
1853
1853
|
parents[0][0],
|
|
@@ -204,13 +204,30 @@ import Type from "../utils/type.js";
|
|
|
204
204
|
* @jsxgraphsignature Ellipse
|
|
205
205
|
* Parent elements can be two elements either of type {@link JXG.Point} or array of
|
|
206
206
|
* numbers describing the coordinates of a point.
|
|
207
|
-
* The third parameter is a number/function which defines the length of the major axis
|
|
207
|
+
* The third parameter is a number/function which defines the length of the major axis.
|
|
208
208
|
* @param {PointLike} point1
|
|
209
209
|
* @param {PointLike} point2
|
|
210
210
|
* @param {NumberLike} number
|
|
211
211
|
* @param {Number} [start=0] parameter of the curve start, default: 0.
|
|
212
212
|
* @param {Number} [end=2π] parameter for the curve end, default: 2&pi;.
|
|
213
213
|
*
|
|
214
|
+
* @example
|
|
215
|
+
* var A = board.create('point', [1,0]);
|
|
216
|
+
* var B = board.create('point', [-1,0]);
|
|
217
|
+
* var el = board.create('ellipse',[A, B, 4]);
|
|
218
|
+
*
|
|
219
|
+
* </pre><div id="JXG7898d447-94dc-4dce-9ad3-60e3387be9f3" class="jxgbox" style="width: 300px; height: 300px;"></div>
|
|
220
|
+
* <script type="text/javascript">
|
|
221
|
+
* (function() {
|
|
222
|
+
* var board = JXG.JSXGraph.initBoard('JXG7898d447-94dc-4dce-9ad3-60e3387be9f3',
|
|
223
|
+
* {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
|
|
224
|
+
* var A = board.create('point', [1,0]);
|
|
225
|
+
* var B = board.create('point', [-1,0]);
|
|
226
|
+
* var el = board.create('ellipse',[A,B, 4]);
|
|
227
|
+
* })();
|
|
228
|
+
*
|
|
229
|
+
* </script><pre>
|
|
230
|
+
*
|
|
214
231
|
*/
|
|
215
232
|
JXG.createEllipse = function (board, parents, attributes) {
|
|
216
233
|
var polarForm,
|
|
@@ -482,6 +499,23 @@ JXG.createEllipse = function (board, parents, attributes) {
|
|
|
482
499
|
* @param {NumberLike} number
|
|
483
500
|
* @param {Number} [start=-π] parameter of the curve start, default: -&pi;.
|
|
484
501
|
* @param {Number} [end=π] parameter for the curve end, default: &pi;.
|
|
502
|
+
* @example
|
|
503
|
+
* var A = board.create('point', [1,0]);
|
|
504
|
+
* var B = board.create('point', [-1,0]);
|
|
505
|
+
* var el = board.create('hyperbola',[A, B, 1]);
|
|
506
|
+
*
|
|
507
|
+
* </pre><div id="JXGa4c0068b-41bc-4be4-b485-d0d0c7f2e10b" class="jxgbox" style="width: 300px; height: 300px;"></div>
|
|
508
|
+
* <script type="text/javascript">
|
|
509
|
+
* (function() {
|
|
510
|
+
* var board = JXG.JSXGraph.initBoard('JXGa4c0068b-41bc-4be4-b485-d0d0c7f2e10b',
|
|
511
|
+
* {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
|
|
512
|
+
* var A = board.create('point', [1,0]);
|
|
513
|
+
* var B = board.create('point', [-1,0]);
|
|
514
|
+
* var el = board.create('hyperbola',[A,B, 1]);
|
|
515
|
+
*
|
|
516
|
+
* })();
|
|
517
|
+
*
|
|
518
|
+
* </script><pre>
|
|
485
519
|
*/
|
|
486
520
|
JXG.createHyperbola = function (board, parents, attributes) {
|
|
487
521
|
var polarForm,
|
|
@@ -383,11 +383,11 @@ JXG.createSector = function (board, parents, attributes) {
|
|
|
383
383
|
s = el.line1.point1.coords;
|
|
384
384
|
} else if (
|
|
385
385
|
el.line1.point2.Dist(el.line2.point1) < eps ||
|
|
386
|
-
el.line1.point2.Dist(el.line2.
|
|
386
|
+
el.line1.point2.Dist(el.line2.point2) < eps
|
|
387
387
|
) {
|
|
388
388
|
s = el.line1.point2.coords;
|
|
389
389
|
} else {
|
|
390
|
-
|
|
390
|
+
JXG.warn(
|
|
391
391
|
"JSXGraph warning: Can't create Sector from parallel lines with no common defining point."
|
|
392
392
|
);
|
|
393
393
|
}
|
|
@@ -468,10 +468,13 @@ JXG.createSector = function (board, parents, attributes) {
|
|
|
468
468
|
B = l1.point1.coords.usrCoords;
|
|
469
469
|
} else if (
|
|
470
470
|
l1.point2.Dist(l2.point1) < eps ||
|
|
471
|
-
l1.point2.Dist(l2.
|
|
471
|
+
l1.point2.Dist(l2.point2) < eps
|
|
472
472
|
) {
|
|
473
473
|
B = l1.point2.coords.usrCoords;
|
|
474
474
|
} else {
|
|
475
|
+
JXG.warn(
|
|
476
|
+
"JSXGraph warning: sector from parallel lines with no common defining point."
|
|
477
|
+
);
|
|
475
478
|
}
|
|
476
479
|
}
|
|
477
480
|
|
package/distrib/docs/index.html
CHANGED
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
|
|
101
101
|
<section class="readme usertext">
|
|
102
102
|
<article><h1>JSXGraph API Reference</h1>
|
|
103
|
-
<p><em>JSXGraph version 1.14.
|
|
103
|
+
<p><em>JSXGraph version 1.14.1, API reference generated 2026-10-21</em></p>
|
|
104
104
|
<p><a href="https://jsxgraph.org">JSXGraph</a> is a cross-platform library for interactive geometry, function
|
|
105
105
|
plotting and data visualisation in the web browser. It turns abstract concepts
|
|
106
106
|
into graphics that can be dragged, animated and explored — for teaching,
|
|
@@ -767,10 +767,10 @@ JXG.Math = {
|
|
|
767
767
|
}),
|
|
768
768
|
|
|
769
769
|
/**
|
|
770
|
-
* Calculates the cosine
|
|
770
|
+
* Calculates the hyperbolic cosine of \\(x\\).
|
|
771
771
|
* @function
|
|
772
772
|
* @param {Number} x The number the cosine hyperbolicus will be calculated of.
|
|
773
|
-
* @returns {Number}
|
|
773
|
+
* @returns {Number} Hyperbolic cosine of the given value.
|
|
774
774
|
*/
|
|
775
775
|
cosh:
|
|
776
776
|
Math.cosh ||
|
|
@@ -779,10 +779,10 @@ JXG.Math = {
|
|
|
779
779
|
},
|
|
780
780
|
|
|
781
781
|
/**
|
|
782
|
-
*
|
|
782
|
+
* Hyperbolic sine of \\(x\\).
|
|
783
783
|
* @function
|
|
784
|
-
* @param {Number} x The number the sine
|
|
785
|
-
* @returns {Number}
|
|
784
|
+
* @param {Number} x The number the hyperbolic sine will be calculated of.
|
|
785
|
+
* @returns {Number} Hyperbolic sine of the given value.
|
|
786
786
|
*/
|
|
787
787
|
sinh:
|
|
788
788
|
Math.sinh ||
|
|
@@ -791,7 +791,7 @@ JXG.Math = {
|
|
|
791
791
|
},
|
|
792
792
|
|
|
793
793
|
/**
|
|
794
|
-
*
|
|
794
|
+
* Inverse hyperbolic cosine of a number.
|
|
795
795
|
* @function
|
|
796
796
|
* @param {Number} x
|
|
797
797
|
* @returns {Number}
|
|
@@ -803,7 +803,7 @@ JXG.Math = {
|
|
|
803
803
|
},
|
|
804
804
|
|
|
805
805
|
/**
|
|
806
|
-
*
|
|
806
|
+
* Inverse hyperbolic sine of a number
|
|
807
807
|
* @function
|
|
808
808
|
* @param {Number} x
|
|
809
809
|
* @returns {Number}
|
|
@@ -880,7 +880,7 @@ JXG.Math = {
|
|
|
880
880
|
},
|
|
881
881
|
|
|
882
882
|
/**
|
|
883
|
-
* Computes cube root of real number
|
|
883
|
+
* Computes cube root of real number.
|
|
884
884
|
* Polyfill for Math.cbrt().
|
|
885
885
|
*
|
|
886
886
|
* @function
|
|
@@ -1000,7 +1000,11 @@ JXG.Math = {
|
|
|
1000
1000
|
},
|
|
1001
1001
|
|
|
1002
1002
|
/**
|
|
1003
|
-
* A square & multiply algorithm to compute base to the power of exponent
|
|
1003
|
+
* A square & multiply algorithm to compute `base` to the power of `exponent`.
|
|
1004
|
+
* That is, for base \\(b\\) and integer exponent \\(e\\) it is a fast method to compute
|
|
1005
|
+
* \\[ b^e .\\]
|
|
1006
|
+
* For non-integer values of `exponent`, JavaScript's `Math.pow` is used.
|
|
1007
|
+
*
|
|
1004
1008
|
* Implementated by Wolfgang Riedl.
|
|
1005
1009
|
*
|
|
1006
1010
|
* @param {Number} base
|
|
@@ -1035,16 +1039,17 @@ JXG.Math = {
|
|
|
1035
1039
|
},
|
|
1036
1040
|
|
|
1037
1041
|
/**
|
|
1038
|
-
* Greatest common divisor (gcd) of two numbers.
|
|
1039
|
-
* See {@link
|
|
1042
|
+
* Greatest common divisor (gcd) of two finite, non-zero integer numbers.
|
|
1043
|
+
* See {@link https://rosettacode.org/wiki/Greatest_common_divisor#JavaScript rosettacode.org}.
|
|
1040
1044
|
*
|
|
1041
|
-
* @param {Number} a First number
|
|
1042
|
-
* @param {Number} b Second number
|
|
1043
|
-
* @returns {Number}
|
|
1045
|
+
* @param {Number} a First number, not zero, Infinity, or NaN
|
|
1046
|
+
* @param {Number} b Second number, not zero, Infinity, or NaN
|
|
1047
|
+
* @returns {Number} gcd(a, b) if a and b are finite, non-zero numbers, NaN else.
|
|
1048
|
+
* @see JXG.Math#lcm
|
|
1044
1049
|
*/
|
|
1045
1050
|
gcd: function (a, b) {
|
|
1046
1051
|
var tmp,
|
|
1047
|
-
endless =
|
|
1052
|
+
endless = 100000;
|
|
1048
1053
|
|
|
1049
1054
|
a = Math.abs(a);
|
|
1050
1055
|
b = Math.abs(b);
|
|
@@ -1052,13 +1057,24 @@ JXG.Math = {
|
|
|
1052
1057
|
if (!(Type.isNumber(a) && Type.isNumber(b))) {
|
|
1053
1058
|
return NaN;
|
|
1054
1059
|
}
|
|
1060
|
+
if (isNaN(a) || isNaN(b) || a === Infinity || b === Infinity) {
|
|
1061
|
+
return NaN;
|
|
1062
|
+
}
|
|
1063
|
+
if (a === 0 || b === 0) {
|
|
1064
|
+
return NaN;
|
|
1065
|
+
}
|
|
1066
|
+
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
|
1067
|
+
JXG.warn('JSXGraph: JXG.Math.gcd requires integer parameters');
|
|
1068
|
+
return NaN;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1055
1071
|
if (b > a) {
|
|
1056
1072
|
tmp = a;
|
|
1057
1073
|
a = b;
|
|
1058
1074
|
b = tmp;
|
|
1059
1075
|
}
|
|
1060
1076
|
|
|
1061
|
-
while (endless) {
|
|
1077
|
+
while (endless > 0) {
|
|
1062
1078
|
a %= b;
|
|
1063
1079
|
if (a === 0) {
|
|
1064
1080
|
return b;
|
|
@@ -1067,15 +1083,18 @@ JXG.Math = {
|
|
|
1067
1083
|
if (b === 0) {
|
|
1068
1084
|
return a;
|
|
1069
1085
|
}
|
|
1086
|
+
endless--;
|
|
1070
1087
|
}
|
|
1071
1088
|
},
|
|
1072
1089
|
|
|
1073
1090
|
/**
|
|
1074
|
-
* Least common multiple (lcm) of two numbers.
|
|
1091
|
+
* Least common multiple (lcm) of two finite integer numbers.
|
|
1092
|
+
* lcm(0, a) is defined as 0.
|
|
1075
1093
|
*
|
|
1076
1094
|
* @param {Number} a First number
|
|
1077
1095
|
* @param {Number} b Second number
|
|
1078
|
-
* @returns {Number}
|
|
1096
|
+
* @returns {Number} lcm(a, b) if a and b are finite integer numbers, NaN else.
|
|
1097
|
+
* @see JXG.Math#gcd
|
|
1079
1098
|
*/
|
|
1080
1099
|
lcm: function (a, b) {
|
|
1081
1100
|
var ret;
|
|
@@ -1083,6 +1102,16 @@ JXG.Math = {
|
|
|
1083
1102
|
if (!(Type.isNumber(a) && Type.isNumber(b))) {
|
|
1084
1103
|
return NaN;
|
|
1085
1104
|
}
|
|
1105
|
+
if (isNaN(a) || isNaN(b) || Math.abs(a) === Infinity || Math.abs(b) === Infinity) {
|
|
1106
|
+
return NaN;
|
|
1107
|
+
}
|
|
1108
|
+
if (a === 0 || b === 0) {
|
|
1109
|
+
return 0;
|
|
1110
|
+
}
|
|
1111
|
+
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
|
1112
|
+
JXG.warn('JSXGraph: JXG.Math.gcd requires integer parameters');
|
|
1113
|
+
return NaN;
|
|
1114
|
+
}
|
|
1086
1115
|
|
|
1087
1116
|
ret = a * b;
|
|
1088
1117
|
if (ret !== 0) {
|
|
@@ -1268,7 +1297,7 @@ JXG.Math = {
|
|
|
1268
1297
|
/* ******************** Comparisons and logical operators ************** */
|
|
1269
1298
|
|
|
1270
1299
|
/**
|
|
1271
|
-
* Logical test: a < b
|
|
1300
|
+
* Logical test: `a < b`?
|
|
1272
1301
|
*
|
|
1273
1302
|
* @param {Number} a
|
|
1274
1303
|
* @param {Number} b
|
|
@@ -1279,7 +1308,7 @@ JXG.Math = {
|
|
|
1279
1308
|
},
|
|
1280
1309
|
|
|
1281
1310
|
/**
|
|
1282
|
-
* Logical test: a <= b
|
|
1311
|
+
* Logical test: `a <= b`?
|
|
1283
1312
|
*
|
|
1284
1313
|
* @param {Number} a
|
|
1285
1314
|
* @param {Number} b
|
|
@@ -1290,7 +1319,7 @@ JXG.Math = {
|
|
|
1290
1319
|
},
|
|
1291
1320
|
|
|
1292
1321
|
/**
|
|
1293
|
-
* Logical test: a > b
|
|
1322
|
+
* Logical test: `a > b`?
|
|
1294
1323
|
*
|
|
1295
1324
|
* @param {Number} a
|
|
1296
1325
|
* @param {Number} b
|
|
@@ -1301,7 +1330,7 @@ JXG.Math = {
|
|
|
1301
1330
|
},
|
|
1302
1331
|
|
|
1303
1332
|
/**
|
|
1304
|
-
* Logical test: a >= b
|
|
1333
|
+
* Logical test: `a >= b`?
|
|
1305
1334
|
*
|
|
1306
1335
|
* @param {Number} a
|
|
1307
1336
|
* @param {Number} b
|
|
@@ -1312,7 +1341,7 @@ JXG.Math = {
|
|
|
1312
1341
|
},
|
|
1313
1342
|
|
|
1314
1343
|
/**
|
|
1315
|
-
* Logical test: a === b
|
|
1344
|
+
* Logical test: `a === b`?
|
|
1316
1345
|
*
|
|
1317
1346
|
* @param {Number} a
|
|
1318
1347
|
* @param {Number} b
|
|
@@ -1323,7 +1352,7 @@ JXG.Math = {
|
|
|
1323
1352
|
},
|
|
1324
1353
|
|
|
1325
1354
|
/**
|
|
1326
|
-
* Logical test: a !== b
|
|
1355
|
+
* Logical test: `a !== b`?
|
|
1327
1356
|
*
|
|
1328
1357
|
* @param {Number} a
|
|
1329
1358
|
* @param {Number} b
|
|
@@ -1334,7 +1363,7 @@ JXG.Math = {
|
|
|
1334
1363
|
},
|
|
1335
1364
|
|
|
1336
1365
|
/**
|
|
1337
|
-
* Logical operator: a && b
|
|
1366
|
+
* Logical operator: `a && b`?
|
|
1338
1367
|
*
|
|
1339
1368
|
* @param {Boolean} a
|
|
1340
1369
|
* @param {Boolean} b
|
|
@@ -1345,7 +1374,7 @@ JXG.Math = {
|
|
|
1345
1374
|
},
|
|
1346
1375
|
|
|
1347
1376
|
/**
|
|
1348
|
-
* Logical operator:
|
|
1377
|
+
* Logical operator: `!a`?
|
|
1349
1378
|
*
|
|
1350
1379
|
* @param {Boolean} a
|
|
1351
1380
|
* @returns {Boolean}
|
|
@@ -1355,7 +1384,7 @@ JXG.Math = {
|
|
|
1355
1384
|
},
|
|
1356
1385
|
|
|
1357
1386
|
/**
|
|
1358
|
-
* Logical operator: a || b
|
|
1387
|
+
* Logical operator: `a || b`?
|
|
1359
1388
|
*
|
|
1360
1389
|
* @param {Boolean} a
|
|
1361
1390
|
* @param {Boolean} b
|
|
@@ -1366,7 +1395,7 @@ JXG.Math = {
|
|
|
1366
1395
|
},
|
|
1367
1396
|
|
|
1368
1397
|
/**
|
|
1369
|
-
* Logical operator: either a or b
|
|
1398
|
+
* Logical operator: either `a` or `b`?
|
|
1370
1399
|
*
|
|
1371
1400
|
* @param {Boolean} a
|
|
1372
1401
|
* @param {Boolean} b
|
|
@@ -1445,7 +1474,7 @@ JXG.Math = {
|
|
|
1445
1474
|
/* *************************** Normalize *************************** */
|
|
1446
1475
|
|
|
1447
1476
|
/**
|
|
1448
|
-
* Normalize the standard form [c, b0, b1, a, k, r, q0, q1]
|
|
1477
|
+
* Normalize the standard form `[c, b0, b1, a, k, r, q0, q1]`.
|
|
1449
1478
|
* @private
|
|
1450
1479
|
* @param {Array} stdform The standard form to be normalized.
|
|
1451
1480
|
* @returns {Array} The normalized standard form.
|
|
@@ -1516,13 +1545,13 @@ JXG.Math = {
|
|
|
1516
1545
|
},
|
|
1517
1546
|
|
|
1518
1547
|
/**
|
|
1519
|
-
* Theorem of Vieta: Given a set of simple zeroes x_0,
|
|
1520
|
-
* of a polynomial f, compute the coefficients s_k, (k=0
|
|
1521
|
-
* of the polynomial of the form
|
|
1548
|
+
* Theorem of Vieta: Given a set of simple zeroes \\(x_0, \ldots, x_n\\)
|
|
1549
|
+
* of a polynomial \\(f\\), compute the coefficients \\(s_k\\), \\(k=0, \ldots, n-1\\),
|
|
1550
|
+
* of the polynomial of the form
|
|
1551
|
+
* \\[ f(x) = (x-x_0)\cdots(x-x_n) = x^n + \sum_{k=1}^{n} (-1)^k s_{k-1} x^{n-k} \\]
|
|
1552
|
+
*
|
|
1553
|
+
* See {@link https://en.wikipedia.org/wiki/Vieta%27s_formulas}
|
|
1522
1554
|
*
|
|
1523
|
-
* f(x) = (x-x_0)*...*(x-x_n) =
|
|
1524
|
-
* x^n + sum_{k=1}^{n} (-1)^(k) s_{k-1} x^(n-k)
|
|
1525
|
-
* </p>
|
|
1526
1555
|
* @param {Array} x Simple zeroes of the polynomial.
|
|
1527
1556
|
* @returns {Array} Coefficients of the polynomial.
|
|
1528
1557
|
*
|
|
@@ -594,22 +594,20 @@ Mat.Numerics = {
|
|
|
594
594
|
* Calculates the integral of function f over interval using Romberg iteration.
|
|
595
595
|
* @param {Array} interval The integration interval, e.g. [0, 3].
|
|
596
596
|
* @param {function} f A function which takes one argument of type number and returns a number.
|
|
597
|
-
* @param {Object} [config] The algorithm setup. Accepted properties are max_iterations of type number and precision eps
|
|
597
|
+
* @param {Object} [config] The algorithm setup. Accepted properties are `max_iterations` of type number and precision `eps`.
|
|
598
598
|
* @param {Number} [config.max_iterations=20]
|
|
599
599
|
* @param {Number} [config.eps=0.0000001]
|
|
600
600
|
* @returns {Number} Integral value of f over interval
|
|
601
601
|
* @example
|
|
602
|
-
*
|
|
603
|
-
* return x*x;
|
|
604
|
-
* }
|
|
602
|
+
* var f = (x) => x * x;
|
|
605
603
|
*
|
|
606
|
-
* //
|
|
607
|
-
* var area1 = JXG.Math.Numerics.Romberg([0,
|
|
604
|
+
* // Calculates integral of `f` from 0 to 3.
|
|
605
|
+
* var area1 = JXG.Math.Numerics.Romberg([0, 3], f);
|
|
608
606
|
*
|
|
609
|
-
* //
|
|
610
|
-
* var area2 = JXG.Math.Numerics.Romberg([0,
|
|
607
|
+
* // The same with an anonymous function
|
|
608
|
+
* var area2 = JXG.Math.Numerics.Romberg([0, 3], function (x) { return x * x; });
|
|
611
609
|
*
|
|
612
|
-
* //
|
|
610
|
+
* // Use trapez rule with maximum of 16 iterations or stop if the precision 0.0001 has been reached.
|
|
613
611
|
* var area3 = JXG.Math.Numerics.Romberg([0, 2], f,
|
|
614
612
|
* {max_iterations: 16, eps: 0.0001});
|
|
615
613
|
* @memberof JXG.Math.Numerics
|
|
@@ -626,8 +624,11 @@ Mat.Numerics = {
|
|
|
626
624
|
p = [],
|
|
627
625
|
integral = 0.0,
|
|
628
626
|
last = Infinity,
|
|
629
|
-
m
|
|
630
|
-
|
|
627
|
+
m, eps;
|
|
628
|
+
|
|
629
|
+
config = Type.def(config, {});
|
|
630
|
+
m = config && Type.isNumber(config.max_iterations) ? config.max_iterations : 20;
|
|
631
|
+
eps = config && Type.isNumber(config.eps) ? config.eps : (config.eps || 0.0000001);
|
|
631
632
|
|
|
632
633
|
a = interval[0];
|
|
633
634
|
b = interval[1];
|
|
@@ -894,7 +895,7 @@ Mat.Numerics = {
|
|
|
894
895
|
xm = 0.5 * (b - a);
|
|
895
896
|
xp = 0.5 * (b + a);
|
|
896
897
|
|
|
897
|
-
if (n &
|
|
898
|
+
if ((n & 1) === 1) {
|
|
898
899
|
// n odd
|
|
899
900
|
result = w[0] * f(xp);
|
|
900
901
|
for (i = 1; i < m; ++i) {
|