Plasma Engine  2.0
Loading...
Searching...
No Matches
SimdBBox.h
1#pragma once
2
3#include <Foundation/SimdMath/SimdBSphere.h>
4
6{
7public:
8 PL_DECLARE_POD_TYPE();
9
12
14 plSimdBBox(const plSimdVec4f& vMin, const plSimdVec4f& vMax); // [tested]
15
17 [[nodiscard]] static plSimdBBox MakeZero();
18
20 [[nodiscard]] static plSimdBBox MakeInvalid(); // [tested]
21
23 [[nodiscard]] static plSimdBBox MakeFromCenterAndHalfExtents(const plSimdVec4f& vCenter, const plSimdVec4f& vHalfExtents); // [tested]
24
26 [[nodiscard]] static plSimdBBox MakeFromMinMax(const plSimdVec4f& vMin, const plSimdVec4f& vMax); // [tested]
27
29 [[nodiscard]] static plSimdBBox MakeFromPoints(const plSimdVec4f* pPoints, plUInt32 uiNumPoints, plUInt32 uiStride = sizeof(plSimdVec4f)); // [tested]
30
31public:
33 [[deprecated("Use MakeInvalid() instead.")]] void SetInvalid(); // [tested]
34
36 [[deprecated("Use MakeFromCenterAndHalfExtents() instead.")]] void SetCenterAndHalfExtents(const plSimdVec4f& vCenter, const plSimdVec4f& vHalfExtents); // [tested]
37
39 [[deprecated("Use MakeFromPoints() instead.")]] void SetFromPoints(const plSimdVec4f* pPoints, plUInt32 uiNumPoints, plUInt32 uiStride = sizeof(plSimdVec4f)); // [tested]
40
42 bool IsValid() const; // [tested]
43
45 bool IsNaN() const; // [tested]
46
48 plSimdVec4f GetCenter() const; // [tested]
49
51 plSimdVec4f GetExtents() const; // [tested]
52
54 plSimdVec4f GetHalfExtents() const; // [tested]
55
57 void ExpandToInclude(const plSimdVec4f& vPoint); // [tested]
58
60 void ExpandToInclude(const plSimdVec4f* pPoints, plUInt32 uiNumPoints, plUInt32 uiStride = sizeof(plSimdVec4f)); // [tested]
61
63 void ExpandToInclude(const plSimdBBox& rhs); // [tested]
64
66 void ExpandToCube(); // [tested]
67
68
70 bool Contains(const plSimdVec4f& vPoint) const; // [tested]
71
73 bool Contains(const plSimdBBox& rhs) const; // [tested]
74
76 bool Contains(const plSimdBSphere& sphere) const; // [tested]
77
79 bool Overlaps(const plSimdBBox& rhs) const; // [tested]
80
82 bool Overlaps(const plSimdBSphere& sphere) const; // [tested]
83
84
86 void Grow(const plSimdVec4f& vDiff); // [tested]
87
89 void Translate(const plSimdVec4f& vDiff); // [tested]
90
92 void Transform(const plSimdTransform& transform); // [tested]
93
95 void Transform(const plSimdMat4f& mMat); // [tested]
96
97
100 plSimdVec4f GetClampedPoint(const plSimdVec4f& vPoint) const; // [tested]
101
103 plSimdFloat GetDistanceSquaredTo(const plSimdVec4f& vPoint) const; // [tested]
104
106 plSimdFloat GetDistanceTo(const plSimdVec4f& vPoint) const; // [tested]
107
108
109 bool operator==(const plSimdBBox& rhs) const; // [tested]
110 bool operator!=(const plSimdBBox& rhs) const; // [tested]
111
112public:
113 plSimdVec4f m_Min;
114 plSimdVec4f m_Max;
115};
116
117#include <Foundation/SimdMath/Implementation/SimdBBox_inl.h>
Definition SimdBBox.h:6
void SetFromPoints(const plSimdVec4f *pPoints, plUInt32 uiNumPoints, plUInt32 uiStride=sizeof(plSimdVec4f))
Creates a new bounding-box around the given set of points.
Definition SimdBBox_inl.h:50
plSimdVec4f GetExtents() const
Returns the extents of the box along each axis.
Definition SimdBBox_inl.h:71
static plSimdBBox MakeFromPoints(const plSimdVec4f *pPoints, plUInt32 uiNumPoints, plUInt32 uiStride=sizeof(plSimdVec4f))
Creates a box around the given set of points. If uiNumPoints is zero, the returned box is invalid (sa...
Definition SimdBBox_inl.h:31
void SetInvalid()
Resets the box to an invalid state. ExpandToInclude can then be used to make it into a bounding box f...
Definition SimdBBox_inl.h:38
void SetCenterAndHalfExtents(const plSimdVec4f &vCenter, const plSimdVec4f &vHalfExtents)
Sets the box from a center point and half-extents for each axis.
Definition SimdBBox_inl.h:44
bool Overlaps(const plSimdBBox &rhs) const
Checks whether this box overlaps with the given box.
Definition SimdBBox_inl.h:133
static plSimdBBox MakeZero()
Creates a box that is located at the origin and has zero size. This is a 'valid' box.
Definition SimdBBox_inl.h:11
bool IsNaN() const
Checks whether any component is NaN.
Definition SimdBBox_inl.h:61
static plSimdBBox MakeFromMinMax(const plSimdVec4f &vMin, const plSimdVec4f &vMax)
Creates a box with the given minimum and maximum values.
Definition SimdBBox_inl.h:26
plSimdBBox()
Default constructor does not initialize anything.
plSimdVec4f GetHalfExtents() const
Returns the half extents of the box along each axis.
Definition SimdBBox_inl.h:76
void ExpandToCube()
If the box is not cubic all extents are set to the value of the maximum extent, such that the box bec...
Definition SimdBBox_inl.h:108
bool IsValid() const
Checks whether the box is in an invalid state.
Definition SimdBBox_inl.h:56
void Transform(const plSimdTransform &transform)
Transforms the corners of the box and recomputes the aabb of those transformed points.
Definition SimdBBox_inl.h:156
plSimdVec4f GetClampedPoint(const plSimdVec4f &vPoint) const
The given point is clamped to the volume of the box, i.e. it will be either inside the box or on its ...
Definition SimdBBox_inl.h:175
void ExpandToInclude(const plSimdVec4f &vPoint)
Expands the box such that the given point is inside it.
Definition SimdBBox_inl.h:81
plSimdVec4f GetCenter() const
Returns the center position of the box.
Definition SimdBBox_inl.h:66
static plSimdBBox MakeInvalid()
Creates a box that is in an invalid state. ExpandToInclude can then be used to make it into a boundin...
Definition SimdBBox_inl.h:16
plSimdFloat GetDistanceSquaredTo(const plSimdVec4f &vPoint) const
Returns the squared minimum distance from the box's surface to the point. Zero if the point is inside...
Definition SimdBBox_inl.h:180
bool Contains(const plSimdVec4f &vPoint) const
Checks whether the given point is inside the box.
Definition SimdBBox_inl.h:116
void Translate(const plSimdVec4f &vDiff)
Moves the box by the given vector.
Definition SimdBBox_inl.h:150
static plSimdBBox MakeFromCenterAndHalfExtents(const plSimdVec4f &vCenter, const plSimdVec4f &vHalfExtents)
Creates a box from a center point and half-extents for each axis.
Definition SimdBBox_inl.h:21
void Grow(const plSimdVec4f &vDiff)
Will increase the size of the box in all directions by the given amount (per axis).
Definition SimdBBox_inl.h:144
plSimdFloat GetDistanceTo(const plSimdVec4f &vPoint) const
Returns the minimum distance from the box's surface to the point. Zero if the point is inside the box...
Definition SimdBBox_inl.h:187
Definition SimdBSphere.h:6
Definition SimdFloat.h:7
A 4x4 matrix class.
Definition SimdMat4f.h:7
Definition SimdTransform.h:6
A 4-component SIMD vector class.
Definition SimdVec4f.h:8