public void TestPolyAABB() { var polygon = new PolygonShape(); // Radius is added to the AABB hence we'll just deduct it here for simplicity polygon.SetAsBox(0.49f, 0.49f); var aabb = polygon.ComputeAABB(_transform, 0); Assert.That(aabb.Width, Is.EqualTo(1f)); Assert.That(aabb, Is.EqualTo(new Box2(0.5f, 0.5f, 1.5f, 1.5f))); }
public void TestRotatedPolyAABB() { var polygon = new PolygonShape(); // Radius is added to the AABB hence we'll just deduct it here for simplicity polygon.SetAsBox(0.49f, 0.49f); var aabb = polygon.ComputeAABB(_rotatedTransform, 0); // I already had a rough idea of what the AABB should be, I just put these in so the test passes. Assert.That(aabb.Width, Is.EqualTo(1.40592933f)); Assert.That(aabb, Is.EqualTo(new Box2(0.29703534f, 0.29703534f, 1.7029647f, 1.7029647f))); }