AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
BoundsExtensions Class Reference

Public Types

enum  Axis { Axis.X, Axis.Y, Axis.Z }
 

Static Public Member Functions

static Bounds GetInvalidBoundsInstance ()
 Returns an instance of the 'Bounds' class which is invalid. An invalid 'Bounds' instance is one which has its size vector set to 'float.MaxValue' for all 3 components. The center of an invalid bounds instance is the zero vector. More...
 
static bool IsValid (this Bounds bounds)
 Checks if the specified bounds instance is valid. A valid 'Bounds' instance is one whose size vector does not have all 3 components set to 'float.MaxValue'. More...
 
static void GetCornerPositions (this Bounds bounds, Transform transform, ref Vector3[] positions)
 Gets all the corner points of the bounds in world space More...
 
static void GetCornerPositionsFromRendererBounds (this Bounds bounds, ref Vector3[] positions)
 Gets all the corner points from Renderer's Bounds More...
 
static void GetFacePositions (this Bounds bounds, Transform transform, ref Vector3[] positions)
 
static void GetCornerAndMidPointPositions (this Bounds bounds, Transform transform, ref Vector3[] positions)
 Gets all the corner points and mid points from Renderer's Bounds More...
 
static void GetCornerAndMidPointPositions2D (this Bounds bounds, Transform transform, ref Vector3[] positions, Axis flattenAxis)
 Gets all the corner points and mid points from Renderer's Bounds, ignoring the z axis More...
 
static Bounds Transform (this Bounds bounds, Matrix4x4 transformMatrix)
 Transforms 'bounds' using the specified transform matrix. More...
 
static Vector2 [] GetScreenSpaceCornerPoints (this Bounds bounds, Camera camera)
 Returns the screen space corner points of the specified 'Bounds' instance. More...
 
static Rect GetScreenRectangle (this Bounds bounds, Camera camera)
 Returns the rectangle which encloses the specifies 'Bounds' instance in screen space. More...
 
static float Volume (this Bounds bounds)
 Returns the volume of the bounds. More...
 
static Bounds ExpandToContain (this Bounds originalBounds, Bounds otherBounds)
 Returns bounds that contain both this bounds and the bounds passed in. More...
 
static bool ContainsBounds (this Bounds bounds, Bounds otherBounds)
 Checks to see if bounds contains the other bounds completely. More...
 
static bool CloserToPoint (this Bounds bounds, Vector3 point, Bounds otherBounds)
 Checks to see whether point is closer to bounds or otherBounds More...
 

Public Attributes

const int LBF = 0
 
const int LBB = 1
 
const int LTF = 2
 
const int LTB = 3
 
const int RBF = 4
 
const int RBB = 5
 
const int RTF = 6
 
const int RTB = 7
 
const int LTF_RTF = 8
 
const int LBF_RBF = 9
 
const int RTB_LTB = 10
 
const int RBB_LBB = 11
 
const int LTF_LBF = 12
 
const int RTB_RBB = 13
 
const int LTB_LBB = 14
 
const int RTF_RBF = 15
 
const int RBF_RBB = 16
 
const int RTF_RTB = 17
 
const int LBF_LBB = 18
 
const int LTF_LTB = 19
 
const int LT = 0
 
const int LB = 1
 
const int RT = 2
 
const int RB = 3
 
const int LT_RT = 4
 
const int RT_RB = 5
 
const int RB_LB = 6
 
const int LB_LT = 7
 
const int TOP = 0
 
const int BOT = 1
 
const int LFT = 2
 
const int RHT = 3
 
const int FWD = 4
 
const int BCK = 5
 

Detailed Description

Definition at line 8 of file BoundsExtensions.cs.

Member Enumeration Documentation

§ Axis

enum BoundsExtensions.Axis
strong
Enumerator

Definition at line 58 of file BoundsExtensions.cs.

Member Function Documentation

§ CloserToPoint()

static bool BoundsExtensions.CloserToPoint ( this Bounds  bounds,
Vector3  point,
Bounds  otherBounds 
)
static

Checks to see whether point is closer to bounds or otherBounds

Parameters
bounds
point
otherBounds
Returns

Definition at line 434 of file BoundsExtensions.cs.

§ ContainsBounds()

static bool BoundsExtensions.ContainsBounds ( this Bounds  bounds,
Bounds  otherBounds 
)
static

Checks to see if bounds contains the other bounds completely.

Parameters
bounds
otherBounds
Returns

