mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-25 08:22:15 +00:00
fixed a bug in the circle torectangle method
This commit is contained in:
@@ -181,7 +181,9 @@ namespace MonoGame.Extended.Tests.Shapes
|
||||
[Test]
|
||||
public void Circle_ToRectangleTest()
|
||||
{
|
||||
Assert.AreEqual(new Rectangle(150, 250, 100, 100), new Circle(new Vector2(200.0f, 300.0f), 100.0f).ToRectangle());
|
||||
var actual = new Circle(center: new Vector2(200, 300), radius: 100).ToRectangle();
|
||||
var expected = new Rectangle(100, 200, 200, 200);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,10 +415,7 @@ namespace MonoGame.Extended.Shapes
|
||||
/// <returns><see cref="Rectangle"/> which contains this <see cref="Circle"/></returns>
|
||||
public Rectangle ToRectangle()
|
||||
{
|
||||
return new Rectangle((int)(Center.X - (Radius / 2.0f)),
|
||||
(int)(Center.Y - (Radius / 2.0f)),
|
||||
(int)Radius,
|
||||
(int)Radius);
|
||||
return new Rectangle((int)(Center.X - Radius), (int)(Center.Y - Radius), (int)Radius * 2, (int)Radius * 2);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user