Circle with ticks: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 12: | Line 12: | ||
r = circ.Radius(), | r = circ.Radius(), | ||
i, | i, | ||
ticklen = 0.3, | |||
steps = 20, | steps = 20, | ||
d = ticklen * 0.5, | |||
alpha = 2 * Math.PI / steps; | alpha = 2 * Math.PI / steps; | ||
Line 18: | Line 20: | ||
this.dataY = []; | this.dataY = []; | ||
for (i = 0; i < steps; i++) { | for (i = 0; i < steps; i++) { | ||
this.dataX.push( cx + | this.dataX.push( cx + (r - d)* Math.cos(i * alpha) ); | ||
this.dataY.push( cy + | this.dataY.push( cy + (r - d) * Math.sin(i * alpha) ); | ||
this.dataX.push( cx + | this.dataX.push( cx + (r + d) * Math.cos(i * alpha) ); | ||
this.dataY.push( cy + | this.dataY.push( cy + (r + d) * Math.sin(i * alpha) ); | ||
this.dataX.push( NaN ); | this.dataX.push( NaN ); | ||
this.dataY.push( NaN ); | this.dataY.push( NaN ); | ||
} | } | ||
}; | }; | ||
brd.update(); | |||
</jsxgraph> | </jsxgraph> |