Exemplo n.º 1
0
        public void PolygonCentroid()
        {
            PointD p0 = new PointD(0, 0), p1 = new PointD(1, 1), p2 = new PointD(2, 0);
            PointD p3 = new PointD(0, 2), p4 = new PointD(2, 2);

            Assert.AreEqual(new PointD(1, 1 / 3.0), GeoAlgorithms.PolygonCentroid(p0, p1, p2));
            Assert.AreEqual(new PointD(1, 1 / 3.0), GeoAlgorithms.PolygonCentroid(p2, p1, p0));

            Assert.AreEqual(p1, GeoAlgorithms.PolygonCentroid(p0, p3, p4, p2));
            Assert.AreEqual(p1, GeoAlgorithms.PolygonCentroid(p2, p4, p3, p0));
        }