当前位置: 首页>>代码示例>>C#>>正文


C# Cluster.add_location方法代码示例

本文整理汇总了C#中Cluster.add_location方法的典型用法代码示例。如果您正苦于以下问题:C# Cluster.add_location方法的具体用法?C# Cluster.add_location怎么用?C# Cluster.add_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cluster的用法示例。


在下文中一共展示了Cluster.add_location方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: calculate_location_test

        public void calculate_location_test()
        {
            Location[] loc = new Location[4];

              loc[0] = new Location(3, 2);
              loc[1] = new Location(3, 3);
              loc[2] = new Location(3, 4);
              loc[3] = new Location(2, 3);

              Cluster clust = new Cluster();
              clust.add_location(loc[0]);
              clust.add_location(loc[1]);
              clust.add_location(loc[2]);
              clust.add_location(loc[3]);

              Location loc2 = clust.location;

              Specify.That(loc2.x).ShouldEqual((float)11/4);
              Specify.That(loc2.y).ShouldEqual((float)12/4);
        }
开发者ID:iamjwc,项目名称:fightin-zigbees,代码行数:20,代码来源:cluster_test.cs

示例2: cluster_add_location_test

        public void cluster_add_location_test()
        {
            Cluster clust = new Cluster();

              for (int i = 0; i < 5; i++)
              {
            Location loc = new Location(2, i);
            clust.add_location(loc);

            Specify.That(clust.locations[i].x).ShouldEqual(2);
            Specify.That(clust.locations[i].y).ShouldEqual(i);
            Specify.That(clust.locations[i].Equals(loc)).ShouldBeTrue();
              }
        }
开发者ID:iamjwc,项目名称:fightin-zigbees,代码行数:14,代码来源:cluster_test.cs

示例3: 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();
              }
        }
开发者ID:iamjwc,项目名称:fightin-zigbees,代码行数:36,代码来源:cluster_test.cs

示例4: 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]);
              }
        }
开发者ID:iamjwc,项目名称:fightin-zigbees,代码行数:33,代码来源:cluster_test.cs


注:本文中的Cluster.add_location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。