XII Release 0.1.0
Loading...
Searching...
No Matches
xiiSimdBSphered Class Reference

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

#include <SimdBSphered.h>

Public Member Functions

 XII_DECLARE_POD_TYPE ()
 xiiSimdBSphered ()
 Default constructor does not initialize any data.
 xiiSimdBSphered (const xiiSimdVec4d &vCenter, const xiiSimdDouble &fRadius)
 Creates a sphere with the given radius around the given center.
bool IsValid () const
 Returns whether the sphere has valid values.
bool IsNaN () const
 Returns whether any value is NaN.
xiiSimdVec4d GetCenter () const
 Returns the center.
xiiSimdDouble GetRadius () const
 Returns the radius.
void ExpandToInclude (const xiiSimdVec4d &vPoint)
 Increases the sphere's radius to include this point.
void ExpandToInclude (const xiiSimdVec4d *pPoints, xiiUInt32 uiNumPoints, xiiUInt32 uiStride=sizeof(xiiSimdVec4d))
void ExpandToInclude (const xiiSimdBSphered &rhs)
 Increases this sphere's radius, such that it encloses the other sphere.
void Transform (const xiiSimdTransformd &t)
 Transforms the sphere in its local space.
void Transform (const xiiSimdMat4d &mMat)
 Transforms the sphere in its local space.
xiiSimdDouble GetDistanceTo (const xiiSimdVec4d &vPoint) const
 Computes the distance of the point to the sphere's surface. Returns negative values for points inside the sphere.
xiiSimdDouble GetDistanceTo (const xiiSimdBSphered &rhs) const
bool Contains (const xiiSimdVec4d &vPoint) const
 Returns true if the given point is inside the sphere.
bool Contains (const xiiSimdBSphered &rhs) const
 Returns whether the other sphere is completely inside this sphere.
bool Overlaps (const xiiSimdBSphered &rhs) const
 Checks whether the two objects overlap.
xiiSimdVec4d GetClampedPoint (const xiiSimdVec4d &vPoint)
bool operator== (const xiiSimdBSphered &rhs) const
bool operator!= (const xiiSimdBSphered &rhs) const

Static Public Member Functions

static xiiSimdBSphered MakeZero ()
 Creates a sphere at the origin with radius zero.
static xiiSimdBSphered MakeInvalid (const xiiSimdVec4d &vCenter=xiiSimdVec4d::MakeZero())
static xiiSimdBSphered MakeFromCenterAndRadius (const xiiSimdVec4d &vCenter, const xiiSimdDouble &fRadius)
 Creates a sphere with the provided center and radius.
static xiiSimdBSphered MakeFromPoints (const xiiSimdVec4d *pPoints, xiiUInt32 uiNumPoints, xiiUInt32 uiStride=sizeof(xiiSimdVec4d))

Public Attributes

xiiSimdVec4d m_CenterAndRadius

Detailed Description

Copyright (c) Theophilus Eriata. All Rights Reserved.

Constructor & Destructor Documentation

◆ xiiSimdBSphered()

XII_ALWAYS_INLINE xiiSimdBSphered::xiiSimdBSphered ( )
default

Default constructor does not initialize any data.

Copyright (c) Theophilus Eriata. All Rights Reserved.

Member Function Documentation

◆ ExpandToInclude()

void xiiSimdBSphered::ExpandToInclude ( const xiiSimdVec4d * pPoints,
xiiUInt32 uiNumPoints,
xiiUInt32 uiStride = sizeof(xiiSimdVec4d) )
inline

Increases the sphere's radius to include all given points. Does NOT change its position, thus the resulting sphere might be not a very tight fit. More efficient than calling this for every point individually.

◆ GetClampedPoint()

xiiSimdVec4d xiiSimdBSphered::GetClampedPoint ( const xiiSimdVec4d & vPoint)
inlinenodiscard

Clamps the given position to the volume of the sphere. The resulting point will always be inside the sphere, but have the closest distance to the original point.

◆ GetDistanceTo()

XII_ALWAYS_INLINE xiiSimdDouble xiiSimdBSphered::GetDistanceTo ( const xiiSimdBSphered & rhs) const

Returns the distance between the two spheres. Zero for spheres that are exactly touching each other, negative values for overlapping spheres.

◆ MakeFromPoints()

xiiSimdBSphered xiiSimdBSphered::MakeFromPoints ( const xiiSimdVec4d * pPoints,
xiiUInt32 uiNumPoints,
xiiUInt32 uiStride = sizeof(xiiSimdVec4d) )
inlinestaticnodiscard

Creates a bounding sphere around the provided points.

The center of the sphere will be at the 'center of mass' of all the points, and the radius will be the distance to the farthest point from there.

◆ MakeInvalid()

XII_ALWAYS_INLINE xiiSimdBSphered xiiSimdBSphered::MakeInvalid ( const xiiSimdVec4d & vCenter = xiiSimdVec4d::MakeZero())
staticnodiscard

Creates an 'invalid' sphere, with its center at the given position and a negative radius.

Such a sphere can be made 'valid' through ExpandToInclude(), but be aware that the originally provided center position will always be part of the sphere.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/SimdMath/SimdBSphered.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/SimdMath/Implementation/SimdBSphered_inl.h