Definition at line 422 of file BoundsExtensions.cs.

§ ExpandToContain()

static Bounds BoundsExtensions.ExpandToContain ( this Bounds  originalBounds,
Bounds  otherBounds 
)
static

Returns bounds that contain both this bounds and the bounds passed in.

Parameters
originalBounds
otherBounds
Returns

Definition at line 407 of file BoundsExtensions.cs.

§ GetCornerAndMidPointPositions()

static void BoundsExtensions.GetCornerAndMidPointPositions ( this Bounds  bounds,
Transform  transform,
ref Vector3 []  positions 
)
static

Gets all the corner points and mid points from Renderer's Bounds

Parameters
bounds
positions

Definition at line 180 of file BoundsExtensions.cs.

§ GetCornerAndMidPointPositions2D()

static void BoundsExtensions.GetCornerAndMidPointPositions2D ( this Bounds  bounds,
Transform  transform,
ref Vector3 []  positions,
Axis  flattenAxis 
)
static

Gets all the corner points and mid points from Renderer's Bounds, ignoring the z axis

Parameters
bounds
positions

Definition at line 230 of file BoundsExtensions.cs.

§ GetCornerPositions()

static void BoundsExtensions.GetCornerPositions ( this Bounds  bounds,
Transform  transform,
ref Vector3 []  positions 
)
static

Gets all the corner points of the bounds in world space

Parameters
collider
positions

Use BoxColliderExtensions.{Left|Right}{Bottom|Top}{Front|Back} consts to index into the output corners array.

Definition at line 94 of file BoundsExtensions.cs.

§ GetCornerPositionsFromRendererBounds()

static void BoundsExtensions.GetCornerPositionsFromRendererBounds ( this Bounds  bounds,
ref Vector3 []  positions 
)
static

Gets all the corner points from Renderer's Bounds

Parameters
bounds
positions

Definition at line 129 of file BoundsExtensions.cs.

§ GetFacePositions()

static void BoundsExtensions.GetFacePositions ( this Bounds  bounds,
Transform  transform,
ref Vector3 []  positions 
)
static

Definition at line 156 of file BoundsExtensions.cs.

§ GetInvalidBoundsInstance()

static Bounds BoundsExtensions.GetInvalidBoundsInstance ( )
static

Returns an instance of the 'Bounds' class which is invalid. An invalid 'Bounds' instance is one which has its size vector set to 'float.MaxValue' for all 3 components. The center of an invalid bounds instance is the zero vector.

Definition at line 71 of file BoundsExtensions.cs.

§ GetScreenRectangle()

static Rect BoundsExtensions.GetScreenRectangle ( this Bounds  bounds,
Camera  camera 
)
static

Returns the rectangle which encloses the specifies 'Bounds' instance in screen space.

Definition at line 374 of file BoundsExtensions.cs.

§ GetScreenSpaceCornerPoints()

static Vector2 [] BoundsExtensions.GetScreenSpaceCornerPoints ( this Bounds  bounds,
Camera  camera 
)
static

Returns the screen space corner points of the specified 'Bounds' instance.

Parameters
cameraThe camera used for rendering to the screen. This is needed to perform the transformation to screen space.

Definition at line 351 of file BoundsExtensions.cs.

§ IsValid()

static bool BoundsExtensions.IsValid ( this Bounds  bounds)
static

Checks if the specified bounds instance is valid. A valid 'Bounds' instance is one whose size vector does not have all 3 components set to 'float.MaxValue'.

Definition at line 80 of file BoundsExtensions.cs.

§ Transform()

static Bounds BoundsExtensions.Transform ( this Bounds  bounds,
Matrix4x4  transformMatrix 
)
static

Transforms 'bounds' using the specified transform matrix.

Transforming a 'Bounds' instance means that the function will construct a new 'Bounds' instance which has its center translated using the translation information stored in the specified matrix and its size adjusted to account for rotation and scale. The size of the new 'Bounds' instance will be calculated in such a way that it will contain the old 'Bounds'.

Parameters
boundsThe 'Bounds' instance which must be transformed.
transformMatrixThe specified 'Bounds' instance will be transformed using this transform matrix. The function assumes that the matrix doesn't contain any projection or skew transformation.
Returns
The transformed 'Bounds' instance.

Definition at line 314 of file BoundsExtensions.cs.

§ Volume()

static float BoundsExtensions.Volume ( this Bounds  bounds)
static

Returns the volume of the bounds.

Parameters
bounds
Returns

Definition at line 396 of file BoundsExtensions.cs.

Member Data Documentation

§ BCK

const int BoundsExtensions.BCK = 5

Definition at line 56 of file BoundsExtensions.cs.

§ BOT

const int BoundsExtensions.BOT = 1

Definition at line 52 of file BoundsExtensions.cs.

§ FWD

const int BoundsExtensions.FWD = 4

Definition at line 55 of file BoundsExtensions.cs.

§ LB

const int BoundsExtensions.LB = 1

Definition at line 40 of file BoundsExtensions.cs.

§ LB_LT

const int BoundsExtensions.LB_LT = 7

Definition at line 48 of file BoundsExtensions.cs.

§ LBB

const int BoundsExtensions.LBB = 1

Definition at line 12 of file BoundsExtensions.cs.

§ LBF

const int BoundsExtensions.LBF = 0

Definition at line 11 of file BoundsExtensions.cs.

§ LBF_LBB

const int BoundsExtensions.LBF_LBB = 18

Definition at line 35 of file BoundsExtensions.cs.

§ LBF_RBF

const int BoundsExtensions.LBF_RBF = 9

Definition at line 22 of file BoundsExtensions.cs.

§ LFT

const int BoundsExtensions.LFT = 2

Definition at line 53 of file BoundsExtensions.cs.

§ LT

const int BoundsExtensions.LT = 0

Definition at line 39 of file BoundsExtensions.cs.

§ LT_RT

const int BoundsExtensions.LT_RT = 4

Definition at line 45 of file BoundsExtensions.cs.

§ LTB

const int BoundsExtensions.LTB = 3

Definition at line 14 of file BoundsExtensions.cs.

§ LTB_LBB

const int BoundsExtensions.LTB_LBB = 14

Definition at line 29 of file BoundsExtensions.cs.

§ LTF

const int BoundsExtensions.LTF = 2

Definition at line 13 of file BoundsExtensions.cs.

§ LTF_LBF

const int BoundsExtensions.LTF_LBF = 12

Definition at line 27 of file BoundsExtensions.cs.

§ LTF_LTB

const int BoundsExtensions.LTF_LTB = 19

Definition at line 36 of file BoundsExtensions.cs.

§ LTF_RTF

const int BoundsExtensions.LTF_RTF = 8

Definition at line 21 of file BoundsExtensions.cs.

§ RB

const int BoundsExtensions.RB = 3

Definition at line 42 of file BoundsExtensions.cs.

§ RB_LB

const int BoundsExtensions.RB_LB = 6

Definition at line 47 of file BoundsExtensions.cs.

§ RBB

const int BoundsExtensions.RBB = 5

Definition at line 16 of file BoundsExtensions.cs.

§ RBB_LBB

const int BoundsExtensions.RBB_LBB = 11

Definition at line 24 of file BoundsExtensions.cs.

§ RBF

const int BoundsExtensions.RBF = 4

Definition at line 15 of file BoundsExtensions.cs.

§ RBF_RBB

const int BoundsExtensions.RBF_RBB = 16

Definition at line 33 of file BoundsExtensions.cs.

§ RHT

const int BoundsExtensions.RHT = 3

Definition at line 54 of file BoundsExtensions.cs.

§ RT

const int BoundsExtensions.RT = 2

Definition at line 41 of file BoundsExtensions.cs.

§ RT_RB

const int BoundsExtensions.RT_RB = 5

Definition at line 46 of file BoundsExtensions.cs.

§ RTB

const int BoundsExtensions.RTB = 7

Definition at line 18 of file BoundsExtensions.cs.

§ RTB_LTB

const int BoundsExtensions.RTB_LTB = 10

Definition at line 23 of file BoundsExtensions.cs.

§ RTB_RBB

const int BoundsExtensions.RTB_RBB = 13

Definition at line 28 of file BoundsExtensions.cs.

§ RTF

const int BoundsExtensions.RTF = 6

Definition at line 17 of file BoundsExtensions.cs.

§ RTF_RBF

const int BoundsExtensions.RTF_RBF = 15

Definition at line 30 of file BoundsExtensions.cs.

§ RTF_RTB

const int BoundsExtensions.RTF_RTB = 17

Definition at line 34 of file BoundsExtensions.cs.

§ TOP

const int BoundsExtensions.TOP = 0

Definition at line 51 of file BoundsExtensions.cs.


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