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)`
  • Loading branch information
AThousandShips committed Jan 16, 2024
1 parent 107f296 commit 227a165
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 @@ -98,11 +98,11 @@ public readonly bool Encloses(Aabb with)
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 @@ -123,8 +123,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 @@ -113,8 +113,8 @@ public readonly Rect2I Intersection(Rect2I b)
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 227a165

Please sign in to comment.