Wolfram mathematica 在Mathematica中,如何从椭圆图形内的列表图中收集数据点?
更新: 我有一个数据列表图,我想收集与Mathematica中列表图重叠的圆图形的特定边界内的所有数据点 这样的事情可能吗 我做的椭圆是这样的形状Wolfram mathematica 在Mathematica中,如何从椭圆图形内的列表图中收集数据点?,wolfram-mathematica,Wolfram Mathematica,更新: 我有一个数据列表图,我想收集与Mathematica中列表图重叠的圆图形的特定边界内的所有数据点 这样的事情可能吗 我做的椭圆是这样的形状 {c, s, \[Theta]} = 1 /. ComponentMeasurements[f, {"Centroid", "SemiAxes", "Orientation"}] Show[Rasterize[p], Graphics[{Red, Rotate[Circle[c, s], \[Theta]]}]] 你们能帮我把你们最底层的解决方
{c, s, \[Theta]} =
1 /. ComponentMeasurements[f, {"Centroid", "SemiAxes", "Orientation"}]
Show[Rasterize[p], Graphics[{Red, Rotate[Circle[c, s], \[Theta]]}]]
你们能帮我把你们最底层的解决方案放到一个表格里,在那个里我可以输入椭圆的质心、半轴和方向属性吗
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]
哇!非常感谢你,贝里萨利斯。我的圆实际上是一个椭圆,但我想我能翻译你的答案!这太完美了。谢谢大家!@Tguarton请不要通过邮件与我联系以了解更多详细信息,因为这对其他人没有帮助。如果您需要更多帮助,请在此处发表评论或更新您的问题(第二个选项更好)。Tnx!好的,我更新了我的问题。我的错是一开始没说得很具体。谢谢你的帮助。你的解决方案非常有效,但我遇到了另一个问题。我发布了一个相关的问题,如果你有兴趣看一看的话。我把它作为一个单独的问题,因为它与图像处理更相关。
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]
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]
(*{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]