private static void MinkowskiRectangleSumTest()
 {
     Vector2 v1 = new Vector2(0, 0), v2 = new Vector2(1, 0),
             v3 = new Vector2(1, 1), v4 = new Vector2(0, 1),
             w1 = new Vector2(1, 1), w2 = new Vector2(2, 1),
             w3 = new Vector2(2, 2), w4 = new Vector2(1, 2),
             u1 = new Vector2(1, 1), u2 = new Vector2(3, 1),
             u3 = new Vector2(3, 3), u4 = new Vector2(1, 3);
     var polygon1 = new ConvexPolygon(new[] { v1, v2, v3, v4 });
     var polygon2 = new ConvexPolygon(new[] { w1, w2, w3, w4 });
     var polygon3 = new ConvexPolygon(new[] { u1, u2, u3, u4 });
     var sum = ConvexPolygon.MinkowskiSum(polygon1, polygon2);
     Debug.Assert(sum.ToString() == polygon3.ToString());
 }
        private static void MinkowskiTriangleSumTest()
        {
            Vector2 v1 = new Vector2(0, -1), v2 = new Vector2(1, 0), v3 = new Vector2(0, 1),
                    w1 = new Vector2(1, -1), w2 = new Vector2(1, 1), w3 = new Vector2(0, 0),
                    u1 = new Vector2(1, -2), u2 = new Vector2(2, -1), u3 = new Vector2(2, 1),
                    u4 = new Vector2(1, 2), u5 = new Vector2(0, 1), u6 = new Vector2(0, -1);
            var polygon1 = new ConvexPolygon(new[] { v1, v2, v3 });
            var polygon2 = new ConvexPolygon(new[] { w1, w2, w3 });
            var polygon3 = new ConvexPolygon(new[] { u1, u2, u3, u4, u5, u6 });
            var sum = ConvexPolygon.MinkowskiSum(polygon1, polygon2);
            Debug.Assert(sum.ToString() == polygon3.ToString());

            Debug.Assert(polygon1.ContainsPoint(new Vector2(0.5, 0.25)));
            Debug.Assert(!polygon1.ContainsPoint(new Vector2(2, 4)));
            Debug.Assert(!polygon1.ContainsPoint(v1));
            Debug.Assert(!polygon1.ContainsPoint((v1 + v2)/2));
        }