# Difference between revisions of "Circle with ticks"

From JSXGraph Wiki

Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
A WASSERMANN (talk | contribs) |
||

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> |