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

#include <IntRect.h>

+ Collaboration diagram for UE::Math::TIntRect< InIntType >:

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
 
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 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.

Todo
Docs: The operators need better documentation, i.e. what does it mean to divide a rectangle?

Definition at line 20 of file IntRect.h.

Member Typedef Documentation

◆ IntPointType

Definition at line 23 of file IntRect.h.

◆ IntType

Definition at line 22 of file IntRect.h.

Constructor & Destructor Documentation

◆ TIntRect() [1/5]

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

Constructor

Definition at line 42 of file IntRect.h.

◆ 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.
Y0Minimum Y coordinate.
X1Maximum X coordinate.
Y1Maximum Y coordinate.

Definition at line 55 of file IntRect.h.

◆ TIntRect() [3/5]

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

Constructor

Parameters
InMinMinimum Point
InMaxMaximum Point

Definition at line 67 of file IntRect.h.

◆ TIntRect() [4/5]

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

Definition at line 73 of file IntRect.h.

◆ 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.

Definition at line 89 of file IntRect.h.

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.

Definition at line 267 of file IntRect.h.

◆ 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.

Definition at line 279 of file IntRect.h.

◆ Clip()

Clip a rectangle using the bounds of another rectangle.

Parameters
OtherThe other rectangle to clip against.

Definition at line 289 of file IntRect.h.

◆ Contains()

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..

Definition at line 322 of file IntRect.h.

◆ DivideAndRoundUp() [1/2]

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

Definition at line 471 of file IntRect.h.

◆ 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.

Definition at line 466 of file IntRect.h.

◆ 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.

Definition at line 333 of file IntRect.h.

◆ Height()

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

Gets the Height of the rectangle.

Returns
The Height of the rectangle.

Definition at line 347 of file IntRect.h.

◆ 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.

Definition at line 370 of file IntRect.h.

◆ 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.

Definition at line 358 of file IntRect.h.

◆ 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.

Definition at line 384 of file IntRect.h.

◆ 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.

Definition at line 311 of file IntRect.h.

◆ 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.

Definition at line 454 of file IntRect.h.

◆ Num()

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

Gets number of points in the Rectangle.

Returns
Number of points in the Rectangle.

Definition at line 481 of file IntRect.h.

◆ 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..

Definition at line 138 of file IntRect.h.

◆ 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.

Definition at line 114 of file IntRect.h.

◆ 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.

Definition at line 101 of file IntRect.h.

◆ operator*()

Gets the result of scaling on this rectangle.

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

Definition at line 191 of file IntRect.h.

◆ operator*=()

Applies scaling to this rectangle.

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

Definition at line 149 of file IntRect.h.

◆ operator+() [1/2]

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.

Definition at line 213 of file IntRect.h.

◆ operator+() [2/2]

Gets the result of adding two rectangles together.

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

Definition at line 246 of file IntRect.h.

◆ operator+=()

Adds a point to this rectangle.

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

Definition at line 163 of file IntRect.h.

◆ operator-() [1/2]

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.

Definition at line 235 of file IntRect.h.

◆ operator-() [2/2]

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.

Definition at line 257 of file IntRect.h.

◆ operator-=()

Subtracts a point from this rectangle.

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

Definition at line 177 of file IntRect.h.

◆ operator/() [1/2]

Gets the result of dividing a point with this rectangle.

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

Definition at line 224 of file IntRect.h.

◆ operator/() [2/2]

Gets the result of division on this rectangle.

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

Definition at line 202 of file IntRect.h.

◆ operator=()

Definition at line 78 of file IntRect.h.

◆ operator==()

Compares Rectangles for equality.

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

Definition at line 127 of file IntRect.h.

◆ 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.

Definition at line 394 of file IntRect.h.

◆ 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.

Definition at line 405 of file IntRect.h.

◆ 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.

Definition at line 424 of file IntRect.h.

◆ 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.

Definition at line 434 of file IntRect.h.

◆ Union()

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

Combines the two rectanges.

Definition at line 302 of file IntRect.h.

◆ Width()

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

Gets the width of the rectangle.

Returns
The width of the rectangle.

Definition at line 444 of file IntRect.h.

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.

Definition at line 495 of file IntRect.h.

Member Data Documentation

◆ [union]

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

◆ Max

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

Definition at line 34 of file IntRect.h.

◆ Min

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

Definition at line 31 of file IntRect.h.

◆ MinMax

Definition at line 38 of file IntRect.h.


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