18 inline Sphere(
const Float3 &inCenter,
float inRadius) : mCenter(inCenter), mRadius(inRadius) { }
24 float length = inDirection.
Length();
48 Vec3 center = GetCenter();
49 Vec3 d_vec = inPoint - center;
51 if (d_sq >
Square(mRadius))
56 float radius = 0.5f * (mRadius + d);
59 center += (radius - mRadius) / d * d_vec;
#define JPH_NAMESPACE_END
Definition: Core.h:378
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
JPH_INLINE constexpr T Square(T inV)
Square a value.
Definition: Math.h:52
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:31
Axis aligned box.
Definition: AABox.h:16
float GetSqDistanceTo(Vec3Arg inPoint) const
Get the squared distance between inPoint and this box (will be 0 if in Point is inside the box)
Definition: AABox.h:294
Class that holds 3 floats. Used as a storage class. Convert to Vec3 for calculations.
Definition: Float3.h:13
bool Overlaps(const AABox &inOther) const
Check if this sphere overlaps with a box.
Definition: Sphere.h:39
float GetRadius() const
Definition: Sphere.h:30
JPH_OVERRIDE_NEW_DELETE Sphere()=default
Constructor.
Vec3 GetSupport(Vec3Arg inDirection) const
Calculate the support vector for this convex shape.
Definition: Sphere.h:22
Vec3 GetCenter() const
Definition: Sphere.h:29
bool Overlaps(const Sphere &inB) const
Test if two spheres overlap.
Definition: Sphere.h:33
Sphere(Vec3Arg inCenter, float inRadius)
Definition: Sphere.h:19
Sphere(const Float3 &inCenter, float inRadius)
Definition: Sphere.h:18
void EncapsulatePoint(Vec3Arg inPoint)
Create the minimal sphere that encapsulates this sphere and inPoint.
Definition: Sphere.h:45
JPH_INLINE float Length() const
Length of vector.
Definition: Vec3.inl:677
JPH_INLINE void StoreFloat3(Float3 *outV) const
Store 3 floats to memory.
Definition: Vec3.inl:765
JPH_INLINE float LengthSq() const
Squared length of vector.
Definition: Vec3.inl:661
static JPH_INLINE Vec3 sLoadFloat3Unsafe(const Float3 &inV)
Load 3 floats from memory (reads 32 bits extra which it doesn't use)
Definition: Vec3.inl:134