This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // without turtle drawing a hexagon is math heavy and not trivial to modify | |
| let numberOfSides: CGFloat = 6 | |
| let radiusOuterCircle: CGFloat = bounds.width | |
| let sideLength = radiusOuterCircle / 2 | |
| let theta = (CGFloat.pi * 2) / numberOfSides | |
| let centerX = sideLength / 2 | |
| let centerY = sideLength / 2 | |
| let initialPoint = CGPoint(x: radiusOuterCircle * cos(2 * CGFloat.pi * 0/numberOfSides + theta) + centerX, y: radiusOuterCircle * sin(2 * CGFloat.pi * 0/numberOfSides + theta) + centerY) |