Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
UE::Math::TBox< T > Struct Template Reference

#include <Box.h>

Public Types

using FReal = T
 

Public Member Functions

 TBox ()
 
 TBox (EForceInit)
 
constexpr TBox (EForceInit, TBoxConstInit)
 
template<typename FArg >
 TBox (const TVector< FArg > &InMin, const TVector< FArg > &InMax)
 
 TBox (const TVector4< T > &InMin, const TVector4< T > &InMax)
 
 TBox (const TVector< T > *Points, int32 Count)
 
 TBox (const TArray< TVector< T > > &Points)
 
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
 TBox (const TBox< FArg > &From)
 
FORCEINLINE bool operator== (const TBox< T > &Other) const
 
FORCEINLINE bool operator!= (const TBox< T > &Other) const
 
bool Equals (const TBox< T > &Other, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
FORCEINLINE TBox< T > & operator+= (const TVector< T > &Other)
 
FORCEINLINE TBox< Toperator+ (const TVector< T > &Other) const
 
FORCEINLINE TBox< T > & operator+= (const TBox< T > &Other)
 
FORCEINLINE TBox< Toperator+ (const TBox< T > &Other) const
 
FORCEINLINE TVector< T > & operator[] (int32 Index)
 
FORCEINLINE T ComputeSquaredDistanceToPoint (const TVector< T > &Point) const
 
FORCEINLINE T ComputeSquaredDistanceToBox (const TBox< T > &Box) const
 
UE_NODISCARD FORCEINLINE TBox< TExpandBy (T W) const
 
UE_NODISCARD FORCEINLINE TBox< TExpandBy (const TVector< T > &V) const
 
UE_NODISCARD TBox< TExpandBy (const TVector< T > &Neg, const TVector< T > &Pos) const
 
UE_NODISCARD FORCEINLINE TBox< TShiftBy (const TVector< T > &Offset) const
 
UE_NODISCARD FORCEINLINE TBox< TMoveTo (const TVector< T > &Destination) const
 
FORCEINLINE TVector< TGetCenter () const
 
FORCEINLINE void GetCenterAndExtents (TVector< T > &Center, TVector< T > &Extents) const
 
FORCEINLINE TVector< TGetClosestPointTo (const TVector< T > &Point) const
 
FORCEINLINE TVector< TGetExtent () const
 
FORCEINLINE TVector< T > & GetExtrema (int PointIndex)
 
FORCEINLINE const TVector< T > & GetExtrema (int PointIndex) const
 
FORCEINLINE TVector< TGetSize () const
 
FORCEINLINE T GetVolume () const
 
FORCEINLINE void Init ()
 
FORCEINLINE bool Intersect (const TBox< T > &Other) const
 
FORCEINLINE bool IntersectXY (const TBox< T > &Other) const
 
UE_NODISCARD TBox< TOverlap (const TBox< T > &Other) const
 
UE_NODISCARD TBox< TInverseTransformBy (const TTransform< T > &M) const
 
FORCEINLINE bool IsInside (const TVector< T > &In) const
 
FORCEINLINE bool IsInsideOrOn (const TVector< T > &In) const
 
FORCEINLINE bool IsInside (const TBox< T > &Other) const
 
FORCEINLINE bool IsInsideXY (const TVector< T > &In) const
 
FORCEINLINE bool IsInsideOrOnXY (const FVector &In) const
 
FORCEINLINE bool IsInsideXY (const TBox< T > &Other) const
 
UE_NODISCARD TBox< TTransformBy (const TMatrix< T > &M) const
 
UE_NODISCARD TBox< TTransformBy (const TTransform< T > &M) const
 
UE_NODISCARD TBox< TTransformProjectBy (const TMatrix< T > &ProjM) const
 
FString ToString () const
 
void GetVertices (TVector< T >(&Vertices)[8]) const
 
bool Serialize (FArchive &Ar)
 
bool Serialize (FStructuredArchive::FSlot Slot)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 

Static Public Member Functions

static TBox< TBuildAABB (const TVector< T > &Origin, const TVector< T > &Extent)
 

Public Attributes

TVector< TMin
 
TVector< TMax
 
uint8 IsValid
 

Friends

FArchiveoperator<< (FArchive &Ar, TBox< T > &Box)
 
void operator<< (FStructuredArchive::FSlot Slot, TBox< T > &Box)
 

Detailed Description

template<typename T>
struct UE::Math::TBox< T >

Definition at line 25 of file Box.h.

Member Typedef Documentation

◆ FReal

template<typename T >
using UE::Math::TBox< T >::FReal = T

Definition at line 28 of file Box.h.

Constructor & Destructor Documentation

◆ TBox() [1/8]

template<typename T >
UE::Math::TBox< T >::TBox ( )
inline

Default constructor (no initialization).

Definition at line 42 of file Box.h.

◆ TBox() [2/8]

template<typename T >
UE::Math::TBox< T >::TBox ( EForceInit )
inlineexplicit

Creates and initializes a new box with zero extent and marks it as invalid.

Use enum value EForceInit::ForceInit to force box initialization.

Definition at line 49 of file Box.h.

◆ TBox() [3/8]

template<typename T >
constexpr UE::Math::TBox< T >::TBox ( EForceInit ,
TBoxConstInit  )
inlineconstexpr

Definition at line 54 of file Box.h.

◆ TBox() [4/8]

template<typename T >
template<typename FArg >
UE::Math::TBox< T >::TBox ( const TVector< FArg > & InMin,
const TVector< FArg > & InMax )
inline

Creates and initializes a new box from the specified extents.

Parameters
InMinThe box's minimum point.
InMaxThe box's maximum point.

Definition at line 66 of file Box.h.

◆ TBox() [5/8]

template<typename T >
UE::Math::TBox< T >::TBox ( const TVector4< T > & InMin,
const TVector4< T > & InMax )
inline

Definition at line 75 of file Box.h.

◆ TBox() [6/8]

template<typename T >
UE::Math::TBox< T >::TBox ( const TVector< T > * Points,
int32 Count )
inline

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

Parameters
PointsArray of Points to create for the bounding volume.
CountThe number of points.

Definition at line 87 of file Box.h.

◆ TBox() [7/8]

template<typename T >
UE::Math::TBox< T >::TBox ( const TArray< TVector< T > > & Points)
inline

Creates and initializes a new box from an array of points.

Parameters
PointsArray of Points to create for the bounding volume.

Definition at line 100 of file Box.h.

◆ TBox() [8/8]

template<typename T >
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
UE::Math::TBox< T >::TBox ( const TBox< FArg > & From)
inlineexplicit

Definition at line 104 of file Box.h.

Member Function Documentation

◆ BuildAABB()

template<typename T >
static TBox< T > UE::Math::TBox< T >::BuildAABB ( const TVector< T > & Origin,
const TVector< T > & Extent )
inlinestatic

Utility function to build an AABB from Origin and Extent

Parameters
OriginThe location of the bounding box.
ExtentHalf size of the bounding box.
Returns
A new axis-aligned bounding box.

Definition at line 518 of file Box.h.

◆ ComputeSquaredDistanceToBox()

template<typename T >
FORCEINLINE T UE::Math::TBox< T >::ComputeSquaredDistanceToBox ( const TBox< T > & Box) const
inline

Calculates squared distance between two boxes.

Definition at line 216 of file Box.h.

◆ ComputeSquaredDistanceToPoint()

template<typename T >
FORCEINLINE T UE::Math::TBox< T >::ComputeSquaredDistanceToPoint ( const TVector< T > & Point) const
inline

Calculates the distance of a point to this box.

Parameters
PointThe point.
Returns
The distance.

Definition at line 208 of file Box.h.

◆ Equals()

template<typename T >
bool UE::Math::TBox< T >::Equals ( const TBox< T > & Other,
T Tolerance = UE_KINDA_SMALL_NUMBER ) const
inline

Check against another box for equality, within specified error limits.

Returns true if both bounding boxes are invalid. Returns false if one of the bounding boxes is invalid.

Parameters
OtherThe box to check against.
ToleranceError tolerance.
Returns
true if the boxes are equal within tolerance limits, false otherwise.

Definition at line 139 of file Box.h.

◆ ExpandBy() [1/3]

template<typename T >
UE_NODISCARD TBox< T > UE::Math::TBox< T >::ExpandBy ( const TVector< T > & Neg,
const TVector< T > & Pos ) const
inline

Returns a box of increased size.

Parameters
NegThe size to increase the volume by in the negative direction (positive values move the bounds outwards)
PosThe size to increase the volume by in the positive direction (positive values move the bounds outwards)
Returns
A new bounding box.

Definition at line 252 of file Box.h.

◆ ExpandBy() [2/3]

template<typename T >
UE_NODISCARD FORCEINLINE TBox< T > UE::Math::TBox< T >::ExpandBy ( const TVector< T > & V) const
inline

Returns a box of increased size.

Parameters
VThe size to increase the volume by.
Returns
A new bounding box.

Definition at line 240 of file Box.h.

◆ ExpandBy() [3/3]

template<typename T >
UE_NODISCARD FORCEINLINE TBox< T > UE::Math::TBox< T >::ExpandBy ( T W) const
inline

Returns a box of increased size.

Parameters
WThe size to increase the volume by.
Returns
A new bounding box.

Definition at line 229 of file Box.h.

◆ GetCenter()

template<typename T >
FORCEINLINE TVector< T > UE::Math::TBox< T >::GetCenter ( ) const
inline

Gets the center point of this box.

Returns
The center point.
See also
GetCenterAndExtents, GetExtent, GetSize, GetVolume

Definition at line 286 of file Box.h.

◆ GetCenterAndExtents()

template<typename T >
FORCEINLINE void UE::Math::TBox< T >::GetCenterAndExtents ( TVector< T > & Center,
TVector< T > & Extents ) const
inline

Gets the center and extents of this box.

Parameters
Center[out] Will contain the box center point.
Extents[out] Will contain the extent around the center.
See also
GetCenter, GetExtent, GetSize, GetVolume

Definition at line 298 of file Box.h.

◆ GetClosestPointTo()

template<typename T >
FORCEINLINE TVector< T > UE::Math::TBox< T >::GetClosestPointTo ( const TVector< T > & Point) const

Calculates the closest point on or inside the box to a given point in space.

Parameters
PointThe point in space.
Returns
The closest point on or inside the box.

Definition at line 614 of file Box.h.

◆ GetExtent()

template<typename T >
FORCEINLINE TVector< T > UE::Math::TBox< T >::GetExtent ( ) const
inline

Gets the extents of this box.

Returns
The box extents.
See also
GetCenter, GetCenterAndExtents, GetSize, GetVolume

Definition at line 318 of file Box.h.

◆ GetExtrema() [1/2]

template<typename T >
FORCEINLINE TVector< T > & UE::Math::TBox< T >::GetExtrema ( int PointIndex)
inline

Definition at line 324 of file Box.h.

◆ GetExtrema() [2/2]

template<typename T >
FORCEINLINE const TVector< T > & UE::Math::TBox< T >::GetExtrema ( int PointIndex) const
inline

Definition at line 330 of file Box.h.

◆ GetSize()

template<typename T >
FORCEINLINE TVector< T > UE::Math::TBox< T >::GetSize ( ) const
inline

Gets the size of this box.

Returns
The box size.
See also
GetCenter, GetCenterAndExtents, GetExtent, GetVolume

Definition at line 341 of file Box.h.

◆ GetVertices()

template<typename T >
void UE::Math::TBox< T >::GetVertices ( TVector< T >(&) Vertices[8]) const

Get the vertices that make up this box.

Definition at line 749 of file Box.h.

◆ GetVolume()

template<typename T >
FORCEINLINE T UE::Math::TBox< T >::GetVolume ( ) const
inline

Gets the volume of this box.

Returns
The box volume.
See also
GetCenter, GetCenterAndExtents, GetExtent, GetSize

Definition at line 352 of file Box.h.

◆ Init()

template<typename T >
FORCEINLINE void UE::Math::TBox< T >::Init ( )
inline

Set the initial values of the bounding box to Zero.

Definition at line 360 of file Box.h.

◆ Intersect()

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::Intersect ( const TBox< T > & Other) const

Checks whether the given bounding box intersects this bounding box.

Parameters
OtherThe bounding box to intersect with.
Returns
true if the boxes intersect, false otherwise.

Definition at line 654 of file Box.h.

◆ IntersectXY()

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::IntersectXY ( const TBox< T > & Other) const

Checks whether the given bounding box intersects this bounding box in the XY plane.

Parameters
OtherThe bounding box to test intersection.
Returns
true if the boxes intersect in the XY Plane, false otherwise.

Definition at line 676 of file Box.h.

◆ InverseTransformBy()

template<typename T >
TBox< T > UE::Math::TBox< T >::InverseTransformBy ( const TTransform< T > & M) const

Gets a bounding volume transformed by an inverted TTransform<T> object.

Parameters
MThe transformation object to perform the inversely transform this box with.
Returns
The transformed box.

Definition at line 762 of file Box.h.

◆ IsInside() [1/2]

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::IsInside ( const TBox< T > & Other) const
inline

Checks whether a given box is fully encapsulated by this box.

Parameters
OtherThe box to test for encapsulation within the bounding volume.
Returns
true if box is inside this volume.

Definition at line 428 of file Box.h.

◆ IsInside() [2/2]

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::IsInside ( const TVector< T > & In) const
inline

Checks whether the given location is inside this box.

Parameters
InThe location to test for inside the bounding volume.
Returns
true if location is inside this volume.
See also
IsInsideXY

Definition at line 405 of file Box.h.

◆ IsInsideOrOn()

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::IsInsideOrOn ( const TVector< T > & In) const
inline

Checks whether the given location is inside or on this box.

Parameters
InThe location to test for inside the bounding volume.
Returns
true if location is inside this volume.
See also
IsInsideXY

Definition at line 417 of file Box.h.

◆ IsInsideOrOnXY()

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::IsInsideOrOnXY ( const FVector & In) const
inline

Checks whether the given location is inside or on this box in the XY plane.

Parameters
InThe location to test for inside the bounding volume.
Returns
true if location is inside this box in the XY plane.
See also
IsInsideOrOn

Definition at line 452 of file Box.h.

◆ IsInsideXY() [1/2]

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::IsInsideXY ( const TBox< T > & Other) const
inline

Checks whether the given box is fully encapsulated by this box in the XY plane.

Parameters
OtherThe box to test for encapsulation within the bounding box.
Returns
true if box is inside this box in the XY plane.

Definition at line 463 of file Box.h.

◆ IsInsideXY() [2/2]

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::IsInsideXY ( const TVector< T > & In) const
inline

Checks whether the given location is inside this box in the XY plane.

Parameters
InThe location to test for inside the bounding box.
Returns
true if location is inside this box in the XY plane.
See also
IsInside

Definition at line 440 of file Box.h.

◆ MoveTo()

template<typename T >
UE_NODISCARD FORCEINLINE TBox< T > UE::Math::TBox< T >::MoveTo ( const TVector< T > & Destination) const
inline

Returns a box with its center moved to the new destination.

Parameters
DestinationThe destination point to move center of box to.
Returns
A new bounding box.

Definition at line 274 of file Box.h.

◆ operator!=()

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::operator!= ( const TBox< T > & Other) const
inline

Compares two boxes for inequality.

Returns
false if the boxes are equal, true otherwise.

Definition at line 125 of file Box.h.

◆ operator+() [1/2]

template<typename T >
FORCEINLINE TBox< T > UE::Math::TBox< T >::operator+ ( const TBox< T > & Other) const
inline

Gets the result of addition to this bounding volume.

Parameters
OtherThe other volume to add to this.
Returns
A new bounding volume.

Definition at line 177 of file Box.h.

◆ operator+() [2/2]

template<typename T >
FORCEINLINE TBox< T > UE::Math::TBox< T >::operator+ ( const TVector< T > & Other) const
inline

Gets the result of addition to this bounding volume.

Parameters
OtherThe other point to add to this.
Returns
A new bounding volume.

Definition at line 158 of file Box.h.

◆ operator+=() [1/2]

template<typename T >
FORCEINLINE TBox< T > & UE::Math::TBox< T >::operator+= ( const TBox< T > & Other)

Adds to this bounding box to include a new bounding volume.

Parameters
Otherthe bounding volume to increase the bounding volume to.
Returns
Reference to this bounding volume after resizing to include the other bounding volume.

Definition at line 593 of file Box.h.

◆ operator+=() [2/2]

template<typename T >
FORCEINLINE TBox< T > & UE::Math::TBox< T >::operator+= ( const TVector< T > & Other)

Adds to this bounding box to include a given point.

Parameters
Otherthe point to increase the bounding volume to.
Returns
Reference to this bounding box after resizing to include the other point.

Definition at line 570 of file Box.h.

◆ operator==()

template<typename T >
FORCEINLINE bool UE::Math::TBox< T >::operator== ( const TBox< T > & Other) const
inline

Compares two boxes for equality.

Returns true if both bounding boxes are invalid. Returns false if one of the bounding boxes is invalid.

Returns
true if the boxes are equal, false otherwise.

Definition at line 115 of file Box.h.

◆ operator[]()

template<typename T >
FORCEINLINE TVector< T > & UE::Math::TBox< T >::operator[] ( int32 Index)
inline

Gets reference to the min or max of this bounding volume.

Parameters
Indexthe index into points of the bounding volume.
Returns
a reference to a point of the bounding volume.

Definition at line 188 of file Box.h.

◆ Overlap()

template<typename T >
TBox< T > UE::Math::TBox< T >::Overlap ( const TBox< T > & Other) const

Returns the overlap TBox<T> of two box

Parameters
OtherThe bounding box to test overlap
Returns
the overlap box. It can be 0 if they don't overlap

Definition at line 796 of file Box.h.

◆ Serialize() [1/2]

template<typename T >
bool UE::Math::TBox< T >::Serialize ( FArchive & Ar)
inline

Definition at line 551 of file Box.h.

◆ Serialize() [2/2]

template<typename T >
bool UE::Math::TBox< T >::Serialize ( FStructuredArchive::FSlot Slot)
inline

Definition at line 557 of file Box.h.

◆ SerializeFromMismatchedTag()

bool FBox3d::SerializeFromMismatchedTag ( FName StructTag,
FArchive & Ar )
inline

Definition at line 835 of file Box.h.

◆ ShiftBy()

template<typename T >
UE_NODISCARD FORCEINLINE TBox< T > UE::Math::TBox< T >::ShiftBy ( const TVector< T > & Offset) const
inline

Returns a box with its position shifted.

Parameters
OffsetThe vector to shift the box by.
Returns
A new bounding box.

Definition at line 263 of file Box.h.

◆ ToString()

template<typename T >
FORCEINLINE FString UE::Math::TBox< T >::ToString ( ) const

Get a textual representation of this box.

Returns
A string describing the box.

Definition at line 693 of file Box.h.

◆ TransformBy() [1/2]

template<typename T >
TBox< T > UE::Math::TBox< T >::TransformBy ( const TMatrix< T > & M) const

Gets a bounding volume transformed by a matrix.

Parameters
MThe matrix to transform by.
Returns
The transformed box.
See also
TransformProjectBy

Definition at line 700 of file Box.h.

◆ TransformBy() [2/2]

template<typename T >
TBox< T > UE::Math::TBox< T >::TransformBy ( const TTransform< T > & M) const

Gets a bounding volume transformed by a TTransform<T> object.

Parameters
MThe transformation object.
Returns
The transformed box.
See also
TransformProjectBy

Definition at line 743 of file Box.h.

◆ TransformProjectBy()

template<typename T >
TBox< T > UE::Math::TBox< T >::TransformProjectBy ( const TMatrix< T > & ProjM) const

Returns the current world bounding box transformed and projected to screen space

Parameters
ProjMThe projection matrix.
Returns
The transformed box.
See also
TransformBy

Definition at line 779 of file Box.h.

Friends And Related Symbol Documentation

◆ operator<< [1/2]

template<typename T >
FArchive & operator<< ( FArchive & Ar,
TBox< T > & Box )
friend

Serializes the bounding box.

Parameters
ArThe archive to serialize into.
BoxThe box to serialize.
Returns
Reference to the Archive after serialization.

Definition at line 534 of file Box.h.

◆ operator<< [2/2]

template<typename T >
void operator<< ( FStructuredArchive::FSlot Slot,
TBox< T > & Box )
friend

Serializes the bounding box.

Parameters
SlotThe structured archive slot to serialize into.
BoxThe box to serialize.

Definition at line 545 of file Box.h.

Member Data Documentation

◆ IsValid

template<typename T >
uint8 UE::Math::TBox< T >::IsValid

Holds a flag indicating whether this box is valid.

Definition at line 37 of file Box.h.

◆ Max

template<typename T >
TVector<T> UE::Math::TBox< T >::Max

Holds the box's maximum point.

Definition at line 34 of file Box.h.

◆ Min

template<typename T >
TVector<T> UE::Math::TBox< T >::Min

Holds the box's minimum point.

Definition at line 31 of file Box.h.


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