UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Math::TIntRect< InIntType > Struct Template Reference

#include <IntRect.h>

Public Types

using IntType = InIntType
 
using IntPointType = TIntPoint< IntType >
 

Public Member Functions

 TIntRect ()
 
 TIntRect (IntType X0, IntType Y0, IntType X1, IntType Y1)
 
 TIntRect (IntPointType InMin, IntPointType InMax)
 
 TIntRect (const TIntRect &Other)
 
TIntRectoperator= (const TIntRect &Other)
 
template<typename OtherIntType >
 TIntRect (TIntRect< OtherIntType > Other)
 
const TIntRectoperator() (int32 PointIndex) const
 
TIntRectoperator() (int32 PointIndex)
 
bool operator== (const TIntRect &Other) const
 
bool operator!= (const TIntRect &Other) const
 
TIntRectoperator*= (IntType Scale)
 
TIntRectoperator+= (const IntPointType &Point)
 
TIntRectoperator-= (const IntPointType &Point)
 
TIntRect operator* (IntType Scale) const
 
TIntRect operator/ (IntType Div) const
 
TIntRect operator+ (const IntPointType &Point) const
 
TIntRect operator/ (const IntPointType &Point) const
 
TIntRect operator- (const IntPointType &Point) const
 
TIntRect operator+ (const TIntRect &Other) const
 
TIntRect operator- (const TIntRect &Other) const
 
IntType Area () const
 
TIntRect Bottom (IntType InHeight) const
 
void Clip (const TIntRect &R)
 
void Union (const TIntRect &R)
 
bool Intersect (const TIntRect &Other) const
 
bool Contains (IntPointType P) const
 
bool Contains (const FIntRect &Other) const
 
void GetCenterAndExtents (IntPointType &OutCenter, IntPointType &OutExtent) const
 
IntType Height () const
 
void InflateRect (IntType Amount)
 
void Include (IntPointType Point)
 
TIntRect Inner (IntPointType Shrink) const
 
TIntRect Right (IntType InWidth) const
 
TIntRect Scale (double Fraction) const
 
IntPointType Size () const
 
FString ToString () const
 
IntType Width () const
 
bool IsEmpty () const
 

Static Public Member Functions

static TIntRect DivideAndRoundUp (TIntRect lhs, IntType Div)
 
static TIntRect DivideAndRoundUp (TIntRect lhs, IntPointType Div)
 
static constexpr int32 Num ()
 

Public Attributes

union { 
 
   struct { 
 
      IntPointType   Min 
 
      IntPointType   Max 
 
   }  
 
   IntPointType   MinMax [2] 
 
};  
 

Friends

FArchiveoperator<< (FArchive &Ar, TIntRect &Rect)
 

Detailed Description

template<typename InIntType>
struct UE::Math::TIntRect< InIntType >

Structure for integer rectangles in 2-d space.

Represented as half-open bounds [min, max)

Member Typedef Documentation

◆ IntPointType

template<typename InIntType >
using UE::Math::TIntRect< InIntType >::IntPointType = TIntPoint<IntType>

◆ IntType

template<typename InIntType >
using UE::Math::TIntRect< InIntType >::IntType = InIntType

Constructor & Destructor Documentation

◆ TIntRect() [1/5]

template<typename InIntType >
UE::Math::TIntRect< InIntType >::TIntRect ( )
inline

Constructor

◆ TIntRect() [2/5]

template<typename InIntType >
UE::Math::TIntRect< InIntType >::TIntRect ( IntType  X0,
IntType  Y0,
IntType  X1,
IntType  Y1 
)
inline

Constructor

Parameters
X0Minimum X coordinate (inclusive)
Y0Minimum Y coordinate (inclusive)
X1Maximum X coordinate (exclusive)
Y1Maximum Y coordinate (exclusive)
Note

◆ TIntRect() [3/5]

template<typename InIntType >
UE::Math::TIntRect< InIntType >::TIntRect ( IntPointType  InMin,
IntPointType  InMax 
)
inline

Constructor

Parameters
InMinMinimum Point (inclusive)
InMaxMaximum Point (exclusive)

◆ TIntRect() [4/5]

template<typename InIntType >
UE::Math::TIntRect< InIntType >::TIntRect ( const TIntRect< InIntType > &  Other)
inline

◆ TIntRect() [5/5]

template<typename InIntType >
template<typename OtherIntType >
UE::Math::TIntRect< InIntType >::TIntRect ( TIntRect< OtherIntType Other)
inlineexplicit

Converts to another int type. Checks that the cast will succeed.

Member Function Documentation

◆ Area()

template<typename InIntType >
IntType UE::Math::TIntRect< InIntType >::Area ( ) const
inline

Calculates the area of this rectangle.

Returns
The area of this rectangle.

◆ Bottom()

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::Bottom ( IntType  InHeight) const
inline

Creates a rectangle from the bottom part of this rectangle.

Parameters
InHeightHeight of the new rectangle (<= rectangles original height).
Returns
The new rectangle.

◆ Clip()

template<typename InIntType >
void UE::Math::TIntRect< InIntType >::Clip ( const TIntRect< InIntType > &  R)
inline

Clip a rectangle using the bounds of another rectangle.

Parameters
OtherThe other rectangle to clip against.

◆ Contains() [1/2]

template<typename InIntType >
bool UE::Math::TIntRect< InIntType >::Contains ( const FIntRect Other) const
inline

Test whether this rectangle fully contains other rectangle.

◆ Contains() [2/2]

template<typename InIntType >
bool UE::Math::TIntRect< InIntType >::Contains ( IntPointType  P) const
inline

Test whether this rectangle contains a point.

Parameters
PointThe point to test against.
Returns
true if the rectangle contains the specified point, false otherwise.
Note
This function assumes rects have half-open bounds, i.e. points are contained by the minimum border of the box, but not the maximum border.

◆ DivideAndRoundUp() [1/2]

template<typename InIntType >
static TIntRect UE::Math::TIntRect< InIntType >::DivideAndRoundUp ( TIntRect< InIntType lhs,
IntPointType  Div 
)
inlinestatic

◆ DivideAndRoundUp() [2/2]

template<typename InIntType >
static TIntRect UE::Math::TIntRect< InIntType >::DivideAndRoundUp ( TIntRect< InIntType lhs,
IntType  Div 
)
inlinestatic

Divides a rectangle and rounds up to the nearest integer.

Parameters
lhsThe Rectangle to divide.
DivWhat to divide by.
Returns
New divided rectangle.

◆ GetCenterAndExtents()

template<typename InIntType >
void UE::Math::TIntRect< InIntType >::GetCenterAndExtents ( IntPointType OutCenter,
IntPointType OutExtent 
) const
inline

Gets the Center and Extents of this rectangle.

Parameters
OutCenterWill contain the center point.
OutExtentWill contain the extent.

◆ Height()

template<typename InIntType >
IntType UE::Math::TIntRect< InIntType >::Height ( ) const
inline

Gets the Height of the rectangle.

Returns
The Height of the rectangle.

◆ Include()

template<typename InIntType >
void UE::Math::TIntRect< InIntType >::Include ( IntPointType  Point)
inline

Adds to this rectangle to include a given point.

Parameters
PointThe point to increase the rectangle to.

◆ InflateRect()

template<typename InIntType >
void UE::Math::TIntRect< InIntType >::InflateRect ( IntType  Amount)
inline

Inflates or deflates the rectangle.

Parameters
AmountThe amount to inflate or deflate the rectangle on each side.

◆ Inner()

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::Inner ( IntPointType  Shrink) const
inline

Gets a new rectangle from the inner of this one.

Parameters
ShrinkHow much to remove from each point of this rectangle.
Returns
New inner Rectangle.

◆ Intersect()

template<typename InIntType >
bool UE::Math::TIntRect< InIntType >::Intersect ( const TIntRect< InIntType > &  Other) const
inline

Returns true if the two rects have any overlap.

Parameters
OtherThe rect to compare with.
Returns
true if the rectangle overlaps the other rectangle, false otherwise.
Note
This function assumes rects have open bounds, i.e. rects with coincident borders on any edge will not overlap.

◆ IsEmpty()

template<typename InIntType >
bool UE::Math::TIntRect< InIntType >::IsEmpty ( ) const
inline

Returns true if the rectangle is 0 x 0.

Returns
true if the rectangle is 0 x 0.

◆ Num()

template<typename InIntType >
static constexpr int32 UE::Math::TIntRect< InIntType >::Num ( )
inlinestaticconstexpr

Gets number of points in the Rectangle.

Returns
Number of points in the Rectangle.

◆ operator!=()

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

Compares Rectangles for inequality.

Parameters
OtherThe Other Rectangle for comparison.
Returns
true if the rectangles are not equal, false otherwise..

◆ operator()() [1/2]

template<typename InIntType >
TIntRect & UE::Math::TIntRect< InIntType >::operator() ( int32  PointIndex)
inline

Gets a specific point in this rectangle.

Parameters
PointIndexIndex of Point in rectangle.
Returns
Reference to point in rectangle.

◆ operator()() [2/2]

template<typename InIntType >
const TIntRect & UE::Math::TIntRect< InIntType >::operator() ( int32  PointIndex) const
inline

Gets a specific point in this rectangle.

Parameters
PointIndexIndex of Point in rectangle.
Returns
Const reference to point in rectangle.

◆ operator*()

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::operator* ( IntType  Scale) const
inline

Gets the result of scaling on this rectangle.

Parameters
ScaleWhat to multiply this rectangle by.
Returns
New scaled rectangle.

◆ operator*=()

template<typename InIntType >
TIntRect & UE::Math::TIntRect< InIntType >::operator*= ( IntType  Scale)
inline

Applies scaling to this rectangle.

Parameters
ScaleWhat to multiply the rectangle by.
Returns
Reference to this rectangle after scaling.

◆ operator+() [1/2]

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::operator+ ( const IntPointType Point) const
inline

Gets the result of adding a point to this rectangle.

Parameters
PointThe point to add to both points in the rectangle.
Returns
New rectangle with point added to it.

◆ operator+() [2/2]

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::operator+ ( const TIntRect< InIntType > &  Other) const
inline

Gets the result of adding two rectangles together.

Parameters
OtherThe other rectangle to add to this.
Returns
New rectangle after both are added together.

◆ operator+=()

template<typename InIntType >
TIntRect & UE::Math::TIntRect< InIntType >::operator+= ( const IntPointType Point)
inline

Adds a point to this rectangle.

Parameters
PointThe point to add onto both points in the rectangle.
Returns
Reference to this rectangle after addition.

◆ operator-() [1/2]

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::operator- ( const IntPointType Point) const
inline

Gets the result of subtracting a point from this rectangle.

Parameters
PointThe point to subtract from both points in the rectangle.
Returns
New rectangle with point subtracted from it.

◆ operator-() [2/2]

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::operator- ( const TIntRect< InIntType > &  Other) const
inline

Gets the result of subtracting a rectangle from this one.

Parameters
OtherThe other rectangle to subtract from this.
Returns
New rectangle after one is subtracted from this.

◆ operator-=()

template<typename InIntType >
TIntRect & UE::Math::TIntRect< InIntType >::operator-= ( const IntPointType Point)
inline

Subtracts a point from this rectangle.

Parameters
PointThe point to subtract from both points in the rectangle.
Returns
Reference to this rectangle after subtraction.

◆ operator/() [1/2]

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::operator/ ( const IntPointType Point) const
inline

Gets the result of dividing a point with this rectangle.

Parameters
PointThe point to divide with.
Returns
New rectangle with point divided.

◆ operator/() [2/2]

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::operator/ ( IntType  Div) const
inline

Gets the result of division on this rectangle.

Parameters
DivWhat to divide this rectangle by.
Returns
New divided rectangle.

◆ operator=()

template<typename InIntType >
TIntRect & UE::Math::TIntRect< InIntType >::operator= ( const TIntRect< InIntType > &  Other)
inline

◆ operator==()

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

Compares Rectangles for equality.

Parameters
OtherThe Other Rectangle for comparison.
Returns
true if the rectangles are equal, false otherwise..

◆ Right()

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::Right ( IntType  InWidth) const
inline

Creates a rectangle from the right hand side of this rectangle.

Parameters
InWidthWidth of the new rectangle (<= rectangles original width).
Returns
The new rectangle.

◆ Scale()

template<typename InIntType >
TIntRect UE::Math::TIntRect< InIntType >::Scale ( double  Fraction) const
inline

Scales a rectangle using a floating point number.

Parameters
FractionWhat to scale the rectangle by
Returns
New scaled rectangle.

◆ Size()

template<typename InIntType >
IntPointType UE::Math::TIntRect< InIntType >::Size ( ) const
inline

Gets the distance from one corner of the rectangle to the other.

Returns
The distance from one corner of the rectangle to the other.

◆ ToString()

template<typename InIntType >
FString UE::Math::TIntRect< InIntType >::ToString ( ) const
inline

Get a textual representation of this rectangle.

Returns
A string describing the rectangle.

◆ Union()

template<typename InIntType >
void UE::Math::TIntRect< InIntType >::Union ( const TIntRect< InIntType > &  R)
inline

Combines the two rectangles.

◆ Width()

template<typename InIntType >
IntType UE::Math::TIntRect< InIntType >::Width ( ) const
inline

Gets the width of the rectangle.

Returns
The width of the rectangle.

Friends And Related Symbol Documentation

◆ operator<<

template<typename InIntType >
FArchive & operator<< ( FArchive Ar,
TIntRect< InIntType > &  Rect 
)
friend

Serializes the Rectangle.

Parameters
ArThe archive to serialize into.
RectThe rectangle to serialize.
Returns
Reference to the Archive after serialization.

Member Data Documentation

◆ [union]

union { ... } UE::Math::TIntRect< InIntType >

◆ Max

Holds the last pixel line/row (like in Win32 RECT).

◆ Min

Holds the first pixel line/row (like in Win32 RECT).

◆ MinMax


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