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
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
1.14.1
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
Improvements
|
|
5
|
+
------------
|
|
6
|
+
|
|
7
|
+
- API docs: various additions and improvements
|
|
8
|
+
- TypeScript: add missing entry to index.d.ts
|
|
9
|
+
- Print warning to console if a 3D element is removed with board.removeObject() instead of view3d.removeObject()
|
|
10
|
+
- sphere3d: treat parallel and central projection simultaneously
|
|
11
|
+
- Repository: move folder `./src/unused` to `./src_unused`
|
|
12
|
+
|
|
13
|
+
Bug fixes
|
|
14
|
+
---------
|
|
15
|
+
|
|
16
|
+
- Correct resizing of JSXGraph boards that are invisible or hidden at initialization time
|
|
17
|
+
- `removeObject()` of 3D elements
|
|
18
|
+
- Regression in svg.js: setLayer()
|
|
19
|
+
- line3d child elements were added twice
|
|
20
|
+
- canvas renderer: updateGradientCircle()
|
|
21
|
+
- circle.getBoundingBox()
|
|
22
|
+
- Throw error if if intersectionline3d is used wrong
|
|
23
|
+
- Catch non-integer parameters in JXG.Math.gcd()
|
|
24
|
+
- Fix logical test in `JXG.Math.Numerics.GaussLegendre`
|
|
25
|
+
- Type.mergeAttr setting of default parameters
|
|
26
|
+
- Set default attributes in createHTMLSlider
|
|
27
|
+
- Handle missing parameter config in `JXG.Math.Numerics.Romberg()`
|
|
28
|
+
- Typo in sector of parallel lines
|
|
29
|
+
- `Type.trimNumber()` of `100` and `0`
|
|
30
|
+
|
|
1
31
|
1.14.0
|
|
2
32
|
===
|
|
3
33
|
|
|
@@ -22,7 +52,7 @@ If a defining point for one of these elements is supplied as coordinate array an
|
|
|
22
52
|
|
|
23
53
|
*Changes:*
|
|
24
54
|
|
|
25
|
-
- These parent points are now invisible by default and have the empty string `''` as name.
|
|
55
|
+
- These parent points are now invisible by default and have the empty string `''` as name.
|
|
26
56
|
- Their attributes can be changed later by changeing the corresponding sub-object, e.g.
|
|
27
57
|
`sector.radiusPoint.setAttribute({visible: false});`
|
|
28
58
|
|
|
@@ -54,7 +84,7 @@ Bug fixes
|
|
|
54
84
|
- Fix regression: missing strokeColor of polygon
|
|
55
85
|
- Fix resource ID collisions for anonymous containers
|
|
56
86
|
- Fix two security issues
|
|
57
|
-
|
|
87
|
+
|
|
58
88
|
1.13.2
|
|
59
89
|
===
|
|
60
90
|
|
|
@@ -89,7 +119,7 @@ Bug fixes
|
|
|
89
119
|
- Curves with transposed input
|
|
90
120
|
- JXG.GeometryElement3D.setAttribute()
|
|
91
121
|
- Fix media query listener cleanup
|
|
92
|
-
|
|
122
|
+
|
|
93
123
|
1.13.1
|
|
94
124
|
===
|
|
95
125
|
|
|
@@ -754,8 +754,8 @@ JXG.createLine3D = function (board, parents, attributes) {
|
|
|
754
754
|
* @private
|
|
755
755
|
*/
|
|
756
756
|
el.endpoints = endpoints;
|
|
757
|
-
el.addChild(endpoints[0]);
|
|
758
|
-
el.addChild(endpoints[1]);
|
|
757
|
+
// el.addChild(endpoints[0]); // Is done below
|
|
758
|
+
// el.addChild(endpoints[1]);
|
|
759
759
|
// el.setParents(endpoints);
|
|
760
760
|
el.addParents([point1, point2]);
|
|
761
761
|
|
|
@@ -2102,18 +2102,24 @@ JXG.createIntersectionLine3D = function (board, parents, attributes) {
|
|
|
2102
2102
|
var view = parents[0],
|
|
2103
2103
|
el1 = parents[1],
|
|
2104
2104
|
el2 = parents[2],
|
|
2105
|
-
ixnLine, i,//
|
|
2105
|
+
ixnLine, i,// f,
|
|
2106
2106
|
attr = Type.copyAttributes(attributes, board.options, 'intersectionline3d'),
|
|
2107
2107
|
pts = [];
|
|
2108
2108
|
|
|
2109
|
-
// func = Geometry.intersectionFunction3D(view, el1, el2);
|
|
2109
|
+
// var func = Geometry.intersectionFunction3D(view, el1, el2);
|
|
2110
2110
|
for (i = 0; i < 2; i++) {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2111
|
+
try {
|
|
2112
|
+
pts[i] = view.create('point3d', [
|
|
2113
|
+
// Use closures
|
|
2114
|
+
(function (ii) {
|
|
2115
|
+
return function () { return Geometry.intersectionFunction3D(view, el1, el2)[ii]; };
|
|
2116
|
+
})(i)
|
|
2117
|
+
], attr['point' + (i + 1)]);
|
|
2118
|
+
} catch (err) {
|
|
2119
|
+
throw new Error(
|
|
2120
|
+
"JSXGraph: Can't create IntersectionLine3D from the intersection of these types. Please check the intersecting elements."
|
|
2121
|
+
);
|
|
2122
|
+
}
|
|
2117
2123
|
}
|
|
2118
2124
|
ixnLine = view.create('line3d', pts, attr);
|
|
2119
2125
|
|
|
@@ -563,8 +563,6 @@ JXG.extend(
|
|
|
563
563
|
}
|
|
564
564
|
},
|
|
565
565
|
|
|
566
|
-
|
|
567
|
-
|
|
568
566
|
/**
|
|
569
567
|
* Starts an animated point movement towards the given coordinates `where`.
|
|
570
568
|
* The animation is done after `time` milliseconds.
|
|
@@ -786,9 +784,6 @@ JXG.extend(
|
|
|
786
784
|
});
|
|
787
785
|
},
|
|
788
786
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
787
|
// Not yet working
|
|
793
788
|
__evt__update3D: function (oc) { }
|
|
794
789
|
}
|
|
@@ -237,28 +237,52 @@ JXG.extend(
|
|
|
237
237
|
JXG.Sphere3D.prototype,
|
|
238
238
|
/** @lends JXG.Sphere3D.prototype */ {
|
|
239
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Returns the x-coordinate of the sphere given as parametric surface for parameters `u` and `v`.
|
|
242
|
+
* @param {Number} u
|
|
243
|
+
* @param {Number} v
|
|
244
|
+
* @returns {Number} x-coordinate
|
|
245
|
+
*/
|
|
240
246
|
X: function(u, v) {
|
|
241
247
|
var r = this.Radius();
|
|
242
248
|
return r * Math.sin(u) * Math.cos(v);
|
|
243
249
|
},
|
|
244
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Returns the y-coordinate of the sphere given as parametric surface for parameters `u` and `v`.
|
|
253
|
+
* @param {Number} u
|
|
254
|
+
* @param {Number} v
|
|
255
|
+
* @returns {Number} y-coordinate
|
|
256
|
+
*/
|
|
245
257
|
Y: function(u, v) {
|
|
246
258
|
var r = this.Radius();
|
|
247
259
|
return r * Math.sin(u) * Math.sin(v);
|
|
248
260
|
},
|
|
249
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Returns the z-coordinate of the sphere given as parametric surface for parameters `u` and `v`.
|
|
264
|
+
* @param {Number} u
|
|
265
|
+
* @param {Number} v
|
|
266
|
+
* @returns {Number} z-coordinate
|
|
267
|
+
*/
|
|
250
268
|
Z: function(u, v) {
|
|
251
269
|
var r = this.Radius();
|
|
252
270
|
return r * Math.cos(u);
|
|
253
271
|
},
|
|
254
272
|
|
|
273
|
+
/**
|
|
274
|
+
* The parameter range of `u`
|
|
275
|
+
* @type {Array}
|
|
276
|
+
*/
|
|
255
277
|
range_u: [0, 2 * Math.PI],
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* The parameter range of `v`
|
|
281
|
+
* @type {Array}
|
|
282
|
+
*/
|
|
256
283
|
range_v: [0, Math.PI],
|
|
257
284
|
|
|
258
285
|
update: function () {
|
|
259
|
-
if (this.projectionType !== this.view.projectionType) {
|
|
260
|
-
this.rebuildProjection();
|
|
261
|
-
}
|
|
262
286
|
return this;
|
|
263
287
|
},
|
|
264
288
|
|
|
@@ -306,34 +330,55 @@ JXG.extend(
|
|
|
306
330
|
return NaN;
|
|
307
331
|
},
|
|
308
332
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
333
|
+
/**
|
|
334
|
+
* The central projection of a sphere is an ellipse. The front and back
|
|
335
|
+
* points of the sphere -- that is, the points closest to and furthest
|
|
336
|
+
* from the screen -- project to the foci of the ellipse.
|
|
337
|
+
*
|
|
338
|
+
* To see this, look at the cone tangent to the sphere whose tip is at
|
|
339
|
+
* the camera. The image of the sphere is the ellipse where this cone
|
|
340
|
+
* intersects the screen. By acting on the sphere with scalings centered
|
|
341
|
+
* on the camera, you can send it to either of the Dandelin spheres that
|
|
342
|
+
* touch the screen at the foci of the image ellipse.
|
|
343
|
+
*
|
|
344
|
+
* This factory method produces two functions, `focusFn(-1)` and
|
|
345
|
+
* `focusFn(1)`, that evaluate to the projections of the front and back
|
|
346
|
+
* points of the sphere, respectively.
|
|
347
|
+
*
|
|
348
|
+
* The parallel projection of a sphere is a cicle. We use an ellipse curve
|
|
349
|
+
* for this projection, too. The two focii now coincide with the center of
|
|
350
|
+
* the sphere. The 2D radius point is defined by the projection of the center
|
|
351
|
+
* and the projected radius.
|
|
352
|
+
* @param {Number} sgn Expecst -1 or 1 for the two focus points
|
|
353
|
+
* @returns {Array} 2D coordinates of the projected focus point
|
|
354
|
+
*
|
|
355
|
+
*/
|
|
322
356
|
focusFn: function (sgn) {
|
|
323
357
|
var that = this;
|
|
324
358
|
|
|
325
359
|
return function () {
|
|
326
|
-
var camDir
|
|
360
|
+
var camDir,
|
|
361
|
+
v = (that.view.projectionType === 'central') ? 1 : 0,
|
|
327
362
|
r = that.Radius();
|
|
328
363
|
|
|
364
|
+
// Parallel projection: v === 0, the two focii coincide with the center
|
|
365
|
+
// Central projection: v === 1
|
|
366
|
+
camDir = (v === 0) ? [0, 0, 0, 0] : that.view.boxToCam[3];
|
|
367
|
+
|
|
329
368
|
return that.view.project3DTo2D([
|
|
330
|
-
that.center.X() + sgn * r * camDir[1],
|
|
331
|
-
that.center.Y() + sgn * r * camDir[2],
|
|
332
|
-
that.center.Z() + sgn * r * camDir[3]
|
|
369
|
+
that.center.X() + v * sgn * r * camDir[1],
|
|
370
|
+
that.center.Y() + v * sgn * r * camDir[2],
|
|
371
|
+
that.center.Z() + v * sgn * r * camDir[3]
|
|
333
372
|
]).slice(1, 3);
|
|
334
373
|
};
|
|
335
374
|
},
|
|
336
375
|
|
|
376
|
+
// Replace our 2D representation with a new one that's consistent with
|
|
377
|
+
// the view's current projection type
|
|
378
|
+
/**
|
|
379
|
+
*
|
|
380
|
+
* @returns {Array} 2D coordinates of the projected 3rd point that is on the ellipse.
|
|
381
|
+
*/
|
|
337
382
|
innerVertexFn: function () {
|
|
338
383
|
var that = this;
|
|
339
384
|
|
|
@@ -343,6 +388,7 @@ JXG.extend(
|
|
|
343
388
|
distOffAxis = Mat.hypot(p[0], p[1]),
|
|
344
389
|
cam = view.boxToCam,
|
|
345
390
|
r = that.Radius(),
|
|
391
|
+
c, bs,
|
|
346
392
|
angleOffAxis = Math.atan(-distOffAxis / p[2]),
|
|
347
393
|
steepness = Math.acos(r / Mat.norm(p)),
|
|
348
394
|
lean = angleOffAxis + steepness,
|
|
@@ -350,6 +396,22 @@ JXG.extend(
|
|
|
350
396
|
sin_lean = Math.sin(lean),
|
|
351
397
|
inward;
|
|
352
398
|
|
|
399
|
+
// Do parallel projection
|
|
400
|
+
if (that.view.projectionType !== 'central') {
|
|
401
|
+
bs = view.bbox3D[0][1] - view.bbox3D[0][0];
|
|
402
|
+
r *= view.size[0] / bs;
|
|
403
|
+
|
|
404
|
+
c = view.project3DTo2D([
|
|
405
|
+
that.center.X(),
|
|
406
|
+
that.center.Y(),
|
|
407
|
+
that.center.Z()
|
|
408
|
+
]);
|
|
409
|
+
c[1] += r;
|
|
410
|
+
|
|
411
|
+
return c;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Do central projection
|
|
353
415
|
if (distOffAxis > 1e-8) {
|
|
354
416
|
// if the center of the sphere isn't too close to the camera
|
|
355
417
|
// axis, find the direction in plane of the screen that
|
|
@@ -374,7 +436,15 @@ JXG.extend(
|
|
|
374
436
|
};
|
|
375
437
|
},
|
|
376
438
|
|
|
377
|
-
|
|
439
|
+
/**
|
|
440
|
+
* Create 2D helper points and an ellipse to visualize the `sphere3d`.
|
|
441
|
+
* Handles central and parallel projection simultaneously.
|
|
442
|
+
*
|
|
443
|
+
* This is done only once at creation time.
|
|
444
|
+
*
|
|
445
|
+
* @param {object} attr Attributes for the sphere objects
|
|
446
|
+
*/
|
|
447
|
+
buildProjection: function (attr) {
|
|
378
448
|
var view = this.view,
|
|
379
449
|
auxStyle = { visible: false, withLabel: false },
|
|
380
450
|
frontFocus = view.create('point', this.focusFn(-1), auxStyle),
|
|
@@ -383,53 +453,6 @@ JXG.extend(
|
|
|
383
453
|
|
|
384
454
|
this.aux2D = [frontFocus, backFocus, innerVertex];
|
|
385
455
|
this.element2D = view.create('ellipse', this.aux2D, attr === undefined ? this.visProp : attr);
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
buildParallelProjection: function (attr) {
|
|
389
|
-
// The parallel projection of a sphere is a circle
|
|
390
|
-
var that = this,
|
|
391
|
-
// center2d = function () {
|
|
392
|
-
// var c3d = [1, that.center.X(), that.center.Y(), that.center.Z()];
|
|
393
|
-
// return that.view.project3DTo2D(c3d);
|
|
394
|
-
// },
|
|
395
|
-
radius2d = function () {
|
|
396
|
-
var boxSize = that.view.bbox3D[0][1] - that.view.bbox3D[0][0];
|
|
397
|
-
return that.Radius() * that.view.size[0] / boxSize;
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
this.aux2D = [];
|
|
401
|
-
this.element2D = this.view.create(
|
|
402
|
-
'circle',
|
|
403
|
-
// [center2d, radius2d],
|
|
404
|
-
[that.center.element2D, radius2d],
|
|
405
|
-
attr === undefined ? this.visProp : attr
|
|
406
|
-
);
|
|
407
|
-
},
|
|
408
|
-
|
|
409
|
-
// replace our 2D representation with a new one that's consistent with
|
|
410
|
-
// the view's current projection type
|
|
411
|
-
rebuildProjection: function (attr) {
|
|
412
|
-
var i;
|
|
413
|
-
|
|
414
|
-
// remove the old 2D representation from the scene tree
|
|
415
|
-
if (this.element2D) {
|
|
416
|
-
this.view.board.removeObject(this.element2D);
|
|
417
|
-
for (i in this.aux2D) {
|
|
418
|
-
if (this.aux2D.hasOwnProperty(i)) {
|
|
419
|
-
this.view.board.removeObject(this.aux2D[i]);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// build a new 2D representation. the representation is stored in
|
|
425
|
-
// `this.element2D`, and any auxiliary elements are stored in
|
|
426
|
-
// `this.aux2D`
|
|
427
|
-
this.projectionType = this.view.projectionType;
|
|
428
|
-
if (this.projectionType === 'central') {
|
|
429
|
-
this.buildCentralProjection(attr);
|
|
430
|
-
} else {
|
|
431
|
-
this.buildParallelProjection(attr);
|
|
432
|
-
}
|
|
433
456
|
|
|
434
457
|
// attach the new 2D representation to the scene tree
|
|
435
458
|
this.addChild(this.element2D);
|
|
@@ -723,7 +746,7 @@ JXG.createSphere3D = function (board, parents, attributes) {
|
|
|
723
746
|
// to the correct initial state
|
|
724
747
|
// Here, element2D is created.
|
|
725
748
|
attr = el.setAttr2D(attr);
|
|
726
|
-
el.
|
|
749
|
+
el.buildProjection(attr);
|
|
727
750
|
|
|
728
751
|
el.element2D.prepareUpdate().update();
|
|
729
752
|
if (!board.isSuspendedUpdate) {
|
|
@@ -1124,7 +1124,7 @@ JXG.extend(
|
|
|
1124
1124
|
},
|
|
1125
1125
|
|
|
1126
1126
|
removeObject: function (object, saveMethod) {
|
|
1127
|
-
var i, el, le, o, fst, face;
|
|
1127
|
+
var i, el, le, o, fst, face, gone, list;
|
|
1128
1128
|
|
|
1129
1129
|
// this.board.removeObject(object, saveMethod);
|
|
1130
1130
|
if (Type.isArray(object)) {
|
|
@@ -1136,8 +1136,8 @@ JXG.extend(
|
|
|
1136
1136
|
|
|
1137
1137
|
object = this.select(object);
|
|
1138
1138
|
|
|
1139
|
-
//
|
|
1140
|
-
//
|
|
1139
|
+
// If the object which is about to be removed unknown or a string, do nothing.
|
|
1140
|
+
// it is a string if a string was given and could not be resolved to an element.
|
|
1141
1141
|
if (!Type.exists(object) || Type.isString(object)) {
|
|
1142
1142
|
return this;
|
|
1143
1143
|
}
|
|
@@ -1146,38 +1146,46 @@ JXG.extend(
|
|
|
1146
1146
|
// Remove all children.
|
|
1147
1147
|
for (el in object.childElements) {
|
|
1148
1148
|
if (object.childElements.hasOwnProperty(el)) {
|
|
1149
|
-
|
|
1149
|
+
o = object.childElements[el];
|
|
1150
|
+
if (!(object.is3D && object.element2D === o)) {
|
|
1151
|
+
this.removeObject(o);
|
|
1152
|
+
}
|
|
1150
1153
|
}
|
|
1151
1154
|
}
|
|
1152
1155
|
if (object.type === Const.OBJECT_TYPE_POLYHEDRON3D) {
|
|
1153
1156
|
// Special treatment for polyhedron3d.
|
|
1154
1157
|
// With this we can avoid the time consuming addChild() calls.
|
|
1158
|
+
// Mark faces and their 2D elements, then compact objectsList once.
|
|
1159
|
+
// Splicing face by face with stale _pos removed unrelated elements.
|
|
1160
|
+
gone = {};
|
|
1155
1161
|
le = object.faces.length;
|
|
1156
|
-
if (le > 0) {
|
|
1157
|
-
fst = object.faces[0]._pos;
|
|
1158
|
-
fst = (object.faces[0].element2D._pos < fst) ? object.faces[0].element2D._pos : fst;
|
|
1159
|
-
}
|
|
1160
1162
|
for (i = 0; i < le; i++) {
|
|
1161
1163
|
face = object.faces[i];
|
|
1162
1164
|
delete this.objects[face.id];
|
|
1163
1165
|
|
|
1164
|
-
// this.board.removeObject(face.element2D, saveMethod);
|
|
1165
1166
|
delete this.board.objects[face.element2D.id];
|
|
1166
1167
|
delete this.board.elementsByName[face.element2D.name];
|
|
1167
1168
|
face.element2D.remove();
|
|
1168
|
-
|
|
1169
|
+
gone[face.element2D.id] = true;
|
|
1170
|
+
face.element2D._pos = -1;
|
|
1169
1171
|
|
|
1170
1172
|
delete this.board.objects[face.id];
|
|
1171
1173
|
delete this.board.elementsByName[face.name];
|
|
1172
1174
|
face.remove();
|
|
1173
|
-
|
|
1175
|
+
gone[face.id] = true;
|
|
1176
|
+
face._pos = -1;
|
|
1174
1177
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
for (i =
|
|
1178
|
-
o =
|
|
1179
|
-
if (o.
|
|
1178
|
+
list = this.board.objectsList;
|
|
1179
|
+
fst = 0;
|
|
1180
|
+
for (i = 0; i < list.length; i++) {
|
|
1181
|
+
o = list[i];
|
|
1182
|
+
if (!gone.hasOwnProperty(o.id)) {
|
|
1183
|
+
o._pos = fst;
|
|
1184
|
+
list[fst] = o;
|
|
1185
|
+
fst++;
|
|
1186
|
+
}
|
|
1180
1187
|
}
|
|
1188
|
+
list.length = fst;
|
|
1181
1189
|
object.faces = [];
|
|
1182
1190
|
}
|
|
1183
1191
|
|
package/distrib/docs/Angle.html
CHANGED
|
@@ -1568,7 +1568,7 @@ one.</p></dd>
|
|
|
1568
1568
|
|
|
1569
1569
|
<dt class="tag-source">Source</dt>
|
|
1570
1570
|
<dd class="tag-source">
|
|
1571
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
1571
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line1776">line 1776</a>
|
|
1572
1572
|
</dd>
|
|
1573
1573
|
|
|
1574
1574
|
|
|
@@ -1638,7 +1638,7 @@ Alias for Sector#radiuspoint.</p></dd>
|
|
|
1638
1638
|
|
|
1639
1639
|
<dt class="tag-source">Source</dt>
|
|
1640
1640
|
<dd class="tag-source">
|
|
1641
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
1641
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line1422">line 1422</a>
|
|
1642
1642
|
</dd>
|
|
1643
1643
|
|
|
1644
1644
|
|
|
@@ -1707,7 +1707,7 @@ Alias for Sector#radiuspoint.</p></dd>
|
|
|
1707
1707
|
|
|
1708
1708
|
<dt class="tag-source">Source</dt>
|
|
1709
1709
|
<dd class="tag-source">
|
|
1710
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
1710
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line1432">line 1432</a>
|
|
1711
1711
|
</dd>
|
|
1712
1712
|
|
|
1713
1713
|
|
|
@@ -2013,7 +2013,7 @@ console.log(ang.L());
|
|
|
2013
2013
|
|
|
2014
2014
|
<dt class="tag-source">Source</dt>
|
|
2015
2015
|
<dd class="tag-source">
|
|
2016
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
2016
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line1837">line 1837</a>
|
|
2017
2017
|
</dd>
|
|
2018
2018
|
|
|
2019
2019
|
|
|
@@ -2135,7 +2135,7 @@ console.log(ang.L());
|
|
|
2135
2135
|
|
|
2136
2136
|
<dt class="tag-source">Source</dt>
|
|
2137
2137
|
<dd class="tag-source">
|
|
2138
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
2138
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line1644">line 1644</a>
|
|
2139
2139
|
</dd>
|
|
2140
2140
|
|
|
2141
2141
|
|
|
@@ -2407,7 +2407,7 @@ board.update();
|
|
|
2407
2407
|
|
|
2408
2408
|
<dt class="tag-source">Source</dt>
|
|
2409
2409
|
<dd class="tag-source">
|
|
2410
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
2410
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line1488">line 1488</a>
|
|
2411
2411
|
</dd>
|
|
2412
2412
|
|
|
2413
2413
|
|
|
@@ -2551,7 +2551,7 @@ board.update();
|
|
|
2551
2551
|
|
|
2552
2552
|
<dt class="tag-source">Source</dt>
|
|
2553
2553
|
<dd class="tag-source">
|
|
2554
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
2554
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line1194">line 1194</a>
|
|
2555
2555
|
</dd>
|
|
2556
2556
|
|
|
2557
2557
|
|
|
@@ -364,7 +364,7 @@ var p1 = board.create('point', [1.5, 5.0]),
|
|
|
364
364
|
|
|
365
365
|
<dt class="tag-source">Source</dt>
|
|
366
366
|
<dd class="tag-source">
|
|
367
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
367
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line1044">line 1044</a>
|
|
368
368
|
</dd>
|
|
369
369
|
|
|
370
370
|
|
|
@@ -514,7 +514,7 @@ var p1 = board.create('point', [1.5, 5.0]),
|
|
|
514
514
|
|
|
515
515
|
<dt class="tag-source">Source</dt>
|
|
516
516
|
<dd class="tag-source">
|
|
517
|
-
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#
|
|
517
|
+
<a href="element_sector.js.html">element/sector.js</a>, <a href="element_sector.js.html#line976">line 976</a>
|
|
518
518
|
</dd>
|
|
519
519
|
|
|
520
520
|
|
package/distrib/docs/Conic.html
CHANGED
|
@@ -1514,7 +1514,7 @@ points or coordinate pairs.</p></dd>
|
|
|
1514
1514
|
|
|
1515
1515
|
<dt class="tag-source">Source</dt>
|
|
1516
1516
|
<dd class="tag-source">
|
|
1517
|
-
<a href="element_conic.js.html">element/conic.js</a>, <a href="element_conic.js.html#
|
|
1517
|
+
<a href="element_conic.js.html">element/conic.js</a>, <a href="element_conic.js.html#line857">line 857</a>
|
|
1518
1518
|
</dd>
|
|
1519
1519
|
|
|
1520
1520
|
|
|
@@ -433,7 +433,7 @@ var ell = board.create('ellipse', [
|
|
|
433
433
|
<div class="description usertext">
|
|
434
434
|
<p>Parent elements can be two elements either of type <a href="JXG.Point.html">JXG.Point</a> or array of
|
|
435
435
|
numbers describing the coordinates of a point.
|
|
436
|
-
The third parameter is a number/function which defines the length of the major axis
|
|
436
|
+
The third parameter is a number/function which defines the length of the major axis.</p>
|
|
437
437
|
</div>
|
|
438
438
|
|
|
439
439
|
|
|
@@ -664,6 +664,28 @@ The third parameter is a number/function which defines the length of the major a
|
|
|
664
664
|
|
|
665
665
|
|
|
666
666
|
|
|
667
|
+
<h5 class="h5-examples">Example</h5>
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
<pre class="prettyprint"><code>var A = board.create('point', [1,0]);
|
|
672
|
+
var B = board.create('point', [-1,0]);
|
|
673
|
+
var el = board.create('ellipse',[A, B, 4]);
|
|
674
|
+
|
|
675
|
+
</code></pre><div id="JXG7898d447-94dc-4dce-9ad3-60e3387be9f3" class="jxgbox" style="width: 300px; height: 300px;"></div>
|
|
676
|
+
<script type="text/javascript">
|
|
677
|
+
(function() {
|
|
678
|
+
var board = JXG.JSXGraph.initBoard('JXG7898d447-94dc-4dce-9ad3-60e3387be9f3',
|
|
679
|
+
{boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
|
|
680
|
+
var A = board.create('point', [1,0]);
|
|
681
|
+
var B = board.create('point', [-1,0]);
|
|
682
|
+
var el = board.create('ellipse',[A,B, 4]);
|
|
683
|
+
})();
|
|
684
|
+
|
|
685
|
+
</script>
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
667
689
|
|
|
668
690
|
|
|
669
691
|
|
|
@@ -632,6 +632,29 @@ The third parameter is a number/function which defines the length of the major a
|
|
|
632
632
|
|
|
633
633
|
|
|
634
634
|
|
|
635
|
+
<h5 class="h5-examples">Example</h5>
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
<pre class="prettyprint"><code>var A = board.create('point', [1,0]);
|
|
640
|
+
var B = board.create('point', [-1,0]);
|
|
641
|
+
var el = board.create('hyperbola',[A, B, 1]);
|
|
642
|
+
|
|
643
|
+
</code></pre><div id="JXGa4c0068b-41bc-4be4-b485-d0d0c7f2e10b" class="jxgbox" style="width: 300px; height: 300px;"></div>
|
|
644
|
+
<script type="text/javascript">
|
|
645
|
+
(function() {
|
|
646
|
+
var board = JXG.JSXGraph.initBoard('JXGa4c0068b-41bc-4be4-b485-d0d0c7f2e10b',
|
|
647
|
+
{boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
|
|
648
|
+
var A = board.create('point', [1,0]);
|
|
649
|
+
var B = board.create('point', [-1,0]);
|
|
650
|
+
var el = board.create('hyperbola',[A,B, 1]);
|
|
651
|
+
|
|
652
|
+
})();
|
|
653
|
+
|
|
654
|
+
</script>
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
|
|
635
658
|
|
|
636
659
|
|
|
637
660
|
|
|
@@ -1271,7 +1294,7 @@ The third parameter is a number/function which defines the length of the major a
|
|
|
1271
1294
|
|
|
1272
1295
|
<dt class="tag-source">Source</dt>
|
|
1273
1296
|
<dd class="tag-source">
|
|
1274
|
-
<a href="element_conic.js.html">element/conic.js</a>, <a href="element_conic.js.html#
|
|
1297
|
+
<a href="element_conic.js.html">element/conic.js</a>, <a href="element_conic.js.html#line366">line 366</a>
|
|
1275
1298
|
</dd>
|
|
1276
1299
|
|
|
1277
1300
|
|
|
@@ -554,7 +554,7 @@ var p = board.create('point', [0.1, 0.1], {});
|
|
|
554
554
|
|
|
555
555
|
<dt class="tag-source">Source</dt>
|
|
556
556
|
<dd class="tag-source">
|
|
557
|
-
<a href="base_board.js.html">base/board.js</a>, <a href="base_board.js.html#
|
|
557
|
+
<a href="base_board.js.html">base/board.js</a>, <a href="base_board.js.html#line4693">line 4693</a>
|
|
558
558
|
</dd>
|
|
559
559
|
|
|
560
560
|
|