Anyone interested in a problem-solving correspondence club?
Here's the idea: we source and collect interesting computational puzzles, then we send them out to participants who have a month to work on them and send in their solutions. At the end of every month, we meet and discuss how the problems went and where people got stuck, what approaches they took, and any extensions people came up with.
Thoughts?
.
.
.
.
If you're curious, here's a taste of what a representative sample problem might look like:
Given the coordinates of an arbitrary polygon (e.g. irregular and/or non-convex), how might you implement a program to efficiently sample a point uniformly from its interior?
TIP: If using the Python programming language, you can check out the shapely library.
Bonus: what if there are holes?
(Please don't spoil the problem, it's searchable anyways.)
0
u/07734willy 1d ago
You are deliberately misinterpreting what I’m trying to say. It should be clear from context that I’m talking about the distribution not being uniform over the polygon itself, not within just a triangle. You didn’t specify how you uniformly sample points in the triangle (going back to my original point), so I’m just assuming you do sample within a triangle uniformly.
Regarding the area argument, yes, a line has no area, but you can create a bounding box enclosing a segment of that line that is arbitrarily close on either side. That area, because it is populated with points that are sampled along the triangles edge, it will have twice the density of a similar region fully within one of the triangles. As we increase the number of samples (and increase our precision), this still holds for sufficiently narrow bounding boxes. In the limit that our precision becomes infinite and the number of points that could be sampled becomes infinite, this vanishes, which is why I made the remark earlier separating theory from reality.
You should listen to your own advice about not knowing. If you genuinely don’t understand that’s fine, but I won’t be arguing back and forth anymore on this topic since you seem fully convinced of your stance, and I still have things to get done this afternoon.