GearBlocks
The GearBlocks Lua scripting API
Public Member Functions | Static Public Member Functions | Properties | List of all members
SmashHammer.Scripting.BoundsProxy Struct Reference

A bounding box. More...

Public Member Functions

 BoundsProxy (Vector3Proxy center, Vector3Proxy size)
 Constructor.
 
Vector3Proxy ClosestPoint (Vector3Proxy point)
 Find the closest point on the bounding box.
 
bool Contains (Vector3Proxy point)
 Tests if a point is contained within the bounding box.
 
void Encapsulate (Vector3 point)
 Grow the bounds to encapsulate the point.
 
void Encapsulate (BoundsProxy otherBounds)
 Grow the bounds to encapsulate the other bounds.
 
void Expand (float amount)
 Expand the bounds by increasing its size by an amount along each side.
 
void Expand (Vector3Proxy amount)
 Expand the bounds by increasing its size by an amount along each side.
 
bool Intersects (BoundsProxy bounds)
 Test if another bounding box intersects this one.
 
void SetMinMax (Vector3Proxy min, Vector3Proxy max)
 Set the bounding box from min and max values.
 
float SqrDistance (Vector3Proxy point)
 Find the smallest squared distance between a point and the bounding box.
 

Static Public Member Functions

static bool operator== (BoundsProxy lhs, BoundsProxy rhs)
 Compare two bounds.
 
static bool operator!= (BoundsProxy lhs, BoundsProxy rhs)
 Compare two bounds.
 

Properties

Vector3Proxy Center [get, set]
 The box's centre.
 
Vector3Proxy Extents [get, set]
 The box's extents.
 
Vector3Proxy Size [get, set]
 The box's size.
 
Vector3Proxy Min [get, set]
 The box's minimal point.
 
Vector3Proxy Max [get, set]
 The box's maximal point.
 

Detailed Description

A bounding box.

Static methods available in Lua via the "Bounds" global, for example:

local bounds = Bounds.__new( Vector3.Zero, Vector3.__new( 10, 10, 10 ) )

Constructor & Destructor Documentation

◆ BoundsProxy()

SmashHammer.Scripting.BoundsProxy.BoundsProxy ( Vector3Proxy  center,
Vector3Proxy  size 
)

Constructor.

Parameters
centerThe center to initialise with.
sizeThe size to initialise with.

Member Function Documentation

◆ ClosestPoint()

Vector3Proxy SmashHammer.Scripting.BoundsProxy.ClosestPoint ( Vector3Proxy  point)

Find the closest point on the bounding box.

Parameters
pointThe point to test.
Returns
A point on / inside the bounding box.

◆ Contains()

bool SmashHammer.Scripting.BoundsProxy.Contains ( Vector3Proxy  point)

Tests if a point is contained within the bounding box.

Parameters
pointThe point to test.
Returns
true if the point is inside the bounding box; otherwise, false.

◆ Encapsulate() [1/2]

void SmashHammer.Scripting.BoundsProxy.Encapsulate ( Vector3  point)

Grow the bounds to encapsulate the point.

Parameters
pointThe point to encapsulate.

◆ Encapsulate() [2/2]

void SmashHammer.Scripting.BoundsProxy.Encapsulate ( BoundsProxy  otherBounds)

Grow the bounds to encapsulate the other bounds.

Parameters
otherBoundsThe bounds to encapsulate.

◆ Expand() [1/2]

void SmashHammer.Scripting.BoundsProxy.Expand ( float  amount)

Expand the bounds by increasing its size by an amount along each side.

Parameters
amountThe amount to expand by.

◆ Expand() [2/2]

void SmashHammer.Scripting.BoundsProxy.Expand ( Vector3Proxy  amount)

Expand the bounds by increasing its size by an amount along each side.

Parameters
amountThe amount to expand by.

◆ Intersects()

bool SmashHammer.Scripting.BoundsProxy.Intersects ( BoundsProxy  bounds)

Test if another bounding box intersects this one.

Parameters
boundsThe other bounds to test.
Returns
true if the bounding boxes intersect; otherwise, false.

◆ SetMinMax()

void SmashHammer.Scripting.BoundsProxy.SetMinMax ( Vector3Proxy  min,
Vector3Proxy  max 
)

Set the bounding box from min and max values.

Parameters
minThe minimal corner of the box.
maxThe maximal corner of the box.

◆ SqrDistance()

float SmashHammer.Scripting.BoundsProxy.SqrDistance ( Vector3Proxy  point)

Find the smallest squared distance between a point and the bounding box.

Parameters
pointThe point to test.
Returns
The smallest squared distance.

◆ operator==()

static bool SmashHammer.Scripting.BoundsProxy.operator== ( BoundsProxy  lhs,
BoundsProxy  rhs 
)
static

Compare two bounds.

Parameters
lhsThe first bounds.
rhsThe second bounds.
Returns
true if the bounds are equal; otherwise, false.

◆ operator!=()

static bool SmashHammer.Scripting.BoundsProxy.operator!= ( BoundsProxy  lhs,
BoundsProxy  rhs 
)
static

Compare two bounds.

Parameters
lhsThe first bounds.
rhsThe second bounds.
Returns
true if the bounds are not equal; otherwise, false.

Property Documentation

◆ Center

Vector3Proxy SmashHammer.Scripting.BoundsProxy.Center
getset

The box's centre.

The central position of the box.

◆ Extents

Vector3Proxy SmashHammer.Scripting.BoundsProxy.Extents
getset

The box's extents.

The extents of the box (half the size).

◆ Size

Vector3Proxy SmashHammer.Scripting.BoundsProxy.Size
getset

The box's size.

The size of the box (twice the extents).

◆ Min

Vector3Proxy SmashHammer.Scripting.BoundsProxy.Min
getset

The box's minimal point.

The minimal corner of the box (center - extents).

◆ Max

Vector3Proxy SmashHammer.Scripting.BoundsProxy.Max
getset

The box's maximal point.

The maximal corner of the box (center + extents).