How to choose random coordinate inside shape?
Here’s a couple of approaches you could take:
- Determine the AABB of the shape.
- Choose a random point in the AABB.
- If the point is outside the shape discard the point. Go to 2.
Or
- Triangulate the shape.
- Choose a random triangle using a weighted choice using the area of each triangle as the weight.
- Choose a random point in the triangle.
1 Like