Difference between revisions of "Bezier curves II"
From JSXGraph Wiki
Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
A WASSERMANN (talk | contribs) |
||
Line 3: | Line 3: | ||
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-4,4,4,-4],keepaspectratio:true,axis:true}); | var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-4,4,4,-4],keepaspectratio:true,axis:true}); | ||
− | var p = []; l = []; | + | var p = []; l = [], m= []; |
col = 'red'; | col = 'red'; | ||
Line 9: | Line 9: | ||
col = 'blue'; | col = 'blue'; | ||
p.push(brd.createElement('point',[0.75,2.5],{strokeColor:col,fillColor:col})); // control point | p.push(brd.createElement('point',[0.75,2.5],{strokeColor:col,fillColor:col})); // control point | ||
− | p.push(brd.createElement('point',[- | + | p.push(brd.createElement('point',[-1.5,2.4],{strokeColor:col,fillColor:col})); // control point |
col = 'red'; | col = 'red'; | ||
Line 17: | Line 17: | ||
l.push(brd.createElement('segment',[p[1],p[2]],{strokeOpacity:0.5})); | l.push(brd.createElement('segment',[p[1],p[2]],{strokeOpacity:0.5})); | ||
l.push(brd.createElement('segment',[p[2],p[3]],{strokeOpacity:0.5})); | l.push(brd.createElement('segment',[p[2],p[3]],{strokeOpacity:0.5})); | ||
+ | |||
+ | col = 'black'; | ||
+ | m.push(brd.createElement('midpoint',[l[0]],{face:'o',size:2,strokeColor:col,fillColor:col})); | ||
var c = brd.createElement('curve', JXG.Math.Numerics.bezier(p), {strokecolor:'blue', strokeOpacity:0.6, strokeWidth:5}); | var c = brd.createElement('curve', JXG.Math.Numerics.bezier(p), {strokecolor:'blue', strokeOpacity:0.6, strokeWidth:5}); |
Revision as of 13:16, 28 September 2009
The red points are connected by a cubic Bezier curve. The blue points are the control points.