diff options
Diffstat (limited to 'Common/interface')
| -rw-r--r-- | Common/interface/AdvancedMath.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Common/interface/AdvancedMath.h b/Common/interface/AdvancedMath.h index 0a8d0a6b..0039a41a 100644 --- a/Common/interface/AdvancedMath.h +++ b/Common/interface/AdvancedMath.h @@ -173,6 +173,28 @@ enum class BoxVisibility FullyVisible }; +/// Returns the nearest bounding box corner along the given direction +inline float3 GetBoxNearestCorner(const float3& Direction, const BoundBox& Box) +{ + return float3 + { + (Direction.x > 0) ? Box.Min.x : Box.Max.x, + (Direction.y > 0) ? Box.Min.y : Box.Max.y, + (Direction.z > 0) ? Box.Min.z : Box.Max.z + }; +} + +/// Returns the farthest bounding box corner along the given direction +inline float3 GetBoxFarthestCorner(const float3& Direction, const BoundBox& Box) +{ + return float3 + { + (Direction.x > 0) ? Box.Max.x : Box.Min.x, + (Direction.y > 0) ? Box.Max.y : Box.Min.y, + (Direction.z > 0) ? Box.Max.z : Box.Min.z + }; +} + inline BoxVisibility GetBoxVisibilityAgainstPlane(const Plane3D& Plane, const BoundBox& Box) { const float3& Normal = Plane.Normal; |
