Skip to content

Commit

Permalink
[C#] Fix Encloses failing on shared upper bound for AABB and
Browse files Browse the repository at this point in the history
`Rect2(I)`

(cherry picked from commit 227a165)
  • Loading branch information
AThousandShips authored and YuriSizov committed Jan 25, 2024
1 parent ad57a98 commit e070bbc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public Vector3 End
Vector3 dstMax = with._position + with._size;

return srcMin.X <= dstMin.X &&
srcMax.X > dstMax.X &&
srcMax.X >= dstMax.X &&
srcMin.Y <= dstMin.Y &&
srcMax.Y > dstMax.Y &&
srcMax.Y >= dstMax.Y &&
srcMin.Z <= dstMin.Z &&
srcMax.Z > dstMax.Z;
srcMax.Z >= dstMax.Z;
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public bool IsFinite()
public readonly bool Encloses(Rect2 b)
{
return b._position.X >= _position.X && b._position.Y >= _position.Y &&
b._position.X + b._size.X < _position.X + _size.X &&
b._position.Y + b._size.Y < _position.Y + _size.Y;
b._position.X + b._size.X <= _position.X + _size.X &&
b._position.Y + b._size.Y <= _position.Y + _size.Y;
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public Vector2I End
public readonly bool Encloses(Rect2I b)
{
return b._position.X >= _position.X && b._position.Y >= _position.Y &&
b._position.X + b._size.X < _position.X + _size.X &&
b._position.Y + b._size.Y < _position.Y + _size.Y;
b._position.X + b._size.X <= _position.X + _size.X &&
b._position.Y + b._size.Y <= _position.Y + _size.Y;
}

/// <summary>
Expand Down

0 comments on commit e070bbc

Please sign in to comment.