示例#1
0
        public void TestPolygonAABB()
        {
            PolygonShape polygonShape = new PolygonShape(new Vector2[]
            {
                new Vector2(-14.5f, 18.5f),
                new Vector2(14.5f, 18.5f),
                new Vector2(14.5f, 21.5f),
                new Vector2(-14.5f, 21.5f)
            }
                                                         );

            Collision.Transform polygonTransform = new Collision.Transform(new Vector2(-1709.34f, 402.0f), 1.2456f);


            Vector2 lb;
            Vector2 ub;

            polygonShape.GetAABB(polygonTransform, out lb, out ub);

            Console.WriteLine("Polygon LB: " + lb);
            Assert.That(VectorEquals(lb, new Vector2(-1734.346f, 394.1706f)), "PolygonShape.GetAABB() lower bound is incorrect");
            Console.WriteLine("Polygon UB: " + ub);
            Assert.That(VectorEquals(ub, new Vector2(-1722.238f, 422.6092f)), "PolygonShape.GetAABB() upper bound is incorrect");
        }