I would like to probabiistically estimate the convexity coefficient of a MeshRegion, described as -
Given a region $\mathscr{K}$, calculate the probability that a line with randomly chosen endpoints $\{p_1,p_2\}\in\mathscr{K}$, will be wholly contained within $\mathscr{K}$.
(NB - I know how to do this the 'hard way' e.g. directly using the polygon edges / lines, but I'm hoping to take advantage of Mathematica's new-but-not-great geometric computation additions.)
So- here's a $\mathbb{R}^2$ sort-of-not-really convex region (I eventually need $\mathbb{R}^3$ but this makes the demo simpler)
rK = MeshRegion[{{0, 0}, {1, 0}, {0.1, 0.5}, {1, 1}, {0, 1}, {Polygon[{1, 2, 3, 4, 5}]}]

Now, let's generate some random lines with endpoints in rK -
SeedRandom[02134];
lines = Table[Line[{RandomPoint[rK], RandomPoint[rK]]}], {20}];
Show[{rK, Graphics[lines]}]

Of the 20 lines, 14 are fully inside rK, so the convexity coef is (roughly, of course) 14/20. Based on the tools available for geometric computation in 10.x I can't seem to find a way to test if a line (or other Region of some kind) is contained within another region. Points are, of course, pretty trivial (e.g. RegionMember)
Element[{0.1, 0.1}, rK]
yields True, and the endpoints of the first line in our random list
Show[{rK, Graphics[lines[[1]]]}]

RegionMember[rK, lines[[1, 1]]]
are both True but obviously the line itself isn't contained within the region.
Unfortunately, you can't do anything as clever as, say,
Element[MeshRegion[lines[[1, 1]], Line[{1, 2}]], rK]

But it might be nice to... I've had extremely mixed success with the various computational geometry routines, especially with complicated / 3D MeshRegions that are my day-to-day currency. Does anyone have any insight here that might help?
RegionIntersectionwithRegionDifferencein some of those answers should work. – Jan 03 '16 at 21:06Elementexample. Hmm- I will probe further! – flip Jan 03 '16 at 21:19RandomPointis a real MMa symbol. – flip Jan 03 '16 at 21:29MeshRegions. If you keep them as graphics primitives it works:RegionDimension[RegionDifference[lines[[1]], Polygon[{{0, 0}, {1, 0}, {0.1, 0.5}, {1, 1}, {0, 1}}]]]gives1, showing that the line is not entirely contained in the polygon. – Jan 03 '16 at 21:40