3#include <Foundation/Math/Vec3.h>
9template <
typename Type>
14 PL_DECLARE_POD_TYPE();
16 using ComponentType = Type;
41#if PL_ENABLED(PL_MATH_CHECK_FOR_NAN)
42 void AssertNotNaN()
const
44 PL_ASSERT_ALWAYS(!
IsNaN(),
"This object contains NaN values. This can happen when you forgot to initialize it before using it. Please check that "
45 "all code-paths properly initialize this object.");
50 bool IsZero(Type fEpsilon = plMath::DefaultEpsilon<Type>())
const;
73 void Grow(Type fDiff);
155template <
typename Type>
159template <
typename Type>
163#include <Foundation/Math/Implementation/BoundingSphere_inl.h>
An axis-aligned bounding box implementation.
Definition BoundingBox.h:12
An implementation of a bounding sphere.
Definition BoundingSphere.h:11
void Translate(const plVec3Template< Type > &vTranslation)
Moves the sphere by the given vector.
Definition BoundingSphere_inl.h:153
void Grow(Type fDiff)
Increases the size of the sphere by the given amount.
Definition BoundingSphere_inl.h:119
static plBoundingSphereTemplate< Type > MakeFromCenterAndRadius(const plVec3Template< Type > &vCenter, Type fRadius)
Creates a sphere with the provided center and radius.
Definition BoundingSphere_inl.h:35
void TransformFromCenter(const plMat4Template< Type > &mTransform)
Transforms the sphere with the given matrix from its own center. I.e. rotations have no effect,...
Definition BoundingSphere_inl.h:192
bool IsZero(Type fEpsilon=plMath::DefaultEpsilon< Type >()) const
Checks whether the sphere is all zero.
Definition BoundingSphere_inl.h:84
void TransformFromOrigin(const plMat4Template< Type > &mTransform)
Transforms the sphere with the given matrix from the world origin. I.e. scalings and rotations will i...
Definition BoundingSphere_inl.h:183
bool IsIdentical(const plBoundingSphereTemplate &rhs) const
Tests whether two spheres are identical.
Definition BoundingSphere_inl.h:129
void ScaleFromCenter(Type fScale)
Scales the sphere's size, does not change its center position.
Definition BoundingSphere_inl.h:159
bool GetLineSegmentIntersection(const plVec3Template< Type > &vLineStartPos, const plVec3Template< Type > &vLineEndPos, Type *out_pHitFraction=nullptr, plVec3Template< Type > *out_pIntersection=nullptr) const
Returns true if the line segment intersects the sphere.
Definition BoundingSphere_inl.h:376
bool IsValid() const
Returns whether the sphere has valid values.
Definition BoundingSphere_inl.h:90
Type GetDistanceTo(const plVec3Template< Type > &vPoint) const
Computes the distance of the point to the sphere's surface. Returns negative values for points inside...
Definition BoundingSphere_inl.h:201
static plBoundingSphereTemplate< Type > MakeFromPoints(const plVec3Template< Type > *pPoints, plUInt32 uiNumPoints, plUInt32 uiStride=sizeof(plVec3Template< Type >))
Creates a bounding sphere around the provided points.
Definition BoundingSphere_inl.h:45
void ScaleFromOrigin(const plVec3Template< Type > &vScale)
Scales the sphere in world unites, meaning its center position will change as well.
Definition BoundingSphere_inl.h:169
const plVec3Template< Type > GetClampedPoint(const plVec3Template< Type > &vPoint)
Clamps the given position to the volume of the sphere. The resulting point will always be inside the ...
Definition BoundingSphere_inl.h:231
bool Overlaps(const plVec3Template< Type > *pPoints, plUInt32 uiNumPoints, plUInt32 uiStride=sizeof(plVec3Template< Type >)) const
Checks whether any of the given points is inside the sphere.
Definition BoundingSphere_inl.h:270
void ExpandToInclude(const plVec3Template< Type > &vPoint)
Increases the sphere's radius to include this point. Does NOT change its position,...
Definition BoundingSphere_inl.h:102
static plBoundingSphereTemplate< Type > MakeZero()
Creates a sphere at the origin with radius zero.
Definition BoundingSphere_inl.h:17
static plBoundingSphereTemplate< Type > MakeInvalid(const plVec3Template< Type > &vCenter=plVec3Template< Type >::MakeZero())
Creates an 'invalid' sphere, with its center at the given position and a negative radius.
Definition BoundingSphere_inl.h:26
bool IsNaN() const
Returns whether any value is NaN.
Definition BoundingSphere_inl.h:96
bool GetRayIntersection(const plVec3Template< Type > &vRayStartPos, const plVec3Template< Type > &vRayDir, Type *out_pIntersectionDistance=nullptr, plVec3Template< Type > *out_pIntersection=nullptr) const
Computes the intersection of a ray with this sphere. Returns true if there was an intersection....
Definition BoundingSphere_inl.h:337
plBoundingSphereTemplate()
Default constructor does not initialize any data.
Definition BoundingSphere_inl.h:6
bool IsEqual(const plBoundingSphereTemplate &rhs, Type fEpsilon=plMath::DefaultEpsilon< Type >()) const
Tests whether two spheres are equal within some threshold.
Definition BoundingSphere_inl.h:135
bool Contains(const plVec3Template< Type > &vPoint) const
Returns true if the given point is inside the sphere.
Definition BoundingSphere_inl.h:213
const plBoundingBoxTemplate< Type > GetBoundingBox() const
Returns a bounding box that encloses this sphere.
Definition AllClasses_inl.h:88
A 4x4 component matrix class.
Definition Mat4.h:11
A 3-component vector class.
Definition Vec3.h:9