33JPH_INLINE
void AABox4Scale(
Vec3Arg inScale,
Vec4Arg inBoxMinX,
Vec4Arg inBoxMinY,
Vec4Arg inBoxMinZ,
Vec4Arg inBoxMaxX,
Vec4Arg inBoxMaxY,
Vec4Arg inBoxMaxZ,
Vec4 &outBoundsMinX,
Vec4 &outBoundsMinY,
Vec4 &outBoundsMinZ,
Vec4 &outBoundsMaxX,
Vec4 &outBoundsMaxY,
Vec4 &outBoundsMaxZ)
36 Vec4 scaled_min_x = scale_x * inBoxMinX;
37 Vec4 scaled_max_x = scale_x * inBoxMaxX;
38 outBoundsMinX =
Vec4::sMin(scaled_min_x, scaled_max_x);
39 outBoundsMaxX =
Vec4::sMax(scaled_min_x, scaled_max_x);
42 Vec4 scaled_min_y = scale_y * inBoxMinY;
43 Vec4 scaled_max_y = scale_y * inBoxMaxY;
44 outBoundsMinY =
Vec4::sMin(scaled_min_y, scaled_max_y);
45 outBoundsMaxY =
Vec4::sMax(scaled_min_y, scaled_max_y);
48 Vec4 scaled_min_z = scale_z * inBoxMinZ;
49 Vec4 scaled_max_z = scale_z * inBoxMaxZ;
50 outBoundsMinZ =
Vec4::sMin(scaled_min_z, scaled_max_z);
51 outBoundsMaxZ =
Vec4::sMax(scaled_min_z, scaled_max_z);
58 ioBoundsMinX -= extent_x;
59 ioBoundsMaxX += extent_x;
62 ioBoundsMinY -= extent_y;
63 ioBoundsMaxY += extent_y;
66 ioBoundsMinZ -= extent_z;
67 ioBoundsMaxZ += extent_z;
107 Vec4 a_half_extents[3] {
108 0.5f * (inBoxMaxX - inBoxMinX),
109 0.5f * (inBoxMaxY - inBoxMinY),
110 0.5f * (inBoxMaxZ - inBoxMinZ) };
113 Vec4 b_half_extents_x = inHalfExtents.
SplatX();
114 Vec4 b_half_extents_y = inHalfExtents.
SplatY();
115 Vec4 b_half_extents_z = inHalfExtents.
SplatZ();
118 UVec4 overlaps =
UVec4(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
122 for (
int i = 0; i < 3; i++)
124 ra = a_half_extents[i];
125 rb = b_half_extents_x * abs_r[0][i] + b_half_extents_y * abs_r[1][i] + b_half_extents_z * abs_r[2][i];
130 for (
int i = 0; i < 3; i++)
132 ra = a_half_extents[0] * abs_r[i][0] + a_half_extents[1] * abs_r[i][1] + a_half_extents[2] * abs_r[i][2];
134 overlaps =
UVec4::sAnd(overlaps,
Vec4::sLessOrEqual((t[0] * inOrientation(0, i) + t[1] * inOrientation(1, i) + t[2] * inOrientation(2, i)).Abs(), ra + rb));
138 ra = a_half_extents[1] * abs_r[0][2] + a_half_extents[2] * abs_r[0][1];
139 rb = b_half_extents_y * abs_r[2][0] + b_half_extents_z * abs_r[1][0];
143 ra = a_half_extents[1] * abs_r[1][2] + a_half_extents[2] * abs_r[1][1];
144 rb = b_half_extents_x * abs_r[2][0] + b_half_extents_z * abs_r[0][0];
148 ra = a_half_extents[1] * abs_r[2][2] + a_half_extents[2] * abs_r[2][1];
149 rb = b_half_extents_x * abs_r[1][0] + b_half_extents_y * abs_r[0][0];
153 ra = a_half_extents[0] * abs_r[0][2] + a_half_extents[2] * abs_r[0][0];
154 rb = b_half_extents_y * abs_r[2][1] + b_half_extents_z * abs_r[1][1];
158 ra = a_half_extents[0] * abs_r[1][2] + a_half_extents[2] * abs_r[1][0];
159 rb = b_half_extents_x * abs_r[2][1] + b_half_extents_z * abs_r[0][1];
163 ra = a_half_extents[0] * abs_r[2][2] + a_half_extents[2] * abs_r[2][0];
164 rb = b_half_extents_x * abs_r[1][1] + b_half_extents_y * abs_r[0][1];
168 ra = a_half_extents[0] * abs_r[0][1] + a_half_extents[1] * abs_r[0][0];
169 rb = b_half_extents_y * abs_r[2][2] + b_half_extents_z * abs_r[1][2];
173 ra = a_half_extents[0] * abs_r[1][1] + a_half_extents[1] * abs_r[1][0];
174 rb = b_half_extents_x * abs_r[2][2] + b_half_extents_z * abs_r[0][2];
178 ra = a_half_extents[0] * abs_r[2][1] + a_half_extents[1] * abs_r[2][0];
179 rb = b_half_extents_x * abs_r[1][2] + b_half_extents_y * abs_r[0][2];
201 return Square(closest_x - inPointX) +
Square(closest_y - inPointY) +
Square(closest_z - inPointZ);
214 Vec4 distance_sq =
AABox4DistanceSqToPoint(inCenterX, inCenterY, inCenterZ, inBoxMinX, inBoxMinY, inBoxMinZ, inBoxMaxX, inBoxMaxY, inBoxMaxZ);
JPH_INLINE UVec4 AABox4VsSphere(Vec4Arg inCenterX, Vec4Arg inCenterY, Vec4Arg inCenterZ, Vec4Arg inRadiusSq, Vec4Arg inBoxMinX, Vec4Arg inBoxMinY, Vec4Arg inBoxMinZ, Vec4Arg inBoxMaxX, Vec4Arg inBoxMaxY, Vec4Arg inBoxMaxZ)
Test 4 AABoxes vs a sphere.
Definition AABox4.h:211
JPH_INLINE UVec4 AABox4VsPoint(Vec3Arg inPoint, Vec4Arg inBoxMinX, Vec4Arg inBoxMinY, Vec4Arg inBoxMinZ, Vec4Arg inBoxMaxX, Vec4Arg inBoxMaxY, Vec4Arg inBoxMaxZ)
Test if 4 bounding boxes overlap with a point.
Definition AABox4.h:71
JPH_NAMESPACE_BEGIN JPH_INLINE UVec4 AABox4VsBox(const AABox &inBox1, Vec4Arg inBox2MinX, Vec4Arg inBox2MinY, Vec4Arg inBox2MinZ, Vec4Arg inBox2MaxX, Vec4Arg inBox2MaxY, Vec4Arg inBox2MaxZ)
Definition AABox4.h:13
JPH_INLINE Vec4 AABox4DistanceSqToPoint(Vec4Arg inPointX, Vec4Arg inPointY, Vec4Arg inPointZ, Vec4Arg inBoxMinX, Vec4Arg inBoxMinY, Vec4Arg inBoxMinZ, Vec4Arg inBoxMaxX, Vec4Arg inBoxMaxY, Vec4Arg inBoxMaxZ)
Get the squared distance between 4 AABoxes and a point.
Definition AABox4.h:193
JPH_INLINE void AABox4EnlargeWithExtent(Vec3Arg inExtent, Vec4 &ioBoundsMinX, Vec4 &ioBoundsMinY, Vec4 &ioBoundsMinZ, Vec4 &ioBoundsMaxX, Vec4 &ioBoundsMaxY, Vec4 &ioBoundsMaxZ)
Enlarge 4 bounding boxes with extent (add to both sides)
Definition AABox4.h:55
JPH_INLINE void AABox4Scale(Vec3Arg inScale, Vec4Arg inBoxMinX, Vec4Arg inBoxMinY, Vec4Arg inBoxMinZ, Vec4Arg inBoxMaxX, Vec4Arg inBoxMaxY, Vec4Arg inBoxMaxZ, Vec4 &outBoundsMinX, Vec4 &outBoundsMinY, Vec4 &outBoundsMinZ, Vec4 &outBoundsMaxX, Vec4 &outBoundsMaxY, Vec4 &outBoundsMaxZ)
Scale 4 axis aligned boxes.
Definition AABox4.h:33
#define JPH_NAMESPACE_END
Definition Core.h:414
#define JPH_NAMESPACE_BEGIN
Definition Core.h:408
JPH_INLINE constexpr T Square(T inV)
Square a value.
Definition Math.h:55
Axis aligned box.
Definition AABox.h:16
Vec3 mMin
Bounding box min and max.
Definition AABox.h:309
Vec3 mMax
Definition AABox.h:310
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition Mat44.h:13
JPH_INLINE Vec3 GetAxisY() const
Definition Mat44.h:148
JPH_INLINE Vec3 GetAxisZ() const
Definition Mat44.h:150
JPH_INLINE Vec3 GetAxisX() const
Access to the columns.
Definition Mat44.h:146
JPH_INLINE Vec3 GetTranslation() const
Definition Mat44.h:152
Oriented box.
Definition OrientedBox.h:18
Mat44 mOrientation
Transform that positions and rotates the local space axis aligned box into world space.
Definition OrientedBox.h:35
Vec3 mHalfExtents
Half extents (half the size of the edge) of the local space axis aligned box.
Definition OrientedBox.h:36
static JPH_INLINE UVec4 sNot(UVec4Arg inV1)
Logical not (component wise)
Definition UVec4.inl:217
static JPH_INLINE UVec4 sAnd(UVec4Arg inV1, UVec4Arg inV2)
Logical and (component wise)
Definition UVec4.inl:202
static JPH_INLINE UVec4 sOr(UVec4Arg inV1, UVec4Arg inV2)
Logical or (component wise)
Definition UVec4.inl:174
JPH_INLINE Vec4 SplatX() const
Replicate the X component to all components.
Definition Vec3.inl:529
JPH_INLINE Vec3 Abs() const
Return the absolute value of each of the components.
Definition Vec3.inl:572
JPH_INLINE Vec4 SplatZ() const
Replicate the Z component to all components.
Definition Vec3.inl:551
JPH_INLINE Vec4 SplatY() const
Replicate the Y component to all components.
Definition Vec3.inl:540
static JPH_INLINE Vec3 sReplicate(float inV)
Replicate inV across all components.
Definition Vec3.inl:114
JPH_INLINE Vec4 SplatX() const
Replicate the X component to all components.
Definition Vec4.inl:558
static JPH_INLINE UVec4 sGreater(Vec4Arg inV1, Vec4Arg inV2)
Greater than (component wise)
Definition Vec4.inl:208
static JPH_INLINE UVec4 sLessOrEqual(Vec4Arg inV1, Vec4Arg inV2)
Less than or equal (component wise)
Definition Vec4.inl:194
JPH_INLINE Vec4 SplatY() const
Replicate the Y component to all components.
Definition Vec4.inl:569
static JPH_INLINE UVec4 sGreaterOrEqual(Vec4Arg inV1, Vec4Arg inV2)
Greater than or equal (component wise)
Definition Vec4.inl:222
static JPH_INLINE Vec4 sMin(Vec4Arg inV1, Vec4Arg inV2)
Return the minimum value of each of the components.
Definition Vec4.inl:138
JPH_INLINE Vec4 SplatZ() const
Replicate the Z component to all components.
Definition Vec4.inl:580
static JPH_INLINE Vec4 sMax(Vec4Arg inV1, Vec4Arg inV2)
Return the maximum of each of the components.
Definition Vec4.inl:152
static JPH_INLINE Vec4 sReplicate(float inV)
Replicate inV across all components.
Definition Vec4.inl:74