本文整理汇总了C#中Cluster.convex_hull方法的典型用法代码示例。如果您正苦于以下问题:C# Cluster.convex_hull方法的具体用法?C# Cluster.convex_hull怎么用?C# Cluster.convex_hull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cluster
的用法示例。
在下文中一共展示了Cluster.convex_hull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: convex_hull_test
public void convex_hull_test()
{
Location[] loc = new Location[7];
Cluster clust = new Cluster();
List<Location> expected = new List<Location>();
loc[0] = new Location(3, 2);
loc[1] = new Location(3, 3);
loc[2] = new Location(3, 4);
loc[3] = new Location(2, 3);
loc[4] = new Location(2, 1);
loc[5] = new Location(1, 2);
loc[6] = new Location(1, 4);
clust.add_location(loc[0]);
clust.add_location(loc[1]);
clust.add_location(loc[2]);
clust.add_location(loc[3]);
clust.add_location(loc[4]);
clust.add_location(loc[5]);
clust.add_location(loc[6]);
expected.Add(loc[4]);
expected.Add(loc[5]);
expected.Add(loc[6]);
expected.Add(loc[2]);
expected.Add(loc[1]);
expected.Add(loc[0]);
List<Location> ch = clust.convex_hull();
for(int i = 0; i < 4; i++)
{
Specify.That(ch[i].Equals(expected[i])).ShouldBeTrue();
}
}
示例2: second_convex_hull_test
public void second_convex_hull_test()
{
Cluster clust = new Cluster();
List<Location> expected = new List<Location>();
Location[] loc = new Location[]
{
new Location(2, 0),
new Location(0, 2),
new Location(2, 4),
new Location(2, 1),
new Location(2, 2),
new Location(4, 2)
};
clust.add_location(loc[0]);
clust.add_location(loc[1]);
clust.add_location(loc[2]);
clust.add_location(loc[3]);
clust.add_location(loc[4]);
clust.add_location(loc[5]);
expected.Add(loc[0]);
expected.Add(loc[1]);
expected.Add(loc[3]);
expected.Add(loc[5]);
List<Location> ch = clust.convex_hull();
for (int i = 0; i < 4; i++)
{
Specify.That(ch[i]).ShouldEqual(expected[i]);
}
}