UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::TOrientedBox2< RealType > Struct Template Reference

#include <OrientedBoxTypes.h>

Public Member Functions

 TOrientedBox2 ()
 
 TOrientedBox2 (const TVector2< RealType > &OriginIn, const TVector2< RealType > &ExtentsIn)
 
 TOrientedBox2 (const TVector2< RealType > &OriginIn, const TVector2< RealType > &XAxisIn, const TVector2< RealType > &ExtentsIn)
 
 TOrientedBox2 (const TVector2< RealType > &OriginIn, RealType AngleRad, const TVector2< RealType > &ExtentsIn)
 
 TOrientedBox2 (const TAxisAlignedBox2< RealType > &AxisBox)
 
void SetAngleRadians (RealType AngleRad)
 
TVector2< RealType > Center () const
 
TVector2< RealType > AxisX () const
 
TVector2< RealType > AxisY () const
 
TVector2< RealType > GetAxis (int AxisIndex) const
 
TVector2< RealType > Diagonal () const
 
RealType Area () const
 
RealType Perimeter () const
 
TVector2< RealType > ToLocalSpace (const TVector2< RealType > &Point) const
 
TVector2< RealType > FromLocalSpace (const TVector2< RealType > &Point) const
 
bool Contains (const TVector2< RealType > &Point) const
 
TVector2< RealType > GetCorner (int Index) const
 
template<typename PointFuncType >
void EnumerateCorners (PointFuncType CornerPointFunc) const
 
template<typename PointPredicateType >
bool TestCorners (PointPredicateType CornerPointPredicate) const
 
RealType DistanceSquared (const TVector2< RealType > &Point) const
 
TVector2< RealType > ClosestPoint (const TVector2< RealType > &Point) const
 

Static Public Member Functions

static TOrientedBox2< RealType > UnitZeroCentered ()
 
static TOrientedBox2< RealType > UnitPositive ()
 
static FIndex2i GetCornerSide (int Index)
 

Public Attributes

TVector2< RealType > Origin
 
TVector2< RealType > UnitAxisX
 
TVector2< RealType > Extents
 

Constructor & Destructor Documentation

◆ TOrientedBox2() [1/5]

template<typename RealType >
UE::Geometry::TOrientedBox2< RealType >::TOrientedBox2 ( )
inline

◆ TOrientedBox2() [2/5]

template<typename RealType >
UE::Geometry::TOrientedBox2< RealType >::TOrientedBox2 ( const TVector2< RealType > &  OriginIn,
const TVector2< RealType > &  ExtentsIn 
)
inline

Create axis-aligned box with given Origin and Extents

◆ TOrientedBox2() [3/5]

template<typename RealType >
UE::Geometry::TOrientedBox2< RealType >::TOrientedBox2 ( const TVector2< RealType > &  OriginIn,
const TVector2< RealType > &  XAxisIn,
const TVector2< RealType > &  ExtentsIn 
)
inline

Create oriented box with given Origin, X Axis and Extents

◆ TOrientedBox2() [4/5]

template<typename RealType >
UE::Geometry::TOrientedBox2< RealType >::TOrientedBox2 ( const TVector2< RealType > &  OriginIn,
RealType  AngleRad,
const TVector2< RealType > &  ExtentsIn 
)
inline

Create oriented box with given Origin, Angle (in radians) and Extents

◆ TOrientedBox2() [5/5]

template<typename RealType >
UE::Geometry::TOrientedBox2< RealType >::TOrientedBox2 ( const TAxisAlignedBox2< RealType > &  AxisBox)
inline

Create oriented box from axis-aligned box

Member Function Documentation

◆ Area()

template<typename RealType >
RealType UE::Geometry::TOrientedBox2< RealType >::Area ( ) const
inline
Returns
area of box

◆ AxisX()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::AxisX ( ) const
inline
Returns
X axis of the box

◆ AxisY()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::AxisY ( ) const
inline
Returns
Y axis of the box (the X axis rotated 90 degrees counter-clockwise)

◆ Center()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::Center ( ) const
inline
Returns
center of the box

◆ ClosestPoint()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::ClosestPoint ( const TVector2< RealType > &  Point) const
inline

Find closest point on box

Parameters
Pointinput point
Returns
Closest point on box. Input point is returned if it is inside box.

◆ Contains()

template<typename RealType >
bool UE::Geometry::TOrientedBox2< RealType >::Contains ( const TVector2< RealType > &  Point) const
inline
Returns
true if box contains point

◆ Diagonal()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::Diagonal ( ) const
inline
Returns
vector from minimum-corner to maximum-corner of box

◆ DistanceSquared()

template<typename RealType >
RealType UE::Geometry::TOrientedBox2< RealType >::DistanceSquared ( const TVector2< RealType > &  Point) const
inline

Find squared distance to box.

Parameters
Pointinput point
Returns
Squared distance from point to box, or 0 if point is inside box

◆ EnumerateCorners()

template<typename RealType >
template<typename PointFuncType >
void UE::Geometry::TOrientedBox2< RealType >::EnumerateCorners ( PointFuncType  CornerPointFunc) const
inline

Call CornerPointFunc(TVector2<RealType>) for each of the 4 box corners. Order is the same as GetCorner(X).

◆ FromLocalSpace()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::FromLocalSpace ( const TVector2< RealType > &  Point) const
inline
Returns
Point transformed from the local space of the box (Origin at box center, Axes aligned to box)

◆ GetAxis()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::GetAxis ( int  AxisIndex) const
inline
Returns
an axis of the box

◆ GetCorner()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::GetCorner ( int  Index) const
inline
Parameters
Indexcorner index in range 0-3
Returns
Corner point on the box identified by the given index. Ordering is: [ (-x,-y), (x,-y), (x,y), (-x,y) ]

◆ GetCornerSide()

template<typename RealType >
static FIndex2i UE::Geometry::TOrientedBox2< RealType >::GetCornerSide ( int  Index)
inlinestatic

Get whether the corner at Index (see GetCorner documentation comment) is in the negative or positive direction for each axis

Parameters
Indexcorner index in range 0-4
Returns
Index2i with 0 or 1 for each axis, 0 if corner is in the negative direction for that axis, 1 if in the positive direction

◆ Perimeter()

template<typename RealType >
RealType UE::Geometry::TOrientedBox2< RealType >::Perimeter ( ) const
inline
Returns
perimeter of box

◆ SetAngleRadians()

template<typename RealType >
void UE::Geometry::TOrientedBox2< RealType >::SetAngleRadians ( RealType  AngleRad)
inline

◆ TestCorners()

template<typename RealType >
bool UE::Geometry::TOrientedBox2< RealType >::TestCorners ( PointPredicateType  CornerPointPredicate) const
inline

Call CornerPointPredicate(TVector2<RealType>) for each of the 4 box corners, with early-out if any call returns false

Returns
true if all tests pass

◆ ToLocalSpace()

template<typename RealType >
TVector2< RealType > UE::Geometry::TOrientedBox2< RealType >::ToLocalSpace ( const TVector2< RealType > &  Point) const
inline
Returns
Point transformed to the local space of the box (Origin at box center, Axes aligned to box)

◆ UnitPositive()

template<typename RealType >
static TOrientedBox2< RealType > UE::Geometry::TOrientedBox2< RealType >::UnitPositive ( )
inlinestatic
Returns
box with unit dimensions where minimum corner is at origin

◆ UnitZeroCentered()

template<typename RealType >
static TOrientedBox2< RealType > UE::Geometry::TOrientedBox2< RealType >::UnitZeroCentered ( )
inlinestatic
Returns
box with unit dimensions centered at origin

Member Data Documentation

◆ Extents

template<typename RealType >
TVector2<RealType> UE::Geometry::TOrientedBox2< RealType >::Extents

Half-dimensions of box measured along the two axes

◆ Origin

template<typename RealType >
TVector2<RealType> UE::Geometry::TOrientedBox2< RealType >::Origin

◆ UnitAxisX

template<typename RealType >
TVector2<RealType> UE::Geometry::TOrientedBox2< RealType >::UnitAxisX

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