Skip to content

Commit 415d38e

Browse files
committed
added Test_b2AABB_Overlaps
1 parent 020b125 commit 415d38e

3 files changed

Lines changed: 185 additions & 2 deletions

File tree

src/Box2D.NET/B2AABBs.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
// SPDX-FileCopyrightText: 2025 Ikpil Choi(ikpil@naver.com)
33
// SPDX-License-Identifier: MIT
44

5+
using System.Runtime.CompilerServices;
56
using static Box2D.NET.B2MathFunction;
67

78
namespace Box2D.NET
89
{
910
public static class B2AABBs
1011
{
1112
// Get surface area of an AABB (the perimeter length)
13+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1214
public static float b2Perimeter(B2AABB a)
1315
{
1416
float wx = a.upperBound.X - a.lowerBound.X;
@@ -49,14 +51,18 @@ public static bool b2EnlargeAABB(ref B2AABB a, B2AABB b)
4951
}
5052

5153
/// Do a and b overlap
54+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
5255
public static bool b2AABB_Overlaps(B2AABB a, B2AABB b)
5356
{
54-
return !(b.lowerBound.X > a.upperBound.X || b.lowerBound.Y > a.upperBound.Y || a.lowerBound.X > b.upperBound.X ||
57+
return !(b.lowerBound.X > a.upperBound.X ||
58+
b.lowerBound.Y > a.upperBound.Y ||
59+
a.lowerBound.X > b.upperBound.X ||
5560
a.lowerBound.Y > b.upperBound.Y);
5661
}
5762

5863

5964
/// Is this a valid bounding box? Not Nan or infinity. Upper bound greater than or equal to lower bound.
65+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6066
public static bool b2IsValidAABB(B2AABB a)
6167
{
6268
B2Vec2 d = b2Sub(a.upperBound, a.lowerBound);

0 commit comments

Comments
 (0)