Difference between revisions of "Intersection of functiongraphs"

From JSXGraph Wiki
Jump to navigationJump to search
Line 7: Line 7:
 
var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false, fillColor: 'blue', fillOpacity: 0.0});
 
var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false, fillColor: 'blue', fillOpacity: 0.0});
 
var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false, fillColor: 'red', fillOpacity: 0.0});
 
var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false, fillColor: 'red', fillOpacity: 0.0});
//var curve2 = board.create('functiongraph', ['-x^2+4'], {strokeColor: 'black', fixed: false, fillColor: 'red', fillOpacity: 0.0});
 
//var curve2 = board.create('functiongraph', ['sin(x)'], {strokeColor: 'black', fixed: false, fillColor: 'red', fillOpacity: 0.0});
 
var c = board.create('circle', [[0,0], 4]);
 
  
 
var clip_path = board.create('curve', [[], []], {strokeWidth: 0, fillColor: 'yellow', fillOpacity: 0.6});
 
var clip_path = board.create('curve', [[], []], {strokeWidth: 0, fillColor: 'yellow', fillOpacity: 0.6});
Line 26: Line 23:
 
     curve2.numberPoints += 2;
 
     curve2.numberPoints += 2;
  
     var a = JXG.Math.Clip.greinerHormann(curve1, curve2, 'intersection', this.board);
+
     var a = JXG.Math.Clip.intersection(curve1, curve2, this.board);
 
     this.dataX = a[0];
 
     this.dataX = a[0];
 
     this.dataY = a[1];
 
     this.dataY = a[1];

Revision as of 11:32, 28 March 2020

The underlying JavaScript code