Created
November 27, 2019 11:40
-
-
Save Arrlindii/fed5899402ee7ed8874750608eb3b3f3 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] = [] | |
| for i in 0..<Int(petalCount) { | |
| 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