Curly braces: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 24: | Line 24: | ||
// Text | // Text | ||
var txt = brd.create('text', [ | var txt = brd.create('text', [ | ||
function() { | function() { | ||
function() { | var d = [B.X()-A.X(), B.Y()-A.Y()], | ||
function() { return | dl = Math.sqrt(d[0]*d[0]+d[1]*d[1]), | ||
mid = (A.X()+B.X())*0.5; | |||
d[0] *= height/dl; | |||
return mid-d[1] ; | |||
}, | |||
function() { | |||
var d = [B.X()-A.X(), B.Y()-A.Y()], | |||
dl = Math.sqrt(d[0]*d[0]+d[1]*d[1]), | |||
mid = (A.Y()+B.Y())*0.5; | |||
d[1] *= height/dl; | |||
return mid+d[0]; | |||
}, | |||
function() { return B.Dist(A).toFixed(2); } | |||
]); | ]); | ||