Circular arc approximation by cubic Bezier curve: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
var M = brd.create('point', [0,0], {name:'M'}); | var M = brd.create('point', [0,0], {name:'M'}); | ||
var C = brd.create('point', [0,-1], {name:'D'}); | var C = brd.create('point', [0,-1], {name:'D'}); | ||
var c = brd.create('circle', [M, | var c = brd.create('circle', [M,C], {strokeWidth:1}); | ||
var A = brd.create('glider', [1,0,c], {name:'A'}); | var A = brd.create('glider', [1,0,c], {name:'A'}); | ||
var B = brd.create('glider', [0,1,c], {name:'B'}); | var B = brd.create('glider', [0,1,c], {name:'B'}); | ||
Line 16: | Line 16: | ||
r = M.Dist(A); | r = M.Dist(A); | ||
d = Math.sqrt((ax+bx)*(ax+bx) + (ay+by)*(ay+by)); | d = Math.sqrt((ax+bx)*(ax+bx) + (ay+by)*(ay+by)); | ||
if (Math.abs(by-ay)>JXG.Math.eps) { | if (Math.abs(by-ay)>JXG.Math.eps) { | ||
return (ax+bx)*(r/d-0.5)*8.0/3.0/(by-ay); | return (ax+bx)*(r/d-0.5)*8.0/3.0/(by-ay); |