Curly braces: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 5: Line 5:
var line = brd.create('segment', [A,B]);
var line = brd.create('segment', [A,B]);


var height = 0.5;
var crl = brd.create('curve', [[0],[0]], {strokeWidth:1, strokeColor:'black'});
var crl = brd.create('curve', [[0],[0]], {strokeWidth:1, strokeColor:'black'});
crl.bezierDegree = 3;
crl.bezierDegree = 3;
Line 11: Line 12:
         dl = Math.sqrt(d[0]*d[0]+d[1]*d[1]),
         dl = Math.sqrt(d[0]*d[0]+d[1]*d[1]),
         mid = [(A.X()+B.X())*0.5, (A.Y()+B.Y())*0.5];
         mid = [(A.X()+B.X())*0.5, (A.Y()+B.Y())*0.5];
    d[0] *= height/dl;
    d[1] *= height/dl;


     this.dataX = [ A.X(), A.X()+d[1]/dl, mid[0], mid[0]+d[1]/dl, mid[0], B.X()+d[1]/dl, B.X()];
     this.dataX = [ A.X(), A.X()+d[1]/dl, mid[0], mid[0]+d[1]/dl, mid[0], B.X()+d[1]/dl, B.X()];

Revision as of 12:50, 19 February 2013