UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TInterval< ElementType > Struct Template Reference

#include <Interval.h>

Public Member Functions

 TInterval ()
 
 TInterval (ElementType InMin, ElementType InMax)
 
void operator+= (ElementType X)
 
void operator-= (ElementType X)
 
bool operator== (const TInterval &Other) const
 
bool operator!= (const TInterval &Other) const
 
ElementType Size () const
 
bool IsValid () const
 
bool Contains (const ElementType &Element) const
 
void Expand (ElementType ExpandAmount)
 
void Include (ElementType X)
 
ElementType Interpolate (float Alpha) const
 
ElementType Clamp (ElementType X) const
 
ElementType GetRangePct (ElementType X) const
 

Public Attributes

ElementType Min
 
ElementType Max
 

Friends

TInterval Intersect (const TInterval &A, const TInterval &B)
 
class FArchiveoperator<< (class FArchive &Ar, TInterval &Interval)
 
uint32 GetTypeHash (const TInterval &Interval)
 

Detailed Description

template<typename ElementType>
struct TInterval< ElementType >

Template for numeric interval

Constructor & Destructor Documentation

◆ TInterval() [1/2]

template<typename ElementType >
TInterval< ElementType >::TInterval ( )
inline

Default constructor.

The interval is invalid

◆ TInterval() [2/2]

template<typename ElementType >
TInterval< ElementType >::TInterval ( ElementType  InMin,
ElementType  InMax 
)
inline

Creates and initializes a new interval with the specified lower and upper bounds.

Parameters
InMinThe lower bound of the constructed interval.
InMaxThe upper bound of the constructed interval.

Member Function Documentation

◆ Clamp()

template<typename ElementType >
ElementType TInterval< ElementType >::Clamp ( ElementType  X) const
inline

Clamps X to be between the interval inclusively.

Parameters
Xthe element to clamp
Returns
zero if invalid(Min > Max), clamped result otherwise

◆ Contains()

template<typename ElementType >
bool TInterval< ElementType >::Contains ( const ElementType &  Element) const
inline

Checks whether this interval contains the specified element.

Parameters
ElementThe element to check.
Returns
true if the range interval the element, false otherwise.

◆ Expand()

template<typename ElementType >
void TInterval< ElementType >::Expand ( ElementType  ExpandAmount)
inline

Expands this interval to both sides by the specified amount.

Parameters
ExpandAmountThe amount to expand by.

◆ GetRangePct()

template<typename ElementType >
ElementType TInterval< ElementType >::GetRangePct ( ElementType  X) const
inline

Calculate the Percentage of X in the Interval

Parameters
Xthe element to calculate the percentage
Returns
zero if invalid(Min > Max), percentage otherwise

◆ Include()

template<typename ElementType >
void TInterval< ElementType >::Include ( ElementType  X)
inline

Expands this interval if necessary to include the specified element.

Parameters
XThe element to include.

◆ Interpolate()

template<typename ElementType >
ElementType TInterval< ElementType >::Interpolate ( float  Alpha) const
inline

Interval interpolation

Parameters
Alphainterpolation amount
Returns
interpolation result

◆ IsValid()

template<typename ElementType >
bool TInterval< ElementType >::IsValid ( ) const
inline

Whether interval is valid (Min <= Max).

Returns
false when interval is invalid, true otherwise

◆ operator!=()

template<typename ElementType >
bool TInterval< ElementType >::operator!= ( const TInterval< ElementType > &  Other) const
inline

Compare two intervals for inequality.

Parameters
OtherThe other interval being compared.
Returns
true if the intervals are not equal, false otherwise.

◆ operator+=()

template<typename ElementType >
void TInterval< ElementType >::operator+= ( ElementType  X)
inline

Offset the interval by adding X.

Parameters
XThe offset.

◆ operator-=()

template<typename ElementType >
void TInterval< ElementType >::operator-= ( ElementType  X)
inline

Offset the interval by subtracting X.

Parameters
XThe offset.

◆ operator==()

template<typename ElementType >
bool TInterval< ElementType >::operator== ( const TInterval< ElementType > &  Other) const
inline

Compare two intervals for equality.

Parameters
OtherThe other interval being compared.
Returns
true if the intervals are equal, false otherwise.

◆ Size()

template<typename ElementType >
ElementType TInterval< ElementType >::Size ( ) const
inline

Computes the size of this interval.

Returns
Interval size.

Friends And Related Symbol Documentation

◆ GetTypeHash

template<typename ElementType >
uint32 GetTypeHash ( const TInterval< ElementType > &  Interval)
friend

Gets the hash for the specified interval.

Parameters
IntervalThe Interval to get the hash for.
Returns
Hash value.

◆ Intersect

template<typename ElementType >
TInterval Intersect ( const TInterval< ElementType > &  A,
const TInterval< ElementType > &  B 
)
friend

Calculates the intersection of two intervals.

Parameters
AThe first interval.
BThe second interval.
Returns
The intersection.

◆ operator<<

template<typename ElementType >
class FArchive & operator<< ( class FArchive Ar,
TInterval< ElementType > &  Interval 
)
friend

Serializes the interval.

Parameters
ArThe archive to serialize into.
IntervalThe interval to serialize.
Returns
Reference to the Archive after serialization.

Member Data Documentation

◆ Max

template<typename ElementType >
ElementType TInterval< ElementType >::Max

Holds the upper bound of the interval.

◆ Min

template<typename ElementType >
ElementType TInterval< ElementType >::Min

Holds the lower bound of the interval.


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