Merge pull request #64417 from aaronfranke/has-space

Replace AABB/Rect2/Rect2i has_no_* methods with has_* methods
This commit is contained in:
Rémi Verschelde 2022-09-06 17:00:44 +02:00
commit 5062aafc2d
22 changed files with 126 additions and 119 deletions

View file

@ -47,12 +47,12 @@ struct _NO_DISCARD_ AABB {
Vector3 size;
real_t get_volume() const;
_FORCE_INLINE_ bool has_no_volume() const {
return (size.x <= 0 || size.y <= 0 || size.z <= 0);
_FORCE_INLINE_ bool has_volume() const {
return size.x > 0.0f && size.y > 0.0f && size.z > 0.0f;
}
_FORCE_INLINE_ bool has_no_surface() const {
return (size.x <= 0 && size.y <= 0 && size.z <= 0);
_FORCE_INLINE_ bool has_surface() const {
return size.x > 0.0f || size.y > 0.0f || size.z > 0.0f;
}
const Vector3 &get_position() const { return position; }

View file

@ -140,8 +140,8 @@ struct _NO_DISCARD_ Rect2 {
((p_rect.position.y + p_rect.size.y) <= (position.y + size.y));
}
_FORCE_INLINE_ bool has_no_area() const {
return (size.x <= 0 || size.y <= 0);
_FORCE_INLINE_ bool has_area() const {
return size.x > 0.0f && size.y > 0.0f;
}
// Returns the instersection between two Rect2s or an empty Rect2 if there is no intersection

View file

@ -83,8 +83,8 @@ struct _NO_DISCARD_ Rect2i {
((p_rect.position.y + p_rect.size.y) <= (position.y + size.y));
}
_FORCE_INLINE_ bool has_no_area() const {
return (size.x <= 0 || size.y <= 0);
_FORCE_INLINE_ bool has_area() const {
return size.x > 0 && size.y > 0;
}
// Returns the instersection between two Rect2is or an empty Rect2i if there is no intersection