Intersection of curves I

From JSXGraph Wiki
Revision as of 18:42, 18 July 2024 by TomBerend (talk | contribs) (replaced complicated call to JSX.Math.Clip with simple call to 'curveintersection')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The underlying JavaScript code

var board = JXG.JSXGraph.initBoard('jxgbox', {
    axis:true,
    boundingbox:[-15, 10, 10, -10]
});

var p = [];
p.push(board.create('point', [0, -5]));
p.push(board.create('point', [-5, 0]));
p.push(board.create('point', [-3, 3]));

var curve1 = board.create('ellipse', p, {strokeColor: 'black'});

var curve2 = board.create('curve', [function(phi){return 4 * Math.cos(2*phi); }, 
                                    [0, 0], 
                                    0, 2 * Math.PI],
                      {curveType:'polar', strokeColor: 'blue', strokewidth:1});

var clip = board.create('curveintersection', [curve1, curve2], 
                      { strokeWidth: 3, fillColor: 'yellow', fillOpacity: 0.3 });