Created
December 6, 2019 22:16
-
-
Save Arrlindii/c16a11da7abb7316347004738141b19c to your computer and use it in GitHub Desktop.
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
| func getPetalCenteres() -> [CGPoint] { | |
| let h = radius | |
| let center = CGPoint(x: h/2, y: h/2) | |
| var points: [CGPoint] = [] | |
| let d = petalCount - Double(Int(petalCount)) > 0 ? 1 : 0 | |
| for i in 0..<Int(petalCount) + d { | |
| let angle = (Double(i) + Double(self.scale)) * (360/Double(petalCount)) | |
| let angleInRad = angle*Double.pi/180 | |
| let point = CGPoint(x: center.x + CGFloat(cos(angleInRad) * h), y: center.y + CGFloat(sin(angleInRad)*h)) | |
| points.append(point) | |
| } | |
| return points | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment