Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First compute the four corners of the shape. </p> <pre><code>x1 = cx + radialScale*radiusStep*cos(rotationScale * rotationStep) y1 = cy + radialScale*radiusStep*sin(rotationScale * rotationStep) x2 = cx + radialScale*(radiusStep+1)*cos(rotationScale * rotationStep) y2 = cy + radialScale*(radiusStep+1)*sin(rotationScale * rotationStep) x3 = cx + radialScale*radiusStep*cos(rotationScale*(rotationStep+1)) y3 = cy + radialScale*radiusStep*sin(rotationScale*(rotationStep+1)) x4 = cx + radialScale*(radiusStep+1)*cos(rotationScale*(rotationStep+1)) y4 = cy + radialScale*(radiusStep+1)*sin(rotationScale*(rotationStep+1)) </code></pre> <p>Where (cx, cy) is the center point - In your case (maxX/2, maxY/2).</p> <p>The constants rotationScale and radialScale are just to scale up the steps to the full range. For example the rotationScale is 2PI/n if you have n sectors. And the radialScale is R/m if you have m "bands" and the outermost circle in the net has radius R. Hope that makes sense.</p> <p>The idea here is just like in a regular grid.</p> <ul> <li>One starting point</li> <li>One point to "the right" (x+1 in a regular grid, rotationStep+1 here)</li> <li>One point "down2 (y+1 in a regular grid, radiusStep+1 here)</li> <li>And then one point right <em>and</em> down.</li> </ul> <p>Now just draw the four lines between the points and voilá!</p> <p>Most graphics packages also has a <code>DrawArc</code> method of sorts. This can be used to draw the two circle arcs with very high performance while at the same time make it look even more pretty!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload