Post History
#2: Post edited
Any convex polygon can be trivially tiled into triangles. Chose any point on the boundary or inside the polygon and draw lines from there to all the verticies. This point can be one of the verticies. It can also be the origin in your case. It doesn't matter what point is picked.Find the area of each triangle. For each random point, chose a triangle biased by its area, then randomly find a point within that triangle.One simple way to do the latter conceptually is to transform the triangle into a space where it extends between (0,0) (1,0) (0,1). Pick any point in the (0,0) to (1,1) square. If it happens to end be outside the triangle, reflect it back inside. Either the original point or its reflection will be in or on the triangle.
- Any convex polygon can be trivially tiled into triangles. Choose any point on the boundary or inside the polygon and draw lines from there to all the vertices. This point can be one of the vertices. It can also be the origin in your case. It doesn't matter what point is picked.
- Find the area of each triangle. For each random point, choose a triangle biased by its area, then randomly find a point within that triangle.
- One simple way to do the latter conceptually is to transform the triangle into a space where it extends between (0,0) (1,0) (0,1). Pick any point in the (0,0) to (1,1) square. If it happens to be outside the triangle, reflect it back inside. Either the original point or its reflection will be in or on the triangle.
#1: Initial revision
Any convex polygon can be trivially tiled into triangles. Chose any point on the boundary or inside the polygon and draw lines from there to all the verticies. This point can be one of the verticies. It can also be the origin in your case. It doesn't matter what point is picked. Find the area of each triangle. For each random point, chose a triangle biased by its area, then randomly find a point within that triangle. One simple way to do the latter conceptually is to transform the triangle into a space where it extends between (0,0) (1,0) (0,1). Pick any point in the (0,0) to (1,1) square. If it happens to end be outside the triangle, reflect it back inside. Either the original point or its reflection will be in or on the triangle.