UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Math::TBoxSphereBounds< T, TExtent > Struct Template Reference

#include <BoxSphereBounds.h>

Classes

struct  Builder
 

Public Types

using FReal = T
 

Public Member Functions

 TBoxSphereBounds ()=default
 
 TBoxSphereBounds (EForceInit)
 
 TBoxSphereBounds (const TVector< T > &InOrigin, const TVector< TExtent > &InBoxExtent, TExtent InSphereRadius)
 
 TBoxSphereBounds (const TBox< T > &Box, const TSphere< T > &Sphere)
 
 TBoxSphereBounds (const TBox< T > &Box)
 
 TBoxSphereBounds (const TSphere< T > &Sphere)
 
 TBoxSphereBounds (const TVector< T > *Points, uint32 NumPoints)
 
template<typename TFrom , typename TExtentFrom UE_REQUIRES>
 TBoxSphereBounds (const TBoxSphereBounds< TFrom, TExtentFrom > &From)
 
bool Serialize (FArchive &Ar)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
TBoxSphereBounds< T, TExtentoperator+ (const TBoxSphereBounds< T, TExtent > &Other) const
 
UE_FORCEINLINE_HINT bool operator== (const TBoxSphereBounds< T, TExtent > &Other) const
 
UE_FORCEINLINE_HINT bool operator!= (const TBoxSphereBounds< T, TExtent > &Other) const
 
ComputeSquaredDistanceFromBoxToPoint (const TVector< T > &Point) const
 
UE_FORCEINLINE_HINT TBox< T > GetBox () const
 
TVector< T > GetBoxExtrema (uint32 Extrema) const
 
UE_FORCEINLINE_HINT TSphere< T > GetSphere () const
 
UE_FORCEINLINE_HINT TBoxSphereBounds< T, TExtentExpandBy (TExtent ExpandAmount) const
 
TBoxSphereBounds< T, TExtentTransformBy (const TMatrix< T > &M) const
 
TBoxSphereBounds< T, TExtentTransformBy (const TTransform< T > &M) const
 
FString ToString () const
 
UE_FORCEINLINE_HINT void DiagnosticCheckNaN () const
 
bool ContainsNaN () const
 

Static Public Member Functions

static UE_FORCEINLINE_HINT bool SpheresIntersect (const TBoxSphereBounds< T, TExtent > &A, const TBoxSphereBounds< T, TExtent > &B, TExtent Tolerance=UE_KINDA_SMALL_NUMBER)
 
static UE_FORCEINLINE_HINT bool BoxesIntersect (const TBoxSphereBounds< T, TExtent > &A, const TBoxSphereBounds< T, TExtent > &B)
 

Public Attributes

TVector< T > Origin
 
TVector< TExtentBoxExtent
 
TExtent SphereRadius
 

Friends

TBoxSphereBounds< T, TExtentUnion (const TBoxSphereBounds< T, TExtent > &A, const TBoxSphereBounds< T, TExtent > &B)
 

Member Typedef Documentation

◆ FReal

template<typename T , typename TExtent >
using UE::Math::TBoxSphereBounds< T, TExtent >::FReal = T

Constructor & Destructor Documentation

◆ TBoxSphereBounds() [1/8]

template<typename T , typename TExtent >
UE::Math::TBoxSphereBounds< T, TExtent >::TBoxSphereBounds ( )
default

Default constructor.

◆ TBoxSphereBounds() [2/8]

template<typename T , typename TExtent >
UE::Math::TBoxSphereBounds< T, TExtent >::TBoxSphereBounds ( EForceInit  )
inlineexplicit

Creates and initializes a new instance.

Parameters
EForceInitForce Init Enum.

◆ TBoxSphereBounds() [3/8]

template<typename T , typename TExtent >
UE::Math::TBoxSphereBounds< T, TExtent >::TBoxSphereBounds ( const TVector< T > &  InOrigin,
const TVector< TExtent > &  InBoxExtent,
TExtent  InSphereRadius 
)
inline

Creates and initializes a new instance from the specified parameters.

Parameters
InOriginorigin of the bounding box and sphere.
InBoxExtenthalf size of box.
InSphereRadiusradius of the sphere.

◆ TBoxSphereBounds() [4/8]

template<typename T , typename TExtent >
UE::Math::TBoxSphereBounds< T, TExtent >::TBoxSphereBounds ( const TBox< T > &  Box,
const TSphere< T > &  Sphere 
)
inline

Creates and initializes a new instance from the given Box and Sphere.

Parameters
BoxThe bounding box.
SphereThe bounding sphere.

◆ TBoxSphereBounds() [5/8]

template<typename T , typename TExtent >
UE::Math::TBoxSphereBounds< T, TExtent >::TBoxSphereBounds ( const TBox< T > &  Box)
inline

Creates and initializes a new instance the given Box.

The sphere radius is taken from the extent of the box.

Parameters
BoxThe bounding box.

◆ TBoxSphereBounds() [6/8]

template<typename T , typename TExtent >
UE::Math::TBoxSphereBounds< T, TExtent >::TBoxSphereBounds ( const TSphere< T > &  Sphere)
inline

Creates and initializes a new instance for the given sphere.

◆ TBoxSphereBounds() [7/8]

template<typename T , typename TExtent >
UE::Math::TBoxSphereBounds< T, TExtent >::TBoxSphereBounds ( const TVector< T > *  Points,
uint32  NumPoints 
)
inline

Creates and initializes a new instance from the given set of points.

The sphere radius is taken from the extent of the box.

Parameters
PointsThe points to be considered for the bounding box.
NumPointsNumber of points in the Points array.

◆ TBoxSphereBounds() [8/8]

template<typename T , typename TExtent >
template<typename TFrom , typename TExtentFrom UE_REQUIRES>
UE::Math::TBoxSphereBounds< T, TExtent >::TBoxSphereBounds ( const TBoxSphereBounds< TFrom, TExtentFrom > &  From)
inlineexplicit

Member Function Documentation

◆ BoxesIntersect()

template<typename T , typename TExtent >
static UE_FORCEINLINE_HINT bool UE::Math::TBoxSphereBounds< T, TExtent >::BoxesIntersect ( const TBoxSphereBounds< T, TExtent > &  A,
const TBoxSphereBounds< T, TExtent > &  B 
)
inlinestatic

Test whether the boxes from two BoxSphereBounds intersect/overlap.

Parameters
AFirst BoxSphereBounds to test.
BSecond BoxSphereBounds to test.
Returns
true if boxes intersect, false otherwise.

◆ ComputeSquaredDistanceFromBoxToPoint()

template<typename T , typename TExtent >
T UE::Math::TBoxSphereBounds< T, TExtent >::ComputeSquaredDistanceFromBoxToPoint ( const TVector< T > &  Point) const
inline

Calculates the squared distance from a point to a bounding box

Parameters
PointThe point.
Returns
The distance.

◆ ContainsNaN()

template<typename T , typename TExtent >
bool UE::Math::TBoxSphereBounds< T, TExtent >::ContainsNaN ( ) const
inline

◆ DiagnosticCheckNaN()

template<typename T , typename TExtent >
UE_FORCEINLINE_HINT void UE::Math::TBoxSphereBounds< T, TExtent >::DiagnosticCheckNaN ( ) const
inline

◆ ExpandBy()

template<typename T , typename TExtent >
UE_FORCEINLINE_HINT TBoxSphereBounds< T, TExtent > UE::Math::TBoxSphereBounds< T, TExtent >::ExpandBy ( TExtent  ExpandAmount) const
inline

Increase the size of the box and sphere by a given size.

Parameters
ExpandAmountThe size to increase by.
Returns
A new box with the expanded size.

◆ GetBox()

template<typename T , typename TExtent >
UE_FORCEINLINE_HINT TBox< T > UE::Math::TBoxSphereBounds< T, TExtent >::GetBox ( ) const
inline

Gets the bounding box.

Returns
The bounding box.

◆ GetBoxExtrema()

template<typename T , typename TExtent >
TVector< T > UE::Math::TBoxSphereBounds< T, TExtent >::GetBoxExtrema ( uint32  Extrema) const
inline

Gets the extrema for the bounding box.

Parameters
Extrema1 for positive extrema from the origin, else negative
Returns
The boxes extrema

◆ GetSphere()

template<typename T , typename TExtent >
UE_FORCEINLINE_HINT TSphere< T > UE::Math::TBoxSphereBounds< T, TExtent >::GetSphere ( ) const
inline

Gets the bounding sphere.

Returns
The bounding sphere.

◆ operator!=()

Compare bounding volume this and Other.

Parameters
OtherThe other bounding volume.
Returns
true of they do not match.

◆ operator+()

template<typename T , typename TExtent >
TBoxSphereBounds< T, TExtent > UE::Math::TBoxSphereBounds< T, TExtent >::operator+ ( const TBoxSphereBounds< T, TExtent > &  Other) const
inline

Constructs a bounding volume containing both this and B.

Parameters
OtherThe other bounding volume.
Returns
The combined bounding volume.

◆ operator==()

template<typename T , typename TExtent >
UE_FORCEINLINE_HINT bool UE::Math::TBoxSphereBounds< T, TExtent >::operator== ( const TBoxSphereBounds< T, TExtent > &  Other) const

Compare bounding volume this and Other.

Parameters
OtherThe other bounding volume.
Returns
true of they match.

◆ Serialize()

template<typename T , typename TExtent >
bool UE::Math::TBoxSphereBounds< T, TExtent >::Serialize ( FArchive Ar)
inline

◆ SerializeFromMismatchedTag()

template<typename T , typename TExtent >
bool UE::Math::TBoxSphereBounds< T, TExtent >::SerializeFromMismatchedTag ( FName  StructTag,
FArchive Ar 
)
inline

◆ SpheresIntersect()

template<typename T , typename TExtent >
static UE_FORCEINLINE_HINT bool UE::Math::TBoxSphereBounds< T, TExtent >::SpheresIntersect ( const TBoxSphereBounds< T, TExtent > &  A,
const TBoxSphereBounds< T, TExtent > &  B,
TExtent  Tolerance = UE_KINDA_SMALL_NUMBER 
)
inlinestatic

Test whether the spheres from two BoxSphereBounds intersect/overlap.

Parameters
AFirst BoxSphereBounds to test.
BSecond BoxSphereBounds to test.
ToleranceError tolerance added to test distance.
Returns
true if spheres intersect, false otherwise.

◆ ToString()

template<typename T , typename TExtent >
UE_FORCEINLINE_HINT FString UE::Math::TBoxSphereBounds< T, TExtent >::ToString ( ) const

Get a textual representation of this bounding box.

Returns
Text describing the bounding box.

◆ TransformBy() [1/2]

template<typename T , typename TExtent >
TBoxSphereBounds< T, TExtent > UE::Math::TBoxSphereBounds< T, TExtent >::TransformBy ( const TMatrix< T > &  M) const

Gets a bounding volume transformed by a matrix.

Parameters
MThe matrix.
Returns
The transformed volume.

◆ TransformBy() [2/2]

template<typename T , typename TExtent >
TBoxSphereBounds< T, TExtent > UE::Math::TBoxSphereBounds< T, TExtent >::TransformBy ( const TTransform< T > &  M) const

Gets a bounding volume transformed by a FTransform object.

Parameters
MThe FTransform object.
Returns
The transformed volume.

Friends And Related Symbol Documentation

◆ Union

template<typename T , typename TExtent >
TBoxSphereBounds< T, TExtent > Union ( const TBoxSphereBounds< T, TExtent > &  A,
const TBoxSphereBounds< T, TExtent > &  B 
)
friend

Constructs a bounding volume containing both A and B.

This is a legacy version of the function used to compute primitive bounds, to avoid the need to rebuild lighting after the change.

Member Data Documentation

◆ BoxExtent

Holds the extent of the bounding box.

◆ Origin

Holds the origin of the bounding box and sphere.

◆ SphereRadius

template<typename T , typename TExtent >
TExtent UE::Math::TBoxSphereBounds< T, TExtent >::SphereRadius

Holds the radius of the bounding sphere.


The documentation for this struct was generated from the following file: