Fill the intersection area of three circles: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) 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 | var curves = parents, | ||
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 = | this.dataX = []; | ||
this.dataY = []; | |||
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; |