This unique graph type is quite fascinating to me as I have never come across it before. I'm unable to find any information about it, but if it's mathematically derived, I would love to learn more about how it functions.
My observations on the rules of this graph are as follows:
- The rings decrease their point count in a linear manner: 20, 16, 12, 8.
- Each alternate ring is shifted by half of the iterative angle. For instance, if they are spaced at every 20 degrees in an alternating row, then it would be offset by 10 degrees.
- The diagram does not seem to space the rings evenly, although I believe that was intentional.
Here is my attempt at replicating it:
http://jsfiddle.net/lannymcnie/sbmaLed1/
- The main function allows for specifying the radius (of the outer ring).
- You can determine the number of circles in the outer and inner rings.
- You can also set the degeneration (apologies for the poor naming, the initial function worked in reverse). This signifies the number of dots to increase with each ring. To achieve the effect, you need 4, but varying it can produce interesting effects (http://jsfiddle.net/lannymcnie/sbmaLed1/3/)
Below is the main function code snippet:
function drawMac(radius, start, end, degenerate) {
var g = new createjs.Graphics().f("#f00").dc(0,0,5);
for (var i=start, l=end; i<=l; i+=degenerate) {
var segments = i;
var d = segments/end * radius;
var counter = segments%(degenerate*2) == 0;
var offset = Math.PI*2 * 1/segments;
for (var j=0; j<segments; j++) {
var angle = Math.PI*2 * (j/segments);
var s = new createjs.Shape(g);
s.x = Math.sin(angle) * d;
s.y = Math.cos(angle) * d;
container.addChild(s);
}
}
container.rotation = 45;
}
I hope this explanation helps. It was enjoyable trying to decipher this pattern.
[EDIT]
After making some minor adjustments, I managed to get much closer to the original design:
- Tended towards the outside (check the Math.pow addition)
- Added a slight rotation trend towards the center (see the +0.002 in the angle)
Below is the final function code snippet:
function drawMac(radius, start, end, degenerate) {
var g = new createjs.Graphics().f("#f00").dc(0,0,5);
for (var i=start, l=end; i<=l; i+=degenerate) {
var segments = i;
var d = Math.pow(segments/end, 0.75) * radius;
var counter = segments%(degenerate*2) == 0;
var offset = Math.PI*2 * 1/segments;
for (var j=0; j<segments; j++) {
var angle = Math.PI*2 * (j/segments+i*0.002);
var s = new createjs.Shape(g);
s.x = Math.sin(angle) * d;
s.y = Math.cos(angle) * d;
container.addChild(s);
}
}
container.rotation = 45;
}
With these adjustments, it now matches about 98% to the original. I compared the results in Photoshop and overlaid my version (dark red) over the original.
Furthermore, here is the updated fiddle with the final result.
http://jsfiddle.net/lannymcnie/sbmaLed1/6/