scene_synthesizer.utils.sample_polygon
- scene_synthesizer.utils.sample_polygon(polygon, count, factor=1.5, max_iter=10, seed=None)
Use rejection sampling to generate random points inside a polygon. This is the same as sample_polygon but using a specified RNG.
- Parameters:
polygon (shapely.geometry.Polygon) – Polygon that will contain points
count (int) – Number of points to return
factor (float) – How many points to test per loop
max_iter (int) – Maximum number of intersection checks is: > count * factor * max_iter
seed (int, numpy.random._generator.Generator, optional) – A seed or random number generator. Defaults to None which creates a new default random number generator.
- Returns:
Random points inside polygon where n <= count
- Return type:
(n, 2) float