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")))); }
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 #")))); }
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")))); }
public void Test_GetCentroid_Points() { Assert.Equal(new S2Point(1, 1, 0), S2ShapeIndexMeasures.GetCentroid(MakeIndexOrDie("0:0 | 0:90 # #"))); }
public void Test_GetCentroid_Empty() { Assert.Equal(S2Point.Empty, S2ShapeIndexMeasures.GetCentroid(MakeIndexOrDie("# #"))); }