Curly braces: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) 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 height = 0.5; // height of the curly brace | ||
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; | ||
crl.updateDataArray = function() { | crl.updateDataArray = function() { | ||
var d = [B.X() - A.X(), B.Y() - A.Y()], | var d = [B.X()-A.X(), B.Y()-A.Y()], | ||
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]; |