几何图库绘制 JSXGraph
fmms
13年前
JSXGraph 是一个支持各种浏览器的交互式几何图库绘制。JSXGraph 使用 SVG 和 VML.
<pre><jsxgraph width="500" height="500" box="box"> var addPoint = function(x) { p.push(brd.create('point', [x,(Math.random()-0.5)*3],{style:6})); brd.update(); }; var brd = JXG.JSXGraph.initBoard('box', {axis:true,originX: 250, originY: 250, unitX: 50, unitY: 25}); brd.suspendUpdate(); var p = []; p[0] = brd.create('point', [-4,2], {style:6}); p[1] = brd.create('point', [3,-1], {style:6}); addPoint(-2); addPoint(0.5); addPoint(1); var pol = brd.lagrangePolynomial(p); var g = brd.create('functiongraph', [pol, -10, 10], {strokeWidth:3}); var g2 = brd.create('functiongraph', [brd.D(pol), -10, 10], {dash:3, strokeColor:'#ff0000'}); brd.unsuspendUpdate(); </jsxgraph></pre>