如何从形状或点集合中检索外部点?

时间:2018-10-05 06:38:44

标签: c# algorithm image-processing graphics

我这里有这个点集,

<Polyline Points="568,263,568,262,568,262,568,260,568,260,568,259,568,257,568,257,568,256,567,256,567,256,567,255,567,255,567,255,567,255,567,255,567,254,567,254,566,254,566,254,567,253,566,253,566,253,566,252,566,252,566,251,565,251,565,250,565,250,565,250,565,250,565,250,565,249,564,249,564,249,564,248,564,248" Stroke="Black" StrokeThickness="1" />
<Polyline Points="544,238,545,238,546,238,548,238,549,239,550,239,551,239,551,239,552,239,552,240,553,240,553,240,554,240,554,240,555,241,556,241,556,241,557,241,557,241,557,242,557,242,557,242,558,242,558,242,558,243,558,243,559,243,559,243,559,243,559,244,560,244,560,244,560,244,560,244,561,245,561,245,561,245,561,245,562,245,562,245,562,246,562,246" Stroke="Black" StrokeThickness="1" />
<Polyline Points="544,238,563,247,568,263,544,263,544,238,544,238" Stroke="Black" StrokeThickness="1" />
<Polyline Points="557,244,559,245,560,245,561,245,562,246,562,246,563,247,563,247,563,247,563,248,557,248,557,243,557,243" Stroke="Black" StrokeThickness="1" />
<Polyline Points="520,263,520,262,520,262,520,260,520,260,520,259,520,257,520,257,520,256,521,256,521,256,521,255,521,255,521,255,521,255,521,255,521,254,521,254,522,254,522,254,521,253,522,253,522,253,522,252,522,252,522,251,523,251,523,250,523,250,523,250,523,250,523,250,523,249,524,249,524,249,524,248,524,248" Stroke="Black" StrokeThickness="1" />
<Polyline Points="544,238,543,238,542,238,540,238,539,239,538,239,537,239,537,239,536,239,536,240,535,240,535,240,534,240,534,240,533,241,532,241,532,241,531,241,531,241,531,242,531,242,531,242,530,242,530,242,530,243,530,243,529,243,529,243,529,243,529,244,528,244,528,244,528,244,528,244,527,245,527,245,527,245,527,245,526,245,526,245,526,246,526,246" Stroke="Black" StrokeThickness="1" />
<Polyline Points="544,238,525,247,520,263,544,263,544,238,544,238" Stroke="Black" StrokeThickness="1"  />

此Point集合具有以下形状,

enter image description here

我需要没有内部形状的外部点。 我需要这样的输出图像enter image description here

我还尝试使用算法查找外部点。

ref链接:Graham scan  但是我没有得到任何指导我的确切结果。提前致谢。

1 个答案:

答案 0 :(得分:0)

我得到了这个答案。

我合并所有点,并使用凸包算法,将获得外部点。

convex hull algorithm reference Project