Use 'sf' to help with the point in polygon intersections.
create_circles_grob(
boundary_df,
params,
angle = 0,
spacing = 0.1,
density = 0.3,
xoffset = 0,
yoffset = 0,
aspect_ratio
)polygon_df data.frame
params from the geom
angle of orientation (degrees)
spacing in grid 'npc' coordinates. Usually in range [0, 1]
fill fraction. Number in range [0, 1]
offset the pattern creation origin.
aspect_ratio
A grid::circleGrob
make grid to cover entire space
rotate points into position
create expanded boundary by r
create contracted boundary by r
remove all points outside the expanded boundary
remove all points within contracted boundary -> internal circles
any remaining points become part of the intersection grob
total circles = treeGrob( internal_circls, intersection_circles)