data = RandomReal[{0, 1}, {100, 2}]
r = 1/5;
center = {1/6, 1/4};
sd = Select[data, EuclideanDistance[#, center] < r &]
Show[ListPlot@data,
Graphics@Circle[center, r],
Graphics[{Red, PointSize[Large], Point@sd}], AspectRatio -> 1]
编辑
对于椭圆
data = RandomReal[{0, 1}, {100, 2}]
r = 1/5;
f1 = {1/6, 1/4};
f2 = {1/3, 1/5};
sd = Select[data, EuclideanDistance[#, f1] + EuclideanDistance[#, f2] < r &]
Show[ListPlot@data,
RegionPlot[EuclideanDistance[{x, y},f1] + EuclideanDistance[{x, y},f2] <r,
{x, 0, 1}, {y, 0, 1}],
Graphics[{Red, PointSize[Large], Point@sd}], AspectRatio -> 1]
编辑 2
更好的代码
data = RandomReal[{0, 1}, {100, 2}]
r = 1/5;
f1 = {1/6, 1/4};
f2 = {1/3, 1/5};
inside[{x_, y_}, {f1_, f2_}] := Sum[EuclideanDistance[{x, y}, i], {i, {f1, f2}}];
sd = Select[data, inside[#, {f1, f2}] < r &];
Show[ListPlot@data,
RegionPlot[inside[{x, y}, {f1, f2}] < r, {x, 0, 1}, {y, 0, 1}],
Graphics[{Red, PointSize[Large], Point@sd}],
AspectRatio -> 1]
编辑 3
在这里,您将整个内容转换为您的ComponentMeasurements
输出
(*{c,s,t}=1/.ComponentMeasurements[f,{"Centroid","SemiAxes",\
"Orientation"}] *)
c = {.3, .4}
s = {.4, .2}
t = Pi/8
{s1, s2} = s
center = {cx, cy} = c
f = Sqrt[s1 s1 - s2 s2]
f1 = {f1x, f1y} = {cx + f Cos[t], cy - f Sin[t]}
f2 = {f2x, f2y} = {cx - f Cos[t], cy + f Sin[t]}
r = 2 Sqrt[f f + s2 s2]
data = RandomReal[{0, 1}, {100, 2}];
sd = Select[data, EuclideanDistance[#, f1] + EuclideanDistance[#, f2] < r &];
Show[
ListPlot@data,
RegionPlot[ EuclideanDistance[{x, y}, f1] + EuclideanDistance[{x, y}, f2] < r,
{x, 0, 1}, {y, 0, 1}],
Graphics[{Red, PointSize[Large], Point@sd}],
AspectRatio -> 1]