public IShape GetBounds() { IShape contact = new PolygonRectangle(new RealPoint(Position.Coordinates.X - LenghtBack / 2, Position.Coordinates.Y - Width / 2), LenghtBack + LenghtFront, Width); contact = contact.Rotation(new AngleDelta(Position.Angle)); return(contact); }
public void TestRectangleEqual() { Polygon r0 = new PolygonRectangle(new RealPoint(0, 0), 0, 0); Assert.AreEqual(r0, r0); Assert.AreEqual(r0, r0.Rotation(90)); Assert.AreEqual(r0, r0.Rotation(-180)); Assert.AreEqual(r0, r0.Rotation(-90)); Polygon r1 = new PolygonRectangle(new RealPoint(0, 0), 100, 100); Polygon r2 = new PolygonRectangle(new RealPoint(0, 0), 100, 100); Assert.AreEqual(r1, r1); Assert.AreEqual(r1, r2); Assert.AreEqual(r1, r2.Rotation(90)); Assert.AreEqual(r1, r2.Rotation(180)); Assert.AreEqual(r1, r2.Rotation(-90)); r1 = new PolygonRectangle(new RealPoint(10, 10), 100, 100); r2 = new PolygonRectangle(new RealPoint(10, 10), 100, 100); Assert.AreEqual(r1, r1); Assert.AreEqual(r1, r2); Assert.AreEqual(r1, r2.Rotation(90)); Assert.AreEqual(r1, r2.Rotation(180)); Assert.AreEqual(r1, r2.Rotation(-90)); r1 = new PolygonRectangle(new RealPoint(-10, -10), -100, -100); r2 = new PolygonRectangle(new RealPoint(-10, -10), -100, -100); Assert.AreEqual(r1, r1); Assert.AreEqual(r1, r2); Assert.AreEqual(r1, r2.Rotation(90)); Assert.AreEqual(r1, r2.Rotation(180)); Assert.AreEqual(r1, r2.Rotation(-90)); }