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
| # This source code was obtained from StackOverflow user "mike-ounsworth" | |
| # Author Profile: https://stackoverflow.com/users/1907046/mike-ounsworth | |
| # Original Source: https://stackoverflow.com/questions/8997099/algorithm-to-generate-random-2d-polygon/25276331#25276331 | |
| import math, random | |
| def generatePolygon( ctrX, ctrY, aveRadius, irregularity, spikeyness, numVerts ) : | |
| '''Start with the centre of the polygon at ctrX, ctrY, | |
| then creates the polygon by sampling points on a circle around the centre. | |
| Randon noise is added by varying the angular spacing between sequential points, |