FBox2D

Implements a rectangular 2D Box.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/Box2D.h

Include

#include "Math/Box2D.h"

Syntax

struct FBox2D

Remarks

Implements a rectangular 2D Box.

Variables

Name Description

Public variable

bool

 

bIsValid

Holds a flag indicating whether this box is valid.

Public variable

FVector2D

 

Max

Holds the box's maximum point.

Public variable

FVector2D

 

Min

Holds the box's minimum point.

Constructors

Name Description

Public function

FBox2D()

Default constructor (no initialization).

Public function

FBox2D

(
    int32
)

Use ForceInit constructor instead.

Public function

FBox2D

(
    EForceInit
)

Creates and initializes a new box.

Public function

FBox2D

(
    const TArray< FVector2D >& Points
)

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

Public function

FBox2D

(
    const FVector2D& InMin,
    const FVector2D& InMax
)

Creates and initializes a new box from the specified parameters.

Public function

FBox2D

(
    const FVector2D* Points,
    const int32 Count
)

Creates and initializes a new box from the given set of points.

Functions

Name Description

Public function Const

float

 

ComputeSquaredDistanceToPoint

(
    const FVector2D& Point
)

Calculates the distance of a point to this box.

Public function Const

FBox2D

 

ExpandBy

(
    const float W
)

Increase the bounding box volume.

Public function Const

float

 

GetArea()

Gets the box area.

Public function Const

FVector2D

 

GetCenter()

Gets the box's center point.

Public function Const

void

 

GetCenterAndExtents

(
    FVector2D& center,
    FVector2D& Extents
)

Get the center and extents

Public function Const

FVector2D

 

GetClosestPointTo

(
    const FVector2D& Point
)

Calculates the closest point on or inside the box to a given point in space.

Public function Const

FVector2D

 

GetExtent()

Gets the box extents around the center.

Public function Const

FVector2D

 

GetSize()

Gets the box size.

Public function

void

 

Init()

Set the initial values of the bounding box to Zero.

Public function Const

bool

 

Intersect

(
    const FBox2D& other
)

Checks whether the given box intersects this box.

Public function Const

bool

 

IsInside

(
    const FVector2D& TestPoint
)

Checks whether the given point is inside this box.

Public function Const

bool

 

IsInside

(
    const FBox2D& Other
)

Checks whether the given box is fully encapsulated by this box.

Public function Const

FBox2D

 

ShiftBy

(
    const FVector2D& Offset
)

Shift bounding box position.

Public function Const

FString

 

ToString()

Get a textual representation of this box.

Operators

Name Description

Public function Const

bool

 

operator!=

(
    const FBox2D& Other
)

Compares two boxes for inequality.

Public function

FVector2D &

 

operator[]

(
    int32 Index
)

Gets reference to the min or max of this bounding volume.

Public function Const

FBox2D

 

operator+

(
    const FVector2D& Other
)

Gets the result of addition to this bounding volume.

Public function Const

FBox2D

 

operator+

(
    const FBox2D& Other
)

Gets the result of addition to this bounding volume.

Public function

FBox2D &

 

operator+=

(
    const FBox2D& Other
)

Adds to this bounding box to include a new bounding volume.

Public function

FBox2D &

 

operator+=

(
    const FVector2D& Other
)

Adds to this bounding box to include a given point.

Public function Const

bool

 

operator==

(
    const FBox2D& Other
)

Compares two boxes for equality.

Deprecated Functions

Name Description

Public function

 

FBox2D

(
    int32
)

Use ForceInit constructor instead.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss