Intersection of functiongraphs: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
(Simplify from JSX.Math.Clip to curveintersection, but also the old code shaded the WRONG area.) |
||
(5 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
var board = JXG.JSXGraph.initBoard('jxgbox', { | var board = JXG.JSXGraph.initBoard('jxgbox', { | ||
axis:true, | axis:true, | ||
boundingbox:[-5, 10, | boundingbox:[-5, 10, 10, -5] | ||
}); | }); | ||
var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false | var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false}); | ||
var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false | var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false}); | ||
var clip = board.create('curveintersection', [curve1, curve2], { strokeWidth: 2, fillColor: 'yellow', fillOpacity: 0.3 }); | |||
</jsxgraph> | |||
==The underlying JavaScript code== | |||
<source lang="javascript"> | |||
var board = JXG.JSXGraph.initBoard('jxgbox', { | |||
axis:true, | |||
boundingbox:[-5, 10, 10, -5] | |||
}); | |||
var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false}); | |||
var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false}); | |||
} | |||
var clip = board.create('curveintersection', [curve1, curve2], | |||
{strokeWidth: 2, fillColor: 'yellow', fillOpacity: 0.3 }); | |||
</source> | |||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Curves]] | [[Category:Curves]] |
Latest revision as of 18:54, 18 July 2024
The underlying JavaScript code
var board = JXG.JSXGraph.initBoard('jxgbox', {
axis:true,
boundingbox:[-5, 10, 10, -5]
});
var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false});
var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false});
var clip = board.create('curveintersection', [curve1, curve2],
{strokeWidth: 2, fillColor: 'yellow', fillOpacity: 0.3 });