Update: As noted by Henrik and Rahul the original answer is not the correct approach. An alternative method that gives the correct polygon containing redPt
is based on using Graphics`PolygonUtils`InPolygonQ
:
polygons = MeshPrimitives[plot1ClearAll[f]
f[r_, 2];
polyp_] := Pick[polygons Pick[#, Graphics`PolygonUtils`InPolygonQ[#, redPt]p] & /@ polygons];#] &@
MeshPrimitives[r, 2];
Show[plot1,
Graphics[{PointSize[Large], Point@redPt, Opacity[.5, Red], poly f[plot1, redPt]}]]
To get the coordinates, use
poly[[1f[plot1, redPt][[1, 1]]
{{0.67033, 0.84245}, {0.620283, 0.648944}, {0.829905, 0.700287}}
OriginalUsing Henrik's example (incorrectR
) answer:
Show[R, Graphics[{PointSize[Large], Point@redPt, Opacity[.5, Red], f[R, redPt]}]]
Original (incorrect) answer:
Nearest[MeshCoordinates[plot1], redPts, 3]