コード例 #1
0
 public void Test_GetCentroid_Polygon()
 {
     // Checks that points and polylines are ignored when computing the centroid.
     Assert.True(S2.ApproxEquals(
                     new S2Point(S2.M_PI_4, S2.M_PI_4, S2.M_PI_4),
                     S2ShapeIndexMeasures.GetCentroid(MakeIndexOrDie("5:5 # 6:6, 7:7 # 0:0, 0:90, 90:0"))));
 }
コード例 #2
0
 public void Test_GetCentroid_Polyline()
 {
     // Checks that points are ignored when computing the centroid.
     Assert.True(S2.ApproxEquals(
                     new S2Point(1, 1, 0),
                     S2ShapeIndexMeasures.GetCentroid(MakeIndexOrDie("5:5 | 6:6 # 0:0, 0:90 #"))));
 }
コード例 #3
0
 public void Test_GetCentroid_Polyline()
 {
     // GetCentroid returns the centroid multiplied by the length of the polyline.
     Assert.True(S2.ApproxEquals(
                     new S2Point(1, 1, 0),
                     S2ShapeIndexMeasures.GetCentroid(MakeIndexOrDie("0:0, 0:90"))));
 }
コード例 #4
0
 public void Test_GetCentroid_Points()
 {
     Assert.Equal(new S2Point(1, 1, 0),
                  S2ShapeIndexMeasures.GetCentroid(MakeIndexOrDie("0:0 | 0:90 # #")));
 }
コード例 #5
0
 public void Test_GetCentroid_Empty()
 {
     Assert.Equal(S2Point.Empty, S2ShapeIndexMeasures.GetCentroid(MakeIndexOrDie("# #")));
 }