Fill the intersection area of three circles: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
<jsxgraph width="600" height="600">
<jsxgraph width="600" height="600">
     JXG.joinCurves = function(board, parents, attributes) {
     JXG.joinCurves = function(board, parents, attributes) {
         var cu1 = parents[0],
         var curves = parents,  
            cu2 = parents[1],
            cu3 = parents[2],
             attr = JXG.copyAttributes(attributes, board.options, 'curve'),
             attr = JXG.copyAttributes(attributes, board.options, 'curve'),
             c = board.create('curve', [[0], [0]], attr);
             c = board.create('curve', [[0], [0]], attr);
          
          
         c.updateDataArray = function() {
         c.updateDataArray = function() {
            var i, le = curves.length;
             // The three paths have to be connected
             // The three paths have to be connected
             this.dataX = cu1.dataX.slice(0,-1).concat(cu2.dataX.slice(0,-1)).concat(cu3.dataX);
             this.dataX = [];
            this.dataY = cu1.dataY.slice(0,-1).concat(cu2.dataY.slice(0,-1)).concat(cu3.dataY);
            this.dataY = [];
console.log(this.dataX.length);
            for (i = 0; i < le; i++) {
                if (i < le - 1) {
                    this.dataX = this.dataX.concat(curves[i].dataX.slice(0,-1));
                    this.dataY = this.dataY.concat(curves[i].dataY.slice(0,-1));
                } else {
                    this.dataX = this.dataX.concat(curves[i].dataX);
                    this.dataY = this.dataY.concat(curves[i].dataY);
                }
            }
 
             if (this.dataX.length<4) {
             if (this.dataX.length<4) {
                 this.bezierDegree = 1;
                 this.bezierDegree = 1;

Revision as of 10:12, 15 August 2017

The underlying JavaScript code