mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 12:43:19 +02:00
Adding AABox::touches(box)
This commit is contained in:
parent
dbde1a29fe
commit
52511b2baf
2 changed files with 8 additions and 0 deletions
|
@ -117,6 +117,13 @@ bool AABox::contains(const AABox& otherBox) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AABox::touches(const AABox& otherBox) const {
|
||||
glm::vec3 relativeCenter = _corner - otherBox._corner + (glm::vec3(_scale - otherBox._scale) * 0.5f);
|
||||
float totalScale = _scale + otherBox._scale;
|
||||
return fabs(relativeCenter.x) <= totalScale &&
|
||||
fabs(relativeCenter.y) <= totalScale &&
|
||||
fabs(relativeCenter.z) <= totalScale;
|
||||
}
|
||||
|
||||
// determines whether a value is within the expanded extents
|
||||
static bool isWithinExpanded(float value, float corner, float size, float expansion) {
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
|
||||
bool contains(const glm::vec3& point) const;
|
||||
bool contains(const AABox& otherBox) const;
|
||||
bool touches(const AABox& otherBox) const;
|
||||
bool expandedContains(const glm::vec3& point, float expansion) const;
|
||||
bool expandedIntersectsSegment(const glm::vec3& start, const glm::vec3& end, float expansion) const;
|
||||
bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, BoxFace& face) const;
|
||||
|
|
Loading…
Reference in a new issue