Difference between revisions of "Circle with ticks"

From JSXGraph Wiki
Jump to navigationJump to search
Line 10: Line 10:
 
     var cx = circ.center.X(),
 
     var cx = circ.center.X(),
 
         cy = circ.center.Y(),
 
         cy = circ.center.Y(),
         r = circle.Radius();
+
         r = circle.Radius(),
 +
        i,
 +
        steps = 20,
 +
        alpha = 2 * Math.PI / steps;
 +
 
 +
    this.dataX = [];
 +
    this.dataY = [];
 +
    for (i = 0; i < steps; i++) {
 +
        this.dataX.push( cx + 0.95 * Math.cos(i * alpha) );
 +
        this.dataY.push( cx + 0.95 * Math.sin(i * alpha) );
 +
        this.dataX.push( cx + 1.05 * Math.cos(i * alpha) );
 +
        this.dataY.push( cx + 1.05 * Math.sin(i * alpha) );
 +
    }
 +
 
 
};
 
};
  

Revision as of 23:55, 24 March 2014

The underlying JavaScript code