Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

#2: Post edited by user avatar trichoplax‭ · 2023-08-27T19:37:51Z (about 1 year ago)
Typos
  • 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 by user avatar Olin Lathrop‭ · 2023-08-26T20:02:19Z (about 1 year ago)
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.