jsxgraph 1.4.2 → 1.4.3
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/distrib/geogebra.min.js +1 -1
- package/distrib/geonext.min.js +1 -1
- package/distrib/index.d.ts +269 -30
- package/distrib/intergeo.min.js +1 -1
- package/distrib/jsxgraphcore.js +4 -4
- package/distrib/jsxgraphsrc.js +1789 -93
- package/distrib/sketch.min.js +2 -2
- package/package.json +1 -1
- package/src/3d/box3d.js +264 -0
- package/src/3d/curve3d.js +97 -0
- package/src/3d/linspace3d.js +375 -0
- package/src/3d/point3d.js +200 -0
- package/src/3d/surface3d.js +81 -0
- package/src/3d/threed.js +38 -0
- package/src/3d/view3d.js +459 -0
- package/src/base/board.js +30 -26
- package/src/base/constants.js +1 -1
- package/src/base/coordselement.js +1 -4
- package/src/base/element.js +22 -13
- package/src/base/foreignobject.js +7 -1
- package/src/base/line.js +1 -1
- package/src/base/polygon.js +88 -33
- package/src/base/ticks.js +2 -0
- package/src/element/composition.js +1 -1
- package/src/element/slider.js +12 -0
- package/src/loadjsxgraph.js +17 -11
- package/src/math/geometry.js +80 -1
- package/src/math/math.js +9 -0
- package/src/options.js +8 -8
- package/src/options3d.js +123 -0
- package/src/reader/sketch.js +2 -2
- package/src/utils/type.js +2 -2
package/src/base/polygon.js
CHANGED
|
@@ -559,8 +559,35 @@ define([
|
|
|
559
559
|
|
|
560
560
|
/**
|
|
561
561
|
* Add more points to the polygon. The new points will be inserted at the end.
|
|
562
|
-
*
|
|
562
|
+
* The attributes of new border segments are set to the same values
|
|
563
|
+
* as those used when the polygon was created.
|
|
564
|
+
* If new vertices are supplied by coordinates, the default attributes of polygon
|
|
565
|
+
* vertices are taken as their attributes. Therefore, the visual attributes of
|
|
566
|
+
* new vertices and borders may have to be adapted afterwards.
|
|
567
|
+
* @param {JXG.Point} p Arbitrary number of points or coordinate arrays
|
|
563
568
|
* @returns {JXG.Polygon} Reference to the polygon
|
|
569
|
+
* @example
|
|
570
|
+
* const board = JXG.JSXGraph.initBoard('jxgbox', {axis:true});
|
|
571
|
+
* var pg = board.create('polygon', [[1,2], [3,4], [-3,1]], {hasInnerPoints: true});
|
|
572
|
+
* var newPoint = board.create('point', [-1, -1]);
|
|
573
|
+
* var newPoint2 = board.create('point', [-1, -2]);
|
|
574
|
+
* pg.addPoints(newPoint, newPoint2, [1, -2]);
|
|
575
|
+
*
|
|
576
|
+
* </pre><div id="JXG70eb0fd2-d20f-4ba9-9ab6-0eac92aabfa5" class="jxgbox" style="width: 300px; height: 300px;"></div>
|
|
577
|
+
* <script type="text/javascript">
|
|
578
|
+
* (function() {
|
|
579
|
+
* var board = JXG.JSXGraph.initBoard('JXG70eb0fd2-d20f-4ba9-9ab6-0eac92aabfa5',
|
|
580
|
+
* {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
|
|
581
|
+
* const board = JXG.JSXGraph.initBoard('jxgbox', {axis:true});
|
|
582
|
+
* var pg = board.create('polygon', [[1,2], [3,4], [-3,1]], {hasInnerPoints: true});
|
|
583
|
+
* var newPoint = board.create('point', [-1, -1]);
|
|
584
|
+
* var newPoint2 = board.create('point', [-1, -2]);
|
|
585
|
+
* pg.addPoints(newPoint, newPoint2, [1, -2]);
|
|
586
|
+
*
|
|
587
|
+
* })();
|
|
588
|
+
*
|
|
589
|
+
* </script><pre>
|
|
590
|
+
*
|
|
564
591
|
*/
|
|
565
592
|
addPoints: function (p) {
|
|
566
593
|
var args = Array.prototype.slice.call(arguments);
|
|
@@ -569,44 +596,72 @@ define([
|
|
|
569
596
|
},
|
|
570
597
|
|
|
571
598
|
/**
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
599
|
+
* Insert points to the vertex list of the polygon after index <tt><idx</tt>.
|
|
600
|
+
* The attributes of new border segments are set to the same values
|
|
601
|
+
* as those used when the polygon was created.
|
|
602
|
+
* If new vertices are supplied by coordinates, the default attributes of polygon
|
|
603
|
+
* vertices are taken as their attributes. Therefore, the visual attributes of
|
|
604
|
+
* new vertices and borders may have to be adapted afterwards.
|
|
605
|
+
*
|
|
606
|
+
* @param {Number} idx The position after which the new vertices are inserted.
|
|
607
|
+
* Setting idx to -1 inserts the new points at the front, i.e. at position 0.
|
|
608
|
+
* @param {JXG.Point} p Arbitrary number of points or coordinate arrays to insert.
|
|
575
609
|
* @returns {JXG.Polygon} Reference to the polygon object
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* const board = JXG.JSXGraph.initBoard('jxgbox', {axis:true});
|
|
613
|
+
* var pg = board.create('polygon', [[1,2], [3,4], [-3,1]], {hasInnerPoints: true});
|
|
614
|
+
* var newPoint = board.create('point', [-1, -1]);
|
|
615
|
+
* pg.insertPoints(0, newPoint, newPoint, [1, -2]);
|
|
616
|
+
*
|
|
617
|
+
* </pre><div id="JXG17b84b2a-a851-4e3f-824f-7f6a60f166ca" class="jxgbox" style="width: 300px; height: 300px;"></div>
|
|
618
|
+
* <script type="text/javascript">
|
|
619
|
+
* (function() {
|
|
620
|
+
* var board = JXG.JSXGraph.initBoard('JXG17b84b2a-a851-4e3f-824f-7f6a60f166ca',
|
|
621
|
+
* {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
|
|
622
|
+
* const board = JXG.JSXGraph.initBoard('jxgbox', {axis:true});
|
|
623
|
+
* var pg = board.create('polygon', [[1,2], [3,4], [-3,1]], {hasInnerPoints: true});
|
|
624
|
+
* var newPoint = board.create('point', [-1, -1]);
|
|
625
|
+
* pg.insertPoints(0, newPoint, newPoint, [1, -2]);
|
|
626
|
+
*
|
|
627
|
+
* })();
|
|
628
|
+
*
|
|
629
|
+
* </script><pre>
|
|
630
|
+
*
|
|
576
631
|
*/
|
|
577
632
|
insertPoints: function (idx, p) {
|
|
578
|
-
var i,
|
|
633
|
+
var i, le;
|
|
579
634
|
|
|
580
635
|
if (arguments.length === 0) {
|
|
581
636
|
return this;
|
|
582
637
|
}
|
|
583
638
|
|
|
584
639
|
|
|
585
|
-
if (idx <
|
|
640
|
+
if (idx < -1 || idx > this.vertices.length - 2) {
|
|
586
641
|
return this;
|
|
587
642
|
}
|
|
588
643
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
644
|
+
le = arguments.length - 1;
|
|
645
|
+
for (i = 1; i < le + 1; i++) {
|
|
646
|
+
this.vertices.splice(idx + i, 0,
|
|
647
|
+
Type.providePoints(this.board, [arguments[i]], {}, 'polygon', ['vertices'])[0]
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
if (idx === -1) {
|
|
651
|
+
this.vertices[this.vertices.length - 1] = this.vertices[0];
|
|
593
652
|
}
|
|
594
|
-
|
|
595
|
-
tmp = this.vertices.slice(0, idx + 1).concat(npoints);
|
|
596
|
-
this.vertices = tmp.concat(this.vertices.slice(idx + 1));
|
|
597
|
-
|
|
598
653
|
if (this.withLines) {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
654
|
+
if (idx < 0) {
|
|
655
|
+
this.borders[this.borders.length - 1].point2 = this.vertices[this.vertices.length - 1];
|
|
656
|
+
} else {
|
|
657
|
+
this.borders[idx].point2 = this.vertices[idx + 1];
|
|
658
|
+
}
|
|
659
|
+
for (i = idx + 1; i < idx + 1 + le; i++) {
|
|
660
|
+
this.borders.splice(i, 0,
|
|
661
|
+
this.board.create('segment', [this.vertices[i], this.vertices[i + 1]], this.attr_line)
|
|
662
|
+
);
|
|
604
663
|
}
|
|
605
|
-
|
|
606
|
-
tmp.push(this.board.create('segment', [this.vertices[idx + npoints.length], this.vertices[idx + npoints.length + 1]], this.attr_line));
|
|
607
|
-
this.borders = tmp.concat(this.borders.slice(idx + 1));
|
|
608
664
|
}
|
|
609
|
-
|
|
610
665
|
this.board.update();
|
|
611
666
|
|
|
612
667
|
return this;
|
|
@@ -621,7 +676,7 @@ define([
|
|
|
621
676
|
var i, j, idx, nvertices = [], nborders = [],
|
|
622
677
|
nidx = [], partition = [];
|
|
623
678
|
|
|
624
|
-
//
|
|
679
|
+
// Partition:
|
|
625
680
|
// in order to keep the borders which could be recycled, we have to partition
|
|
626
681
|
// the set of removed points. I.e. if the points 1, 2, 5, 6, 7, 10 are removed,
|
|
627
682
|
// the partitions are
|
|
@@ -629,10 +684,10 @@ define([
|
|
|
629
684
|
// this gives us the borders, that can be removed and the borders we have to create.
|
|
630
685
|
|
|
631
686
|
|
|
632
|
-
//
|
|
687
|
+
// Remove the last vertex which is identical to the first
|
|
633
688
|
this.vertices = this.vertices.slice(0, this.vertices.length - 1);
|
|
634
689
|
|
|
635
|
-
//
|
|
690
|
+
// Collect all valid parameters as indices in nidx
|
|
636
691
|
for (i = 0; i < arguments.length; i++) {
|
|
637
692
|
idx = arguments[i];
|
|
638
693
|
if (Type.isPoint(idx)) {
|
|
@@ -644,22 +699,22 @@ define([
|
|
|
644
699
|
}
|
|
645
700
|
}
|
|
646
701
|
|
|
647
|
-
//
|
|
702
|
+
// Remove the polygon from each removed point's children
|
|
648
703
|
for (i = 0; i < nidx.length; i++) {
|
|
649
704
|
this.vertices[nidx[i]].removeChild(this);
|
|
650
705
|
}
|
|
651
706
|
|
|
652
|
-
//
|
|
707
|
+
// Sort the elements to be eliminated
|
|
653
708
|
nidx = nidx.sort();
|
|
654
709
|
nvertices = this.vertices.slice();
|
|
655
710
|
nborders = this.borders.slice();
|
|
656
711
|
|
|
657
|
-
//
|
|
712
|
+
// Initialize the partition
|
|
658
713
|
if (this.withLines) {
|
|
659
714
|
partition.push([nidx[nidx.length - 1]]);
|
|
660
715
|
}
|
|
661
716
|
|
|
662
|
-
//
|
|
717
|
+
// Run through all existing vertices and copy all remaining ones to nvertices,
|
|
663
718
|
// compute the partition
|
|
664
719
|
for (i = nidx.length - 1; i > -1; i--) {
|
|
665
720
|
nvertices[nidx[i]] = -1;
|
|
@@ -670,12 +725,12 @@ define([
|
|
|
670
725
|
}
|
|
671
726
|
}
|
|
672
727
|
|
|
673
|
-
//
|
|
728
|
+
// Finalize the partition computation
|
|
674
729
|
if (this.withLines) {
|
|
675
730
|
partition[partition.length - 1][1] = nidx[0];
|
|
676
731
|
}
|
|
677
732
|
|
|
678
|
-
//
|
|
733
|
+
// Update vertices
|
|
679
734
|
this.vertices = [];
|
|
680
735
|
for (i = 0; i < nvertices.length; i++) {
|
|
681
736
|
if (Type.isPoint(nvertices[i])) {
|
|
@@ -686,7 +741,7 @@ define([
|
|
|
686
741
|
this.vertices.push(this.vertices[0]);
|
|
687
742
|
}
|
|
688
743
|
|
|
689
|
-
//
|
|
744
|
+
// Delete obsolete and create missing borders
|
|
690
745
|
if (this.withLines) {
|
|
691
746
|
for (i = 0; i < partition.length; i++) {
|
|
692
747
|
for (j = partition[i][1] - 1; j < partition[i][0] + 1; j++) {
|
package/src/base/ticks.js
CHANGED
|
@@ -1267,6 +1267,8 @@ define([
|
|
|
1267
1267
|
attr.id = this.id + ld.i + 'Label' + this.labelCounter;
|
|
1268
1268
|
|
|
1269
1269
|
label = Text.createText(this.board, [ld.x, ld.y, ld.t], attr);
|
|
1270
|
+
this.addChild(label);
|
|
1271
|
+
label.setParents(this);
|
|
1270
1272
|
label.isDraggable = false;
|
|
1271
1273
|
label.dump = false;
|
|
1272
1274
|
this.labels.push(label);
|
|
@@ -1375,7 +1375,7 @@ define([
|
|
|
1375
1375
|
};
|
|
1376
1376
|
|
|
1377
1377
|
/**
|
|
1378
|
-
* @class Bisector lines are similar to {@link Bisector} but
|
|
1378
|
+
* @class Bisector lines are similar to {@link Bisector} but take two lines as parent elements. The resulting element is
|
|
1379
1379
|
* a composition of two lines.
|
|
1380
1380
|
* @pseudo
|
|
1381
1381
|
* @constructor
|
package/src/element/slider.js
CHANGED
|
@@ -463,6 +463,10 @@ define([
|
|
|
463
463
|
p2.dump = false;
|
|
464
464
|
l1.dump = false;
|
|
465
465
|
l2.dump = false;
|
|
466
|
+
if (withText) {
|
|
467
|
+
t.dump = false;
|
|
468
|
+
}
|
|
469
|
+
|
|
466
470
|
|
|
467
471
|
p3.elType = 'slider';
|
|
468
472
|
p3.parents = parents;
|
|
@@ -480,6 +484,14 @@ define([
|
|
|
480
484
|
p3.inherits.push(ti);
|
|
481
485
|
}
|
|
482
486
|
|
|
487
|
+
p3.getParents = function() {
|
|
488
|
+
return [
|
|
489
|
+
this.point1.coords.usrCoords.slice(1),
|
|
490
|
+
this.point2.coords.usrCoords.slice(1),
|
|
491
|
+
[this._smin, this.position * (this._smax - this._smin) + this._smin, this._smax]
|
|
492
|
+
];
|
|
493
|
+
};
|
|
494
|
+
|
|
483
495
|
p3.baseline.on('up', function(evt) {
|
|
484
496
|
var pos, c;
|
|
485
497
|
|
package/src/loadjsxgraph.js
CHANGED
|
@@ -55,10 +55,9 @@ var JXG = {},
|
|
|
55
55
|
//// ////
|
|
56
56
|
//// Attention! Slows down the loading time! ////
|
|
57
57
|
//////////////////////////////////////////////////////////////////////////
|
|
58
|
-
var preventCachingFiles = true
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var table,
|
|
58
|
+
var preventCachingFiles = true,
|
|
59
|
+
// check and table are initialized at the end of the life
|
|
60
|
+
table,
|
|
62
61
|
waitlist = [],
|
|
63
62
|
checkwaitlist = true,
|
|
64
63
|
checkJXG = function () {
|
|
@@ -146,6 +145,9 @@ var JXG = {},
|
|
|
146
145
|
////////////////////////////////////////////////////////////////////////////////
|
|
147
146
|
|
|
148
147
|
JXG.Load = (function () {
|
|
148
|
+
var requirePathLocation = 'href',
|
|
149
|
+
allowDocumentWrite = true;
|
|
150
|
+
|
|
149
151
|
function createHTMLElement(tagName, attr) {
|
|
150
152
|
var el = document.createElement(tagName), i,
|
|
151
153
|
a_name, a_value, a_object;
|
|
@@ -162,14 +164,10 @@ var JXG = {},
|
|
|
162
164
|
return el;
|
|
163
165
|
}
|
|
164
166
|
|
|
165
|
-
var allowDocumentWrite = true;
|
|
166
|
-
|
|
167
167
|
window.onload = function () {
|
|
168
168
|
allowDocumentWrite = false;
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
var requirePathLocation = 'href';
|
|
172
|
-
|
|
173
171
|
return {
|
|
174
172
|
requirePath: window.location.href,
|
|
175
173
|
|
|
@@ -298,7 +296,7 @@ var JXG = {},
|
|
|
298
296
|
xhr.open('POST', url, true);
|
|
299
297
|
xhr.send();
|
|
300
298
|
}(file));
|
|
301
|
-
}
|
|
299
|
+
}
|
|
302
300
|
};
|
|
303
301
|
})();
|
|
304
302
|
|
|
@@ -307,7 +305,7 @@ var JXG = {},
|
|
|
307
305
|
////////////////////////////////////////////////////////////////////////////////
|
|
308
306
|
|
|
309
307
|
// Has to be a String for Makefile!
|
|
310
|
-
JXG.Load.baseFiles = 'jxg,base/constants,utils/type,utils/xml,utils/env,utils/event,utils/expect,utils/color,math/probfuncs,math/math,math/ia,math/extrapolate,math/numerics,math/nlp,math/plot,math/metapost,math/statistics,math/symbolic,math/geometry,math/clip,math/poly,math/complex,renderer/abstract,renderer/no,reader/file,parser/geonext,base/board,options,jsxgraph,base/element,base/coordselement,base/coords,base/point,base/line,base/group,base/circle,element/conic,base/polygon,base/curve,element/arc,element/sector,base/composition,element/composition,base/text,base/image,element/slider,element/measure,base/chart,base/transformation,base/turtle,base/ticks,utils/zip,utils/base64,utils/uuid,utils/encoding,server/server,element/locus,parser/datasource,parser/ca,parser/jessiecode,utils/dump,renderer/svg,renderer/vml,renderer/canvas,renderer/no,element/comb,element/slopetriangle,math/qdt,element/checkbox,element/input,element/button,base/foreignobject';
|
|
308
|
+
JXG.Load.baseFiles = 'jxg,base/constants,utils/type,utils/xml,utils/env,utils/event,utils/expect,utils/color,math/probfuncs,math/math,math/ia,math/extrapolate,math/numerics,math/nlp,math/plot,math/metapost,math/statistics,math/symbolic,math/geometry,math/clip,math/poly,math/complex,renderer/abstract,renderer/no,reader/file,parser/geonext,base/board,options,jsxgraph,base/element,base/coordselement,base/coords,base/point,base/line,base/group,base/circle,element/conic,base/polygon,base/curve,element/arc,element/sector,base/composition,element/composition,base/text,base/image,element/slider,element/measure,base/chart,base/transformation,base/turtle,base/ticks,utils/zip,utils/base64,utils/uuid,utils/encoding,server/server,element/locus,parser/datasource,parser/ca,parser/jessiecode,utils/dump,renderer/svg,renderer/vml,renderer/canvas,renderer/no,element/comb,element/slopetriangle,math/qdt,element/checkbox,element/input,element/button,base/foreignobject,options3d,3d/threed,3d/view3d,3d/point3d,3d/curve3d,3d/surface3d,3d/linspace3d,3d/box3d';
|
|
311
309
|
JXG.Load.setRequirePathToScriptFile('loadjsxgraph.js');
|
|
312
310
|
JXG.Load.JSfiles(JXG.Load.baseFiles.split(','), preventCachingFiles);
|
|
313
311
|
JXG.Load.baseFiles = null;
|
|
@@ -403,6 +401,14 @@ var JXG = {},
|
|
|
403
401
|
'utils/type': checkJXG,
|
|
404
402
|
'utils/uuid': makeCheck('Util'),
|
|
405
403
|
'utils/xml': makeCheck('XML'),
|
|
406
|
-
'utils/zip': makeCheck('Util')
|
|
404
|
+
'utils/zip': makeCheck('Util'),
|
|
405
|
+
|
|
406
|
+
'3d/threed': checkJXG,
|
|
407
|
+
'3d/view3d': checkJXG,
|
|
408
|
+
'3d/point3d': checkJXG,
|
|
409
|
+
'3d/curve3d': checkJXG,
|
|
410
|
+
'3d/surface3d': checkJXG,
|
|
411
|
+
'3d/linspace3d': checkJXG
|
|
412
|
+
|
|
407
413
|
};
|
|
408
414
|
}());
|
package/src/math/geometry.js
CHANGED
|
@@ -2707,7 +2707,86 @@ define([
|
|
|
2707
2707
|
};
|
|
2708
2708
|
|
|
2709
2709
|
return [makeFct('X', 'cos'), makeFct('Y', 'sin'), 0, pi2];
|
|
2710
|
-
}
|
|
2710
|
+
},
|
|
2711
|
+
|
|
2712
|
+
|
|
2713
|
+
meet3Planes: function (n1, d1, n2, d2, n3, d3) {
|
|
2714
|
+
var p = [0, 0, 0],
|
|
2715
|
+
n31, n12, n23, denom,
|
|
2716
|
+
i;
|
|
2717
|
+
|
|
2718
|
+
n31 = Mat.crossProduct(n3, n1);
|
|
2719
|
+
n12 = Mat.crossProduct(n1, n2);
|
|
2720
|
+
n23 = Mat.crossProduct(n2, n3);
|
|
2721
|
+
denom = Mat.innerProduct(n1, n23, 3);
|
|
2722
|
+
for (i = 0; i < 3; i++) {
|
|
2723
|
+
p[i] = (d1 * n23[i] + d2 * n31[i] + d3 * n12[i]) / denom;
|
|
2724
|
+
}
|
|
2725
|
+
return p;
|
|
2726
|
+
},
|
|
2727
|
+
|
|
2728
|
+
|
|
2729
|
+
meetPlanePlane: function (v11, v12, v21, v22) {
|
|
2730
|
+
var i, no1, no2,
|
|
2731
|
+
v = [0, 0, 0],
|
|
2732
|
+
w = [0, 0, 0];
|
|
2733
|
+
|
|
2734
|
+
for (i = 0; i < 3; i++) {
|
|
2735
|
+
v[i] = Type.evaluate(v11[i]);
|
|
2736
|
+
w[i] = Type.evaluate(v12[i]);
|
|
2737
|
+
}
|
|
2738
|
+
no1 = Mat.crossProduct(v, w);
|
|
2739
|
+
|
|
2740
|
+
for (i = 0; i < 3; i++) {
|
|
2741
|
+
v[i] = Type.evaluate(v21[i]);
|
|
2742
|
+
w[i] = Type.evaluate(v22[i]);
|
|
2743
|
+
}
|
|
2744
|
+
no2 = Mat.crossProduct(v, w);
|
|
2745
|
+
|
|
2746
|
+
return Mat.crossProduct(no1, no2);
|
|
2747
|
+
},
|
|
2748
|
+
|
|
2749
|
+
project3DTo3DPlane: function (point, normal, foot) {
|
|
2750
|
+
// TODO: homogeneous 3D coordinates
|
|
2751
|
+
var sol = [0, 0, 0],
|
|
2752
|
+
le, d1, d2, lbda;
|
|
2753
|
+
|
|
2754
|
+
foot = foot || [0, 0, 0];
|
|
2755
|
+
|
|
2756
|
+
le = Mat.norm(normal);
|
|
2757
|
+
d1 = Mat.innerProduct(point, normal, 3);
|
|
2758
|
+
d2 = Mat.innerProduct(foot, normal, 3);
|
|
2759
|
+
// (point - lbda * normal / le) * normal / le == foot * normal / le
|
|
2760
|
+
// => (point * normal - foot * normal) == lbda * le
|
|
2761
|
+
lbda = (d1 - d2) / le;
|
|
2762
|
+
sol = Mat.axpy(-lbda, normal, point);
|
|
2763
|
+
|
|
2764
|
+
return sol;
|
|
2765
|
+
},
|
|
2766
|
+
|
|
2767
|
+
getPlaneBounds: function (v1, v2, q, s, e) {
|
|
2768
|
+
var s1, s2, e1, e2, mat, rhs, sol;
|
|
2769
|
+
|
|
2770
|
+
if (v1[2] + v2[0] !== 0) {
|
|
2771
|
+
mat = [
|
|
2772
|
+
[v1[0], v2[0]],
|
|
2773
|
+
[v1[1], v2[1]]
|
|
2774
|
+
];
|
|
2775
|
+
rhs = [s - q[0], s - q[1]];
|
|
2776
|
+
|
|
2777
|
+
sol = Numerics.Gauss(mat, rhs);
|
|
2778
|
+
s1 = sol[0];
|
|
2779
|
+
s2 = sol[1];
|
|
2780
|
+
|
|
2781
|
+
rhs = [e - q[0], e - q[1]];
|
|
2782
|
+
sol = Numerics.Gauss(mat, rhs);
|
|
2783
|
+
e1 = sol[0];
|
|
2784
|
+
e2 = sol[1];
|
|
2785
|
+
return [s1, e1, s2, e2];
|
|
2786
|
+
}
|
|
2787
|
+
return null;
|
|
2788
|
+
},
|
|
2789
|
+
|
|
2711
2790
|
});
|
|
2712
2791
|
|
|
2713
2792
|
return Mat.Geometry;
|
package/src/math/math.js
CHANGED
|
@@ -466,6 +466,15 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
|
|
|
466
466
|
return Math.sqrt(sum);
|
|
467
467
|
},
|
|
468
468
|
|
|
469
|
+
axpy: function (a, x, y) {
|
|
470
|
+
var i, le = x.length,
|
|
471
|
+
p = [];
|
|
472
|
+
for (i = 0; i < le; i++) {
|
|
473
|
+
p[i] = a * x[i] + y[i];
|
|
474
|
+
}
|
|
475
|
+
return p;
|
|
476
|
+
},
|
|
477
|
+
|
|
469
478
|
/**
|
|
470
479
|
* Compute the factorial of a positive integer. If a non-integer value
|
|
471
480
|
* is given, the fraction will be ignored.
|
package/src/options.js
CHANGED
|
@@ -783,6 +783,10 @@ define([
|
|
|
783
783
|
* visible: false // Initial visibility. Should be set to false always
|
|
784
784
|
* }
|
|
785
785
|
* </pre>
|
|
786
|
+
* <p>
|
|
787
|
+
* Board events triggered by selection manipulation:
|
|
788
|
+
* 'startselecting', 'stopselecting', 'mousestartselecting', 'mousestopselecting',
|
|
789
|
+
* 'pointerstartselecting', 'pointerstopselecting', 'touchstartselecting', 'touchstopselecting'.
|
|
786
790
|
*
|
|
787
791
|
* @example
|
|
788
792
|
* board.on('stopselecting', function(){
|
|
@@ -796,14 +800,10 @@ define([
|
|
|
796
800
|
* });
|
|
797
801
|
*
|
|
798
802
|
* @name JXG.Board#selection
|
|
799
|
-
*
|
|
800
|
-
* @see JXG.Board#
|
|
801
|
-
* @see JXG.Board#
|
|
802
|
-
*
|
|
803
|
-
* @see JXG.Board#touchstartselecting
|
|
804
|
-
* @see JXG.Board#mousestopselecting
|
|
805
|
-
* @see JXG.Board#pointerstopselecting
|
|
806
|
-
* @see JXG.Board#touchstopselecting
|
|
803
|
+
*
|
|
804
|
+
* @see JXG.Board#startSelectionMode
|
|
805
|
+
* @see JXG.Board#stopSelectionMode
|
|
806
|
+
*
|
|
807
807
|
* @type Object
|
|
808
808
|
* @default
|
|
809
809
|
*/
|
package/src/options3d.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*global JXG:true, define: true*/
|
|
2
|
+
|
|
3
|
+
define([
|
|
4
|
+
'jxg', 'options'
|
|
5
|
+
], function (JXG, Options) {
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
JXG.extend(Options, {
|
|
10
|
+
|
|
11
|
+
infobox: {
|
|
12
|
+
strokeColor: 'black'
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
axes3d: {
|
|
16
|
+
axesPosition: 'center', // Possible values: 'center', otherwise: border
|
|
17
|
+
|
|
18
|
+
// Main axes
|
|
19
|
+
xAxis: { visible: true, point2: {name: 'x'}},
|
|
20
|
+
yAxis: { visible: true, point2: {name: 'y'}},
|
|
21
|
+
zAxis: { visible: true, point2: {name: 'z'}},
|
|
22
|
+
|
|
23
|
+
// Planes
|
|
24
|
+
xPlaneRear: { visible: true, layer: 0, mesh3d: { layer: 1 } },
|
|
25
|
+
yPlaneRear: { visible: true, layer: 0, mesh3d: { layer: 1 } },
|
|
26
|
+
zPlaneRear: { visible: true, layer: 0, mesh3d: { layer: 1 } },
|
|
27
|
+
|
|
28
|
+
xPlaneFront: { visible: false, layer: 0, mesh3d: { layer: 1 } },
|
|
29
|
+
yPlaneFront: { visible: false, layer: 0, mesh3d: { layer: 1 } },
|
|
30
|
+
zPlaneFront: { visible: false, layer: 0, mesh3d: { layer: 1 } },
|
|
31
|
+
|
|
32
|
+
// Axes on the planes
|
|
33
|
+
xPlaneRearYAxis: {visible: true, strokeColor: '#888888'},
|
|
34
|
+
xPlaneRearZAxis: {visible: true, strokeColor: '#888888'},
|
|
35
|
+
xPlaneFrontYAxis: {visible: false, strokeColor: '#888888'},
|
|
36
|
+
xPlaneFrontZAxis: {visible: false, strokeColor: '#888888'},
|
|
37
|
+
|
|
38
|
+
yPlaneRearXAxis: {visible: true, strokeColor: '#888888'},
|
|
39
|
+
yPlaneRearZAxis: {visible: true, strokeColor: '#888888'},
|
|
40
|
+
yPlaneFrontXAxis: {visible: false, strokeColor: '#888888'},
|
|
41
|
+
yPlaneFrontZAxis: {visible: false, strokeColor: '#888888'},
|
|
42
|
+
|
|
43
|
+
zPlaneRearXAxis: {visible: true, strokeColor: '#888888'},
|
|
44
|
+
zPlaneRearYAxis: {visible: true, strokeColor: '#888888'},
|
|
45
|
+
zPlaneFrontXAxis: {visible: false, strokeColor: '#888888'},
|
|
46
|
+
zPlaneFrontYAxis: {visible: false, strokeColor: '#888888'}
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
axis3d: {
|
|
51
|
+
highlight: false,
|
|
52
|
+
strokecolor: 'black',
|
|
53
|
+
strokeWidth: 1,
|
|
54
|
+
tabindex: null,
|
|
55
|
+
|
|
56
|
+
point1: { visible: false, name: '' },
|
|
57
|
+
point2: { visible: false, name: '', label: { visible: true } }
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
mesh3d: {
|
|
61
|
+
strokeWidth: 1,
|
|
62
|
+
strokeColor: '#9a9a9a',
|
|
63
|
+
strokeOpacity: 0.6,
|
|
64
|
+
highlight: false,
|
|
65
|
+
fillColor: '#9a9a9a',
|
|
66
|
+
fillOpacity: 0.1,
|
|
67
|
+
tabindex: null,
|
|
68
|
+
|
|
69
|
+
visible: 'inherit'
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
line3d: {
|
|
73
|
+
strokeWidth: 1,
|
|
74
|
+
strokeColor: 'black',
|
|
75
|
+
fixed: true,
|
|
76
|
+
tabindex: null,
|
|
77
|
+
|
|
78
|
+
gradient: 'linear',
|
|
79
|
+
gradientSecondColor: '#ffffff',
|
|
80
|
+
|
|
81
|
+
point1: {visible: false, name: ''},
|
|
82
|
+
point2: {visible: false, name: ''}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
plane3d: {
|
|
86
|
+
strokeWidth: 0,
|
|
87
|
+
strokeColor: 'black',
|
|
88
|
+
strokeOpacity: 1,
|
|
89
|
+
highlight: false,
|
|
90
|
+
tabindex: null,
|
|
91
|
+
|
|
92
|
+
gradient: 'linear',
|
|
93
|
+
gradientSecondColor: '#ffffff',
|
|
94
|
+
gradientAngle: Math.PI,
|
|
95
|
+
fillColor: '#a7a7a7',
|
|
96
|
+
fillOpacity: 0.6
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
point3d: {
|
|
100
|
+
strokeWidth: 0,
|
|
101
|
+
gradient: 'radial',
|
|
102
|
+
gradientSecondColor: '#555555',
|
|
103
|
+
fillColor: 'yellow',
|
|
104
|
+
highlightStrokeColor: '#555555'
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
surface3d: {
|
|
108
|
+
highlight: false,
|
|
109
|
+
tabindex: -1,
|
|
110
|
+
strokeWidth: 1,
|
|
111
|
+
stepsU: 30,
|
|
112
|
+
stepsV: 30
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
view3d: {
|
|
116
|
+
needsRegularUpdate: true
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return JXG.Options;
|
|
122
|
+
});
|
|
123
|
+
|
package/src/reader/sketch.js
CHANGED
|
@@ -886,7 +886,7 @@ Copyright 2008-2022
|
|
|
886
886
|
str1[i] = pn(step.args.p1[i]);
|
|
887
887
|
}
|
|
888
888
|
|
|
889
|
-
set_str = 'point(' + str1.join(', ') + ') <<id: \'' + pid1 + '\', name: \'\', visible: false, ';
|
|
889
|
+
set_str = 'point(' + str1.join(', ') + ') <<id: \'' + pid1 + '\', name: \'\', visible: false, isinfinit: true, ';
|
|
890
890
|
set_str += 'snaptogrid: false, snaptopoints: false, priv: true>>; ';
|
|
891
891
|
reset_str = 'remove(' + pid1 + '); ';
|
|
892
892
|
} else {
|
|
@@ -901,7 +901,7 @@ Copyright 2008-2022
|
|
|
901
901
|
str1[i] = pn(step.args.p2[i]);
|
|
902
902
|
}
|
|
903
903
|
|
|
904
|
-
set_str += 'point(' + str1.join(', ') + ') <<id: \'' + pid2 + '\', name: \'\', visible: false, ';
|
|
904
|
+
set_str += 'point(' + str1.join(', ') + ') <<id: \'' + pid2 + '\', name: \'\', visible: false, isinfinit: true, ';
|
|
905
905
|
set_str += 'snaptogrid: false, snaptopoints: false, priv: true>>; ';
|
|
906
906
|
reset_str = 'remove(' + pid2 + '); ' + reset_str;
|
|
907
907
|
} else {
|
package/src/utils/type.js
CHANGED
|
@@ -977,7 +977,7 @@ define([
|
|
|
977
977
|
}
|
|
978
978
|
|
|
979
979
|
// options from attributes
|
|
980
|
-
o = attributes;
|
|
980
|
+
o = (typeof attributes === 'object') ? attributes : {};
|
|
981
981
|
isAvail = true;
|
|
982
982
|
for (i = 3; i < len; i++) {
|
|
983
983
|
if (this.exists(o[arguments[i]])) {
|
|
@@ -1283,7 +1283,7 @@ define([
|
|
|
1283
1283
|
return html_sanitize(str, function () { return undefined; }, function (id) { return id; });
|
|
1284
1284
|
}
|
|
1285
1285
|
|
|
1286
|
-
if (str) {
|
|
1286
|
+
if (str && typeof str === 'string') {
|
|
1287
1287
|
str = str.replace(/</g, '<').replace(/>/g, '>');
|
|
1288
1288
|
}
|
|
1289
1289
|
|