So I have a region defined by a MeshRegion
,like
MeshRegion[{{0, 0}, {1, 1}, {2, 1/2}, {2, -1/2}}, {Line[{1, 2}], Line[{2, 3}], Line[{3, 4}], Line[{4, 1}]}]
Which I would like to pick some random points on its border, like {0.5,0.5}
and {1,-0.25}
. Converting to Graphics
and Rasterize
, then picking random points is a way, but it would cause serious slowing down as most of the space is used to store the non-boundary points, not to mention the decreased accuracy. So is there a way to get the random points directly from the MeshRegion
? The accuracy should be changeable.
RandomPoint[mr,10]
wheremr = MeshRegion[{{0, 0}, {1, 1}, {2, 1/2}, {2, -1/2}}, {Line[{1, 2}], Line[{2, 3}], Line[{3, 4}], Line[{4, 1}]}]
? $\endgroup$