Skip to content

Commit ca342b3

Browse files
committed
scale hex radius so that when hexagons touch, circles also touch without overlapping
(supersedes #795)
1 parent 7a47351 commit ca342b3

File tree

3 files changed

+167
-111
lines changed

3 files changed

+167
-111
lines changed

src/symbols.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const t = Math.sqrt(3) / 2; // TODO decide on radius definition
55

66
const symbolHexagon = {
77
draw(context, size) {
8-
const s = Math.sqrt(size / Math.PI), hs = s / 2, ts = s * t;
8+
const s = Math.sqrt(size / Math.PI) * 2 / Math.sqrt(3), hs = s / 2, ts = s * t;
99
context.moveTo(0, s);
1010
context.lineTo(ts, hs);
1111
context.lineTo(ts, -hs);

0 commit comments

Comments
 (0)