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

#include <Box2D.h>

Public Types

using FReal = T
 

Public Member Functions

 TBox2 ()
 
 TBox2 (EForceInit)
 
 TBox2 (const TVector2< T > &InMin, const TVector2< T > &InMax)
 
 TBox2 (const TVector2< T > *Points, const int32 Count)
 
 TBox2 (const TArray< TVector2< T > > &Points)
 
bool operator== (const TBox2< T > &Other) const
 
bool operator!= (const TBox2< T > &Other) const
 
bool Equals (const TBox2< T > &Other, T Tolerance=UE_KINDA_SMALL_NUMBER) const
 
FORCEINLINE TBox2< T > & operator+= (const TVector2< T > &Other)
 
TBox2< Toperator+ (const TVector2< T > &Other) const
 
FORCEINLINE TBox2< T > & operator+= (const TBox2< T > &Other)
 
TBox2< Toperator+ (const TBox2< T > &Other) const
 
TVector2< T > & operator[] (int32 Index)
 
FORCEINLINE T ComputeSquaredDistanceToPoint (const TVector2< T > &Point) const
 
TBox2< TExpandBy (const T W) const
 
TBox2< TExpandBy (const TVector2< T > &V) const
 
T GetArea () const
 
TVector2< TGetCenter () const
 
void GetCenterAndExtents (TVector2< T > &center, TVector2< T > &Extents) const
 
FORCEINLINE TVector2< TGetClosestPointTo (const TVector2< T > &Point) const
 
TVector2< TGetExtent () const
 
TVector2< TGetSize () const
 
void Init ()
 
TBox2< TOverlap (const TBox2< T > &Other) const
 
FORCEINLINE bool Intersect (const TBox2< T > &other) const
 
bool IsInside (const TVector2< T > &TestPoint) const
 
bool IsInsideOrOn (const TVector2< T > &TestPoint) const
 
bool IsInside (const TBox2< T > &Other) const
 
TBox2< TShiftBy (const TVector2< T > &Offset) const
 
TBox2< TMoveTo (const TVector2< T > &Destination) const
 
FString ToString () const
 
bool Serialize (FArchive &Ar)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
template<typename FArg , TEMPLATE_REQUIRES(!std::is_same_v< T, FArg >) >
 TBox2 (const TBox2< FArg > &From)
 

Public Attributes

TVector2< TMin
 
TVector2< TMax
 
bool bIsValid
 

Friends

FArchiveoperator<< (FArchive &Ar, TBox2< T > &Box)
 

Detailed Description

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

Definition at line 28 of file Box2D.h.

Member Typedef Documentation

◆ FReal

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

Definition at line 31 of file Box2D.h.

Constructor & Destructor Documentation

◆ TBox2() [1/6]

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

Default constructor (no initialization).

Definition at line 40 of file Box2D.h.

◆ TBox2() [2/6]

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

Creates and initializes a new box.

The box extents are initialized to zero and the box is marked as invalid.

Parameters
EForceInitForce Init Enum.

Definition at line 40 of file Box2D.h.

◆ TBox2() [3/6]

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

Creates and initializes a new box from the specified parameters.

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

Definition at line 40 of file Box2D.h.

◆ TBox2() [4/6]

template<typename T >
UE::Math::TBox2< T >::TBox2 ( const TVector2< T > * Points,
const int32 Count )

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 428 of file Box2D.h.

◆ TBox2() [5/6]

template<typename T >
UE::Math::TBox2< T >::TBox2 ( const TArray< TVector2< T > > & Points)

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

Parameters
PointsArray of Points to create for the bounding volume.

Definition at line 440 of file Box2D.h.

◆ TBox2() [6/6]

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

Definition at line 420 of file Box2D.h.

Member Function Documentation

◆ ComputeSquaredDistanceToPoint()

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

Calculates the distance of a point to this box.

Parameters
PointThe point.
Returns
The distance.

Definition at line 186 of file Box2D.h.

◆ Equals()

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

Checks for equality with error-tolerant comparison.

Parameters
OtherThe box to compare.
ToleranceError tolerance.
Returns
true if the boxes are equal within specified tolerance, otherwise false.

Definition at line 117 of file Box2D.h.

◆ ExpandBy() [1/2]

template<typename T >
TBox2< T > UE::Math::TBox2< T >::ExpandBy ( const T W) const
inline

Increase the bounding box volume.

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

Definition at line 218 of file Box2D.h.

◆ ExpandBy() [2/2]

template<typename T >
TBox2< T > UE::Math::TBox2< T >::ExpandBy ( const TVector2< 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 229 of file Box2D.h.

◆ GetArea()

template<typename T >
T UE::Math::TBox2< T >::GetArea ( ) const
inline

Gets the box area.

Returns
Box area.
See also
GetCenter, GetCenterAndExtents, GetExtent, GetSize

Definition at line 240 of file Box2D.h.

◆ GetCenter()

template<typename T >
TVector2< T > UE::Math::TBox2< T >::GetCenter ( ) const
inline

Gets the box's center point.

Returns
Th center point.
See also
GetArea, GetCenterAndExtents, GetExtent, GetSize

Definition at line 251 of file Box2D.h.

◆ GetCenterAndExtents()

template<typename T >
void UE::Math::TBox2< T >::GetCenterAndExtents ( TVector2< T > & center,
TVector2< T > & Extents ) const
inline

Get the center and extents

Parameters
center[out]reference to center point
Extents[out]reference to the extent around the center
See also
GetArea, GetCenter, GetExtent, GetSize

Definition at line 263 of file Box2D.h.

◆ GetClosestPointTo()

template<typename T >
FORCEINLINE TVector2< T > UE::Math::TBox2< T >::GetClosestPointTo ( const TVector2< 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 493 of file Box2D.h.

◆ GetExtent()

template<typename T >
TVector2< T > UE::Math::TBox2< T >::GetExtent ( ) const
inline

Gets the box extents around the center.

Returns
Box extents.
See also
GetArea, GetCenter, GetCenterAndExtents, GetSize

Definition at line 284 of file Box2D.h.

◆ GetSize()

template<typename T >
TVector2< T > UE::Math::TBox2< T >::GetSize ( ) const
inline

Gets the box size.

Returns
Box size.
See also
GetArea, GetCenter, GetCenterAndExtents, GetExtent

Definition at line 296 of file Box2D.h.

◆ Init()

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

Set the initial values of the bounding box to Zero.

Definition at line 304 of file Box2D.h.

◆ Intersect()

template<typename T >
FORCEINLINE bool UE::Math::TBox2< T >::Intersect ( const TBox2< T > & other) const

Checks whether the given box intersects this box.

Parameters
otherbounding box to test intersection
Returns
true if boxes intersect, false otherwise.

Definition at line 544 of file Box2D.h.

◆ IsInside() [1/2]

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

Checks whether the 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, false otherwise.

Definition at line 355 of file Box2D.h.

◆ IsInside() [2/2]

template<typename T >
bool UE::Math::TBox2< T >::IsInside ( const TVector2< T > & TestPoint) const
inline

Checks whether the given point is inside this box.

Parameters
PointThe point to test.
Returns
true if the point is inside this box, otherwise false.

Definition at line 332 of file Box2D.h.

◆ IsInsideOrOn()

template<typename T >
bool UE::Math::TBox2< T >::IsInsideOrOn ( const TVector2< T > & TestPoint) const
inline

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

Parameters
PointThe point to test.
Returns
true if point is inside or on this box, otherwise false.
See also
IsInside

Definition at line 344 of file Box2D.h.

◆ MoveTo()

template<typename T >
TBox2< T > UE::Math::TBox2< T >::MoveTo ( const TVector2< 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 377 of file Box2D.h.

◆ operator!=()

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

Compares two boxes for inequality.

Parameters
OtherThe other box to compare with.
Returns
true if the boxes are not equal, false otherwise.

Definition at line 105 of file Box2D.h.

◆ operator+() [1/2]

template<typename T >
TBox2< T > UE::Math::TBox2< T >::operator+ ( const TBox2< 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 155 of file Box2D.h.

◆ operator+() [2/2]

template<typename T >
TBox2< T > UE::Math::TBox2< T >::operator+ ( const TVector2< 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 136 of file Box2D.h.

◆ operator+=() [1/2]

template<typename T >
FORCEINLINE TBox2< T > & UE::Math::TBox2< T >::operator+= ( const TBox2< 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 474 of file Box2D.h.

◆ operator+=() [2/2]

template<typename T >
FORCEINLINE TBox2< T > & UE::Math::TBox2< T >::operator+= ( const TVector2< 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 453 of file Box2D.h.

◆ operator==()

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

Compares two boxes for equality.

Parameters
OtherThe other box to compare with.
Returns
true if the boxes are equal, false otherwise.

Definition at line 94 of file Box2D.h.

◆ operator[]()

template<typename T >
TVector2< T > & UE::Math::TBox2< 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 166 of file Box2D.h.

◆ Overlap()

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

Returns the overlap box of two boxes

Parameters
OtherThe bounding box to test overlap
Returns
the overlap box. Result will be invalid if they don't overlap

Definition at line 522 of file Box2D.h.

◆ Serialize()

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

Definition at line 406 of file Box2D.h.

◆ SerializeFromMismatchedTag()

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

Definition at line 580 of file Box2D.h.

◆ ShiftBy()

template<typename T >
TBox2< T > UE::Math::TBox2< T >::ShiftBy ( const TVector2< T > & Offset) const
inline

Shift bounding box position.

Parameters
Theoffset vector to shift by.
Returns
A new shifted bounding box.

Definition at line 366 of file Box2D.h.

◆ ToString()

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

Get a textual representation of this box.

Returns
A string describing the box.

Definition at line 560 of file Box2D.h.

Friends And Related Symbol Documentation

◆ operator<<

template<typename T >
FArchive & operator<< ( FArchive & Ar,
TBox2< 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 400 of file Box2D.h.

Member Data Documentation

◆ bIsValid

template<typename T >
bool UE::Math::TBox2< T >::bIsValid

Holds a flag indicating whether this box is valid.

Definition at line 40 of file Box2D.h.

◆ Max

template<typename T >
TVector2<T> UE::Math::TBox2< T >::Max

Holds the box's maximum point.

Definition at line 37 of file Box2D.h.

◆ Min

template<typename T >
TVector2<T> UE::Math::TBox2< T >::Min

Holds the box's minimum point.

Definition at line 34 of file Box2D.h.


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