mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 16:12:35 +00:00
Refactored Model to make faces first class objects for use in AABBTree, renamed BoundingBox.intersect to intersect?
This commit is contained in:
@@ -26,13 +26,6 @@ class IMICFPS
|
||||
return temp
|
||||
end
|
||||
|
||||
# returns whether both bounding boxes intersect
|
||||
def intersect(other)
|
||||
(@min.x <= other.max.x && @max.x >= other.min.x) &&
|
||||
(@min.y <= other.max.y && @max.y >= other.min.y) &&
|
||||
(@min.z <= other.max.z && @max.z >= other.min.z)
|
||||
end
|
||||
|
||||
# returns the difference between both bounding boxes
|
||||
def difference(other)
|
||||
temp = BoundingBox.new
|
||||
@@ -42,6 +35,13 @@ class IMICFPS
|
||||
return temp
|
||||
end
|
||||
|
||||
# returns whether both bounding boxes intersect
|
||||
def intersect?(other)
|
||||
(@min.x <= other.max.x && @max.x >= other.min.x) &&
|
||||
(@min.y <= other.max.y && @max.y >= other.min.y) &&
|
||||
(@min.z <= other.max.z && @max.z >= other.min.z)
|
||||
end
|
||||
|
||||
# does this bounding box envelop other bounding box? (inclusive of border)
|
||||
def contains?(other)
|
||||
other.min.x >= min.x && other.min.y >= min.y && other.min.z >= min.z &&
|
||||
|
||||
Reference in New Issue
Block a user