### Description

This tool generates a regular arrangement of circles within the bounds of polygons. The user specifies the radius of the circles (a constant) and the spacing between the centres of the circles, which controls the amount of overlap in adjacent circles and the amount of interstitial space. Only circles that are completely contained by the polygon are retained. If this tool does not suit your purpose you may find the 'genshapes' command more useful - it will also generate a regular arrangement of circles but without the constraint that the circles must be completely contained by the polygon. Also, the genhexagonsinpolys command serves a similar function to this tool but using hexagons instead of circles.

There is an element of randomisation built into this tool: the overall placement of the grid of circles is determined randomly so that if you run the tool twice, you will get a different result. This is important because it allows you to run the tool many times in an attempt to find the maximum number of circles that can fit in a given polygon. This will depend on the complex shape of the polygon and generally cannot be determined analytically.

Note the default spacing option allows just enough overlap of circles to eliminate interstitial spaces between circles. If you prefer that there is no overlap between circles then set the spacing option to two times the radius. This ensures that the circles are touching, but there is no overlap.

One possible application of this tool might be estimating the number of viable home ranges that an area might contain.

### Syntax

gencirclesinpolys(in, uidfield, out, radius, [spacing], [where]);

in | the input polygon data source | |

uidfield | the unique ID field of the input feature data source | |

out | the output polygon data source | |

radius | the radius of the circles (a constant specified in the coordinate system units of the reference layer) | |

[spacing] | the distance between adjacent circle centres (defaults to 2*radius*cos(PI/6), which is the largest possible spacing that creates no interstitial spaces between circles) | |

[where] | the selection statement that will be applied to the feature data source to identify a subset of features to process (see full Help documentation for further details) |

### Example

gencirclesinpolys(in="C:\data\referencelayer.shp", out="C:\data\myoutput.shp", radius=100);

gencirclesinpolys(in="C:\data\boundaries.shp", out="C:\data\myoutput.shp", radius=10.567, spacing=30);