Beispiel #1
0
        public void GetFixtureEdgeCoordTest3()
        {
            Scene scene = new Scene();
            Vector2[] vertices = GetVertices();
            Actor actor = new Actor(scene, vertices);
            actor.SetTransform(new Transform2(new Vector2(), 1, 0, true));
            PolygonCoord polyCoord = new PolygonCoord(4, 0.4f);
            FixtureCoord fixtureCoord = FixtureExt.GetFixtureEdgeCoord(actor, polyCoord);

            Assert.IsTrue(PolygonExt.GetTransform(vertices, polyCoord) == PolygonExt.GetTransform(fixtureCoord));
        }
Beispiel #2
0
        public void GetFixtureEdgeCoordTest0()
        {
            Scene scene = new Scene();
            Vector2[] vertices = new Vector2[] {
                new Vector2(-1, -1),
                new Vector2(1, -1),
                new Vector2(1, 1),
                new Vector2(-1, 1)
            };
            Actor actor = new Actor(scene, vertices);
            PolygonCoord polyCoord = new PolygonCoord(3, 0.4f);
            FixtureCoord fixtureCoord = FixtureExt.GetFixtureEdgeCoord(actor, polyCoord);

            Assert.IsTrue(fixtureCoord.EdgeT == polyCoord.EdgeT);
            Assert.IsTrue(PolygonExt.GetTransform(vertices, polyCoord) == PolygonExt.GetTransform(fixtureCoord));
        }
Beispiel #3
0
        public void GetFixtureEdgeCoordTest2()
        {
            Scene scene = new Scene();
            Vector2[] vertices = new Vector2[] {
                new Vector2(0, 0),
                new Vector2(1, 0),
                new Vector2(1, 1),
                new Vector2(0, 1)
            };
            Actor actor = new Actor(scene, vertices);
            actor.SetTransform(new Transform2(new Vector2(), 1, 0, true));
            PolygonCoord polyCoord = new PolygonCoord(0, 0f);
            FixtureCoord fixtureCoord = FixtureExt.GetFixtureEdgeCoord(actor, polyCoord);

            Transform2 expected = PolygonExt.GetTransform(actor.GetWorldVertices(), polyCoord);
            Transform2 result = PolygonExt.GetTransform(fixtureCoord);
            Assert.IsTrue(expected.AlmostEqual(result));
        }
Beispiel #4
0
 public WallCoord(IWall wall, PolygonCoord coord)
     : this(wall, coord.EdgeIndex, coord.EdgeT)
 {
 }