Created
April 9, 2020 19:24
-
-
Save divyanshub024/72ac490995712f4e3ea8a94e3fcf0463 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
Path createPath(int sides, double radius) { | |
var path = Path(); | |
var angle = (math.pi * 2) / sides; | |
path.moveTo(radius * math.cos(0.0), radius * math.sin(0.0)); | |
for (int i = 1; i <= sides; i++) { | |
double x = radius * math.cos(angle * i); | |
double y = radius * math.sin(angle * i); | |
path.lineTo(x, y); | |
} | |
path.close(); | |
return path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment