Rename to OrientedRectangle

This commit is contained in:
Andreas Torebring
2024-02-29 22:11:57 +01:00
parent 1d878727ec
commit 6a380e381b
5 changed files with 92 additions and 92 deletions
@@ -13,22 +13,22 @@ namespace MonoGame.Extended
/// </summary>
/// <seealso cref="IEquatable{T}" />
[DebuggerDisplay($"{{{nameof(DebugDisplayString)},nq}}")]
public struct OrientedBoundingRectangle : IEquatable<OrientedBoundingRectangle>, IShapeF
public struct OrientedRectangle : IEquatable<OrientedRectangle>, IShapeF
{
/// <summary>
/// The centre position of this <see cref="OrientedBoundingRectangle" />.
/// The centre position of this <see cref="OrientedRectangle" />.
/// </summary>
public Point2 Center;
/// <summary>
/// The distance from the <see cref="Center" /> point along both axes to any point on the boundary of this
/// <see cref="OrientedBoundingRectangle" />.
/// <see cref="OrientedRectangle" />.
/// </summary>
///
public Vector2 Radii;
/// <summary>
/// The rotation matrix <see cref="Matrix2" /> of the bounding rectangle <see cref="OrientedBoundingRectangle" />.
/// The rotation matrix <see cref="Matrix2" /> of the bounding rectangle <see cref="OrientedRectangle" />.
/// </summary>
public Matrix2 Orientation;
@@ -39,7 +39,7 @@ namespace MonoGame.Extended
/// <param name="center">The centre <see cref="Point2" />.</param>
/// <param name="radii">The radii <see cref="Vector2" />.</param>
/// <param name="orientation">The orientation <see cref="Matrix2" />.</param>
public OrientedBoundingRectangle(Point2 center, Size2 radii, Matrix2 orientation)
public OrientedRectangle(Point2 center, Size2 radii, Matrix2 orientation)
{
Center = center;
Radii = radii;
@@ -77,76 +77,76 @@ namespace MonoGame.Extended
public RectangleF BoundingRectangle => (RectangleF)this;
/// <summary>
/// Computes the <see cref="OrientedBoundingRectangle"/> from the specified <paramref name="rectangle"/>
/// Computes the <see cref="OrientedRectangle"/> from the specified <paramref name="rectangle"/>
/// transformed by <paramref name="transformMatrix"/>.
/// </summary>
/// <param name="rectangle">The <see cref="OrientedBoundingRectangle"/> to transform.</param>
/// <param name="rectangle">The <see cref="OrientedRectangle"/> to transform.</param>
/// <param name="transformMatrix">The <see cref="Matrix2"/> transformation.</param>
/// <returns>A new <see cref="OrientedBoundingRectangle"/>.</returns>
public static OrientedBoundingRectangle Transform(OrientedBoundingRectangle rectangle, ref Matrix2 transformMatrix)
/// <returns>A new <see cref="OrientedRectangle"/>.</returns>
public static OrientedRectangle Transform(OrientedRectangle rectangle, ref Matrix2 transformMatrix)
{
Transform(ref rectangle, ref transformMatrix, out var result);
return result;
}
private static void Transform(ref OrientedBoundingRectangle rectangle, ref Matrix2 transformMatrix, out OrientedBoundingRectangle result)
private static void Transform(ref OrientedRectangle rectangle, ref Matrix2 transformMatrix, out OrientedRectangle result)
{
PrimitivesHelper.TransformOrientedBoundingRectangle(
PrimitivesHelper.TransformOrientedRectangle(
ref rectangle.Center,
ref rectangle.Orientation,
ref transformMatrix);
result = new OrientedBoundingRectangle();
result = new OrientedRectangle();
result.Center = rectangle.Center;
result.Radii = rectangle.Radii;
result.Orientation = rectangle.Orientation;
}
/// <summary>
/// Compares to two <see cref="OrientedBoundingRectangle"/> structures. The result specifies whether the
/// Compares to two <see cref="OrientedRectangle"/> structures. The result specifies whether the
/// the values of the <see cref="Center"/>, <see cref="Radii"/> and <see cref="Orientation"/> are
/// equal.
/// </summary>
/// <param name="left">The left <see cref="OrientedBoundingRectangle" />.</param>
/// <param name="right">The right <see cref="OrientedBoundingRectangle" />.</param>
/// <param name="left">The left <see cref="OrientedRectangle" />.</param>
/// <param name="right">The right <see cref="OrientedRectangle" />.</param>
/// <returns><c>true</c> if left and right argument are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(OrientedBoundingRectangle left, OrientedBoundingRectangle right)
public static bool operator ==(OrientedRectangle left, OrientedRectangle right)
{
return left.Equals(right);
}
/// <summary>
/// Compares to two <see cref="OrientedBoundingRectangle"/> structures. The result specifies whether the
/// Compares to two <see cref="OrientedRectangle"/> structures. The result specifies whether the
/// the values of the <see cref="Center"/>, <see cref="Radii"/> or <see cref="Orientation"/> are
/// unequal.
/// </summary>
/// <param name="left">The left <see cref="OrientedBoundingRectangle" />.</param>
/// <param name="right">The right <see cref="OrientedBoundingRectangle" />.</param>
/// <param name="left">The left <see cref="OrientedRectangle" />.</param>
/// <param name="right">The right <see cref="OrientedRectangle" />.</param>
/// <returns><c>true</c> if left and right argument are unequal; otherwise, <c>false</c>.</returns>
public static bool operator !=(OrientedBoundingRectangle left, OrientedBoundingRectangle right)
public static bool operator !=(OrientedRectangle left, OrientedRectangle right)
{
return !left.Equals(right);
}
/// <summary>
/// Determines whether two instances of <see cref="OrientedBoundingRectangle"/> are equal.
/// Determines whether two instances of <see cref="OrientedRectangle"/> are equal.
/// </summary>
/// <param name="other">The other <see cref="OrientedBoundingRectangle"/>.</param>
/// <returns><c>true</c> if the specified <see cref="OrientedBoundingRectangle"/> is equal
/// to the current <see cref="OrientedBoundingRectangle"/>; otherwise, <c>false</c>.</returns>
public bool Equals(OrientedBoundingRectangle other)
/// <param name="other">The other <see cref="OrientedRectangle"/>.</param>
/// <returns><c>true</c> if the specified <see cref="OrientedRectangle"/> is equal
/// to the current <see cref="OrientedRectangle"/>; otherwise, <c>false</c>.</returns>
public bool Equals(OrientedRectangle other)
{
return Center.Equals(other.Center) && Radii.Equals(other.Radii) && Orientation.Equals(other.Orientation);
}
/// <summary>
/// Determines whether two instances of <see cref="OrientedBoundingRectangle"/> are equal.
/// Determines whether two instances of <see cref="OrientedRectangle"/> are equal.
/// </summary>
/// <param name="obj">The <see cref="OrientedBoundingRectangle"/> to compare to.</param>
/// <returns><c>true</c> if the specified <see cref="OrientedBoundingRectangle"/> is equal
/// to the current <see cref="OrientedBoundingRectangle"/>; otherwise, <c>false</c>.</returns>
/// <param name="obj">The <see cref="OrientedRectangle"/> to compare to.</param>
/// <returns><c>true</c> if the specified <see cref="OrientedRectangle"/> is equal
/// to the current <see cref="OrientedRectangle"/>; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
return obj is OrientedBoundingRectangle other && Equals(other);
return obj is OrientedRectangle other && Equals(other);
}
/// <summary>
@@ -159,23 +159,23 @@ namespace MonoGame.Extended
}
/// <summary>
/// Performs an implicit conversion from a <see cref="RectangleF" /> to <see cref="OrientedBoundingRectangle" />.
/// Performs an implicit conversion from a <see cref="RectangleF" /> to <see cref="OrientedRectangle" />.
/// </summary>
/// <param name="rectangle">The rectangle to convert.</param>
/// <returns>The resulting <see cref="OrientedBoundingRectangle" />.</returns>
public static explicit operator OrientedBoundingRectangle(RectangleF rectangle)
/// <returns>The resulting <see cref="OrientedRectangle" />.</returns>
public static explicit operator OrientedRectangle(RectangleF rectangle)
{
var radii = new Size2(rectangle.Width * 0.5f, rectangle.Height * 0.5f);
var centre = new Point2(rectangle.X + radii.Width, rectangle.Y + radii.Height);
return new OrientedBoundingRectangle(centre, radii, Matrix2.Identity);
return new OrientedRectangle(centre, radii, Matrix2.Identity);
}
public static explicit operator RectangleF(OrientedBoundingRectangle orientedBoundingRectangle)
public static explicit operator RectangleF(OrientedRectangle orientedRectangle)
{
var topLeft = orientedBoundingRectangle.Center - orientedBoundingRectangle.Radii;
var rectangle = new RectangleF(topLeft, orientedBoundingRectangle.Radii * 2);
return RectangleF.Transform(rectangle, ref orientedBoundingRectangle.Orientation);
var topLeft = orientedRectangle.Center - orientedRectangle.Radii;
var rectangle = new RectangleF(topLeft, orientedRectangle.Radii * 2);
return RectangleF.Transform(rectangle, ref orientedRectangle.Orientation);
}
/// <summary>
@@ -185,7 +185,7 @@ namespace MonoGame.Extended
/// <param name="other"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static bool Intersects(OrientedBoundingRectangle rectangle, OrientedBoundingRectangle other)
public static bool Intersects(OrientedRectangle rectangle, OrientedRectangle other)
{
var corners = rectangle.Points;
var otherCorners = other.Points;
@@ -248,10 +248,10 @@ namespace MonoGame.Extended
}
/// <summary>
/// Returns a <see cref="string" /> that represents this <see cref="OrientedBoundingRectangle" />.
/// Returns a <see cref="string" /> that represents this <see cref="OrientedRectangle" />.
/// </summary>
/// <returns>
/// A <see cref="string" /> that represents this <see cref="OrientedBoundingRectangle" />.
/// A <see cref="string" /> that represents this <see cref="OrientedRectangle" />.
/// </returns>
public override string ToString()
{
@@ -72,7 +72,7 @@ namespace MonoGame.Extended
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void TransformOrientedBoundingRectangle(
internal static void TransformOrientedRectangle(
ref Point2 center,
ref Matrix2 orientation,
ref Matrix2 transformMatrix)
+17 -17
View File
@@ -38,7 +38,7 @@ namespace MonoGame.Extended
{
CircleF circleA => IntersectsInternal(circleA, shapeB),
RectangleF rectangleA => IntersectsInternal(rectangleA, shapeB),
OrientedBoundingRectangle orientedBoundingRectangleA => IntersectsInternal(orientedBoundingRectangleA, shapeB),
OrientedRectangle orientedRectangleA => IntersectsInternal(orientedRectangleA, shapeB),
_ => throw new ArgumentOutOfRangeException(nameof(shapeA))
};
}
@@ -49,7 +49,7 @@ namespace MonoGame.Extended
{
CircleF otherCircle => CircleF.Intersects(circle, otherCircle),
RectangleF otherRectangle => Intersects(circle, otherRectangle),
OrientedBoundingRectangle otherOrientedBoundingRectangle => Intersects(circle, otherOrientedBoundingRectangle),
OrientedRectangle otherOrientedRectangle => Intersects(circle, otherOrientedRectangle),
_ => throw new ArgumentOutOfRangeException(nameof(shape))
};
}
@@ -60,18 +60,18 @@ namespace MonoGame.Extended
{
CircleF otherCircle => Intersects(otherCircle, rectangle),
RectangleF otherRectangle => RectangleF.Intersects(rectangle, otherRectangle),
OrientedBoundingRectangle otherOrientedBoundingRectangle => Intersects(rectangle, otherOrientedBoundingRectangle),
OrientedRectangle otherOrientedRectangle => Intersects(rectangle, otherOrientedRectangle),
_ => throw new ArgumentOutOfRangeException(nameof(shape))
};
}
private static bool IntersectsInternal(OrientedBoundingRectangle orientedBoundingRectangle, IShapeF shape)
private static bool IntersectsInternal(OrientedRectangle orientedRectangle, IShapeF shape)
{
return shape switch
{
CircleF circleB => Intersects(circleB, orientedBoundingRectangle),
RectangleF rectangleB => Intersects(rectangleB, orientedBoundingRectangle),
OrientedBoundingRectangle orientedBoundingRectangleB => OrientedBoundingRectangle.Intersects(orientedBoundingRectangle, orientedBoundingRectangleB),
CircleF circleB => Intersects(circleB, orientedRectangle),
RectangleF rectangleB => Intersects(rectangleB, orientedRectangle),
OrientedRectangle orientedRectangleB => OrientedRectangle.Intersects(orientedRectangle, orientedRectangleB),
_ => throw new ArgumentOutOfRangeException(nameof(shape))
};
}
@@ -89,30 +89,30 @@ namespace MonoGame.Extended
}
/// <summary>
/// Checks whether a <see cref="CircleF"/> and <see cref="OrientedBoundingRectangle"/> intersects.
/// Checks whether a <see cref="CircleF"/> and <see cref="OrientedRectangle"/> intersects.
/// </summary>
/// <param name="circle"><see cref="CircleF"/>to use in intersection test.</param>
/// <param name="orientedBoundingRectangle"><see cref="OrientedBoundingRectangle"/>to use in intersection test.</param>
/// <param name="orientedRectangle"><see cref="OrientedRectangle"/>to use in intersection test.</param>
/// <returns>True if the circle and oriented bounded rectangle intersects, otherwise false.</returns>
public static bool Intersects(CircleF circle, OrientedBoundingRectangle orientedBoundingRectangle)
public static bool Intersects(CircleF circle, OrientedRectangle orientedRectangle)
{
var rotation = Matrix2.CreateRotationZ(-orientedBoundingRectangle.Orientation.Rotation);
var circleCenterInRectangleSpace = rotation.Transform(circle.Center - orientedBoundingRectangle.Center);
var rotation = Matrix2.CreateRotationZ(-orientedRectangle.Orientation.Rotation);
var circleCenterInRectangleSpace = rotation.Transform(circle.Center - orientedRectangle.Center);
var circleInRectangleSpace = new CircleF(circleCenterInRectangleSpace, circle.Radius);
var rectangleInLocalSpace = OrientedBoundingRectangle.Transform(orientedBoundingRectangle, ref rotation);
var rectangleInLocalSpace = OrientedRectangle.Transform(orientedRectangle, ref rotation);
var boundingRectangle = new BoundingRectangle(rectangleInLocalSpace.Center, rectangleInLocalSpace.Radii);
return circleInRectangleSpace.Intersects(boundingRectangle);
}
/// <summary>
/// Checks if a <see cref="RectangleF"/> and <see cref="OrientedBoundingRectangle"/> intersects.
/// Checks if a <see cref="RectangleF"/> and <see cref="OrientedRectangle"/> intersects.
/// </summary>
/// <param name="rectangleF"></param>
/// <param name="orientedBoundingRectangle"></param>
/// <param name="orientedRectangle"></param>
/// <returns>True if objects are intersecting, otherwise false.</returns>
public static bool Intersects(RectangleF rectangleF, OrientedBoundingRectangle orientedBoundingRectangle)
public static bool Intersects(RectangleF rectangleF, OrientedRectangle orientedRectangle)
{
return OrientedBoundingRectangle.Intersects(orientedBoundingRectangle, (OrientedBoundingRectangle)rectangleF);
return OrientedRectangle.Intersects(orientedRectangle, (OrientedRectangle)rectangleF);
}
}
}
@@ -5,12 +5,12 @@ using Vector2 = Microsoft.Xna.Framework.Vector2;
namespace MonoGame.Extended.Tests.Primitives;
public class OrientedBoundingRectangleTests
public class OrientedRectangleTests
{
[Fact]
public void Initializes_oriented_bounding_rectangle()
public void Initializes_oriented_rectangle()
{
var rectangle = new OrientedBoundingRectangle(new Point2(1, 2), new Size2(3, 4), new Matrix2(5, 6, 7, 8, 9, 10));
var rectangle = new OrientedRectangle(new Point2(1, 2), new Size2(3, 4), new Matrix2(5, 6, 7, 8, 9, 10));
Assert.Equal(new Point2(1, 2), rectangle.Center);
Assert.Equal(new Vector2(3, 4), rectangle.Radii);
@@ -31,21 +31,21 @@ public class OrientedBoundingRectangleTests
new object[]
{
"empty compared with empty is true",
new OrientedBoundingRectangle(Point2.Zero, Size2.Empty, Matrix2.Identity),
new OrientedBoundingRectangle(Point2.Zero, Size2.Empty, Matrix2.Identity)
new OrientedRectangle(Point2.Zero, Size2.Empty, Matrix2.Identity),
new OrientedRectangle(Point2.Zero, Size2.Empty, Matrix2.Identity)
},
new object[]
{
"initialized compared with initialized true",
new OrientedBoundingRectangle(new Point2(1, 2), new Size2(3, 4), new Matrix2(5, 6, 7, 8, 9, 10)),
new OrientedBoundingRectangle(new Point2(1, 2), new Size2(3, 4), new Matrix2(5, 6, 7, 8, 9, 10))
new OrientedRectangle(new Point2(1, 2), new Size2(3, 4), new Matrix2(5, 6, 7, 8, 9, 10)),
new OrientedRectangle(new Point2(1, 2), new Size2(3, 4), new Matrix2(5, 6, 7, 8, 9, 10))
}
};
[Theory]
[MemberData(nameof(_equalsComparisons))]
#pragma warning disable xUnit1026
public void Equals_comparison(string name, OrientedBoundingRectangle first, OrientedBoundingRectangle second)
public void Equals_comparison(string name, OrientedRectangle first, OrientedRectangle second)
#pragma warning restore xUnit1026
{
Assert.True(first == second);
@@ -57,10 +57,10 @@ public class OrientedBoundingRectangleTests
[Fact]
public void Center_point_is_not_translated()
{
var rectangle = new OrientedBoundingRectangle(new Point2(1, 2), new Size2(), Matrix2.Identity);
var rectangle = new OrientedRectangle(new Point2(1, 2), new Size2(), Matrix2.Identity);
var transform = Matrix2.Identity;
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
Assert.Equal(new Point2(1, 2), result.Center);
}
@@ -68,10 +68,10 @@ public class OrientedBoundingRectangleTests
[Fact]
public void Center_point_is_translated()
{
var rectangle = new OrientedBoundingRectangle(new Point2(0, 0), new Size2(), new Matrix2());
var rectangle = new OrientedRectangle(new Point2(0, 0), new Size2(), new Matrix2());
var transform = Matrix2.CreateTranslation(1, 2);
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
Assert.Equal(new Point2(1, 2), result.Center);
}
@@ -79,10 +79,10 @@ public class OrientedBoundingRectangleTests
[Fact]
public void Radii_is_not_changed_by_identity_transform()
{
var rectangle = new OrientedBoundingRectangle(new Point2(), new Size2(10, 20), new Matrix2());
var rectangle = new OrientedRectangle(new Point2(), new Size2(10, 20), new Matrix2());
var transform = Matrix2.Identity;
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
Assert.Equal(new Vector2(10, 20), result.Radii);
}
@@ -90,10 +90,10 @@ public class OrientedBoundingRectangleTests
[Fact]
public void Radii_is_not_changed_by_translation()
{
var rectangle = new OrientedBoundingRectangle(new Point2(1, 2), new Size2(10, 20), new Matrix2());
var rectangle = new OrientedRectangle(new Point2(1, 2), new Size2(10, 20), new Matrix2());
var transform = Matrix2.CreateTranslation(1, 2);
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
Assert.Equal(new Vector2(10, 20), result.Radii);
}
@@ -101,10 +101,10 @@ public class OrientedBoundingRectangleTests
[Fact]
public void Orientation_is_rotated_45_degrees_left()
{
var rectangle = new OrientedBoundingRectangle(new Point2(), new Size2(), Matrix2.Identity);
var rectangle = new OrientedRectangle(new Point2(), new Size2(), Matrix2.Identity);
var transform = Matrix2.CreateRotationZ(MathHelper.PiOver4);
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
Assert.Equal(new Point2(), result.Center);
Assert.Equal(new Vector2(), result.Radii);
@@ -114,11 +114,11 @@ public class OrientedBoundingRectangleTests
[Fact]
public void Orientation_is_rotated_to_45_degrees_from_180()
{
var rectangle = new OrientedBoundingRectangle(new Point2(), new Size2(), Matrix2.CreateRotationZ(MathHelper.Pi));
var rectangle = new OrientedRectangle(new Point2(), new Size2(), Matrix2.CreateRotationZ(MathHelper.Pi));
var transform = Matrix2.CreateRotationZ(-3 * MathHelper.PiOver4);
var expectedOrientation = Matrix2.CreateRotationZ(MathHelper.PiOver4);
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
Assert.Equal(new Point2(), result.Center);
Assert.Equal(new Vector2(), result.Radii);
@@ -133,10 +133,10 @@ public class OrientedBoundingRectangleTests
[Fact]
public void Points_are_same_as_center()
{
var rectangle = new OrientedBoundingRectangle(new Point2(1, 2), new Size2(), Matrix2.Identity);
var rectangle = new OrientedRectangle(new Point2(1, 2), new Size2(), Matrix2.Identity);
var transform = Matrix2.Identity;
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
CollectionAssert.Equal(
new List<Vector2>
@@ -152,10 +152,10 @@ public class OrientedBoundingRectangleTests
[Fact]
public void Points_are_translated()
{
var rectangle = new OrientedBoundingRectangle(new Point2(0, 0), new Size2(2, 4), Matrix2.Identity);
var rectangle = new OrientedRectangle(new Point2(0, 0), new Size2(2, 4), Matrix2.Identity);
var transform = Matrix2.CreateTranslation(10, 20);
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
CollectionAssert.Equal(
new List<Vector2>
@@ -207,13 +207,13 @@ public class OrientedBoundingRectangleTests
* :
* :
*/
var rectangle = new OrientedBoundingRectangle(new Point2(1, 2), new Size2(2, 4), Matrix2.Identity);
var rectangle = new OrientedRectangle(new Point2(1, 2), new Size2(2, 4), Matrix2.Identity);
var transform =
Matrix2.CreateRotationZ(MathHelper.PiOver2)
*
Matrix2.CreateTranslation(10, 20);
var result = OrientedBoundingRectangle.Transform(rectangle, ref transform);
var result = OrientedRectangle.Transform(rectangle, ref transform);
Assert.Equal(8, result.Center.X, 6);
Assert.Equal(21, result.Center.Y, 6);
@@ -85,7 +85,7 @@ public class ShapeTests
}
}
public class OrientedBoundingRectangleTests
public class OrientedRectangleTests
{
[Fact]
public void Axis_aligned_rectangle_intersects_circle()
@@ -99,7 +99,7 @@ public class ShapeTests
* :
* :
*/
IShapeF rectangle = new OrientedBoundingRectangle(Point2.Zero, new Size2(1, 1), Matrix2.Identity);
IShapeF rectangle = new OrientedRectangle(Point2.Zero, new Size2(1, 1), Matrix2.Identity);
var circle = new CircleF(Point2.Zero, 1);
Assert.True(rectangle.Intersects(circle));
@@ -117,7 +117,7 @@ public class ShapeTests
* :
* :
*/
IShapeF rectangle = new OrientedBoundingRectangle(Point2.Zero, new Size2(1, 1), Matrix2.Identity);
IShapeF rectangle = new OrientedRectangle(Point2.Zero, new Size2(1, 1), Matrix2.Identity);
var circle = new CircleF(new Point2(-2, 1), .99f);
Assert.False(rectangle.Intersects(circle));
@@ -135,7 +135,7 @@ public class ShapeTests
* * *
* :* *
*/
IShapeF rectangle = new OrientedBoundingRectangle(new Point2(-1, 1), new Size2(2.8f, 2.8f), Matrix2.CreateRotationZ(MathHelper.PiOver4));
IShapeF rectangle = new OrientedRectangle(new Point2(-1, 1), new Size2(2.8f, 2.8f), Matrix2.CreateRotationZ(MathHelper.PiOver4));
var circle = new CircleF(new Point2(1, -1), 1.4f);
Assert.False(rectangle.Intersects(circle));
@@ -153,7 +153,7 @@ public class ShapeTests
* :**
* :
*/
IShapeF rectangle = new OrientedBoundingRectangle(new Point2(-1, 0), new Size2(1, 1), Matrix2.Identity);
IShapeF rectangle = new OrientedRectangle(new Point2(-1, 0), new Size2(1, 1), Matrix2.Identity);
var rect = new RectangleF(new Point2(0.001f, 0), new Size2(2, 2));
Assert.False(rectangle.Intersects(rect));
@@ -171,7 +171,7 @@ public class ShapeTests
* :**
* :
*/
IShapeF rectangle = new OrientedBoundingRectangle(new Point2(-1, 0), new Size2(1, 1), Matrix2.Identity);
IShapeF rectangle = new OrientedRectangle(new Point2(-1, 0), new Size2(1, 1), Matrix2.Identity);
var rect = new RectangleF(new Point2(0, 0), new Size2(2, 2));
Assert.True(rectangle.Intersects(rect));