FBox

Implements an axis-aligned box.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

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

Include

#include "Math/Box.h"

Syntax

struct FBox

Remarks

Implements an axis-aligned box.

Boxes describe an axis-aligned extent in three dimensions. They are used for many different things in the Engine and in games, such as bounding volumes, collision detection and visibility calculation.

Variables

Name Description

Public variable

uint8

 

IsValid

Holds a flag indicating whether this box is valid.

Public variable

FVector

 

Max

Holds the box's maximum point.

Public variable

FVector

 

Min

Holds the box's minimum point.

Constructors

Name Description

Public function

FBox()

Default constructor (no initialization).

Public function

FBox

(
    EForceInit
)

Creates and initializes a new box with zero extent and marks it as invalid.

Public function

FBox

(
    const TArray< FVector >& Points
)

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

Public function

FBox

(
    const FVector& InMin,
    const FVector& InMax
)

Creates and initializes a new box from the specified extents.

Public function

FBox

(
    const FVector* Points,
    int32 Count
)

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

Functions

Name Description

Public function Static

FBox

 

BuildAABB

(
    const FVector& Origin,
    const FVector& Extent
)

Utility function to build an AABB from Origin and Extent

Public function Const

float

 

ComputeSquaredDistanceToPoint

(
    const FVector& Point
)

Calculates the distance of a point to this box.

Public function Const

FBox

 

ExpandBy

(
    const FVector& Neg,
    const FVector& Pos
)

Increases the box size.

Public function Const

FBox

 

ExpandBy

(
    const FVector& V
)

Increases the box size.

Public function Const

FBox

 

ExpandBy

(
    float W
)

Increases the box size.

Public function Const

FVector

 

GetCenter()

Gets the center point of this box.

Public function Const

void

 

GetCenterAndExtents

(
    FVector& center,
    FVector& Extents
)

Gets the center and extents of this box.

Public function Const

FVector

 

GetClosestPointTo

(
    const FVector& Point
)

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

Public function Const

FVector

 

GetExtent()

Gets the extents of this box.

Public function Const

FVector

 

GetSize()

Gets the size of this box.

Public function Const

float

 

GetVolume()

Gets the volume of this box.

Public function

void

 

Init()

Set the initial values of the bounding box to Zero.

Public function Const

bool

 

Intersect

(
    const FBox& other
)

Checks whether the given bounding box intersects this bounding box.

Public function Const

bool

 

IntersectXY

(
    const FBox& Other
)

Checks whether the given bounding box intersects this bounding box in the XY plane.

Public function Const

FBox

 

InverseTransformBy

(
    const FTransform& M
)

Gets a bounding volume transformed by an inverted FTransform object.

Public function Const

bool

 

IsInside

(
    const FBox& Other
)

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

Public function Const

bool

 

IsInside

(
    const FVector& In
)

Checks whether the given location is inside this box.

Public function Const

bool

 

IsInsideOrOn

(
    const FVector& In
)

Checks whether the given location is inside or on this box.

Public function Const

bool

 

IsInsideXY

(
    const FBox& Other
)

Checks whether the given box is fully encapsulated by this box in the XY plane.

Public function Const

bool

 

IsInsideXY

(
    const FVector& In
)

Checks whether the given location is inside this box in the XY plane.

Public function Const

FBox

 

MoveTo

(
    const FVector& Destination
)

Moves the center of bounding box to new destination.

Public function Const

FBox

 

Overlap

(
    const FBox& Other
)

Returns the overlap FBox of two box

Public function

bool

 

Serialize

(
    FArchive& Ar
)

Public function

bool

 

Serialize

(
    FStructuredArchive::FSlot Slot
)

Public function Const

FBox

 

ShiftBy

(
    const FVector& Offset
)

Shifts the bounding box position.

Public function Const

FString

 

ToString()

Get a textual representation of this box.

Public function Const

FBox

 

TransformBy

(
    const FMatrix& M
)

Gets a bounding volume transformed by a matrix.

Public function Const

FBox

 

TransformBy

(
    const FTransform& M
)

Gets a bounding volume transformed by a FTransform object.

Public function Const

FBox

 

TransformProjectBy

(
    const FMatrix& ProjM
)

Transforms and projects a world bounding box to screen space

Operators

Name Description

Public function

FVector &

 

operator[]

(
    int32 Index
)

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

Public function Const

FBox

 

operator+

(
    const FVector& Other
)

Gets the result of addition to this bounding volume.

Public function Const

FBox

 

operator+

(
    const FBox& Other
)

Gets the result of addition to this bounding volume.

Public function

FBox &

 

operator+=

(
    const FVector& Other
)

Adds to this bounding box to include a given point.

Public function

FBox &

 

operator+=

(
    const FBox& Other
)

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

Public function Const

bool

 

operator==

(
    const FBox& Other
)

Compares two boxes for equality.

Deprecated Functions

Name Description

Public function Const

const FVecto...

 

GetExtrema

(
    int PointIndex
)

This method performed unsafe operations and should be replaced with using .Min and .Max directly or using the [] operator on this class instead.

Public function

FVector &

 

GetExtrema

(
    int PointIndex
)

This method performed unsafe operations and should be replaced with using .Min and .Max directly or using the [] operator on this class 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