C# Class Axiom.Math.AxisAlignedBox

A 3D box aligned with the x/y/z axes.
This class represents a simple box which is aligned with the axes. It stores 2 points as the extremeties of the box, one which is the minima of all 3 axes, and the other which is the maxima of all 3 axes. This class is typically used for an axis-aligned bounding box (AABB) for collision and visibility determination.
Inheritance: ICloneable
Show file Open project: WolfgangSt/axiom Class Usage Examples

Public Methods

Method Description
AxisAlignedBox ( ) : System
AxisAlignedBox ( AxisAlignedBox box ) : System
AxisAlignedBox ( Vector3 min, Vector3 max ) : System
Clone ( ) : object
Contains ( Vector3 v ) : bool

Tests whether the given point contained by this box.

Equals ( object obj ) : bool
FromDimensions ( Vector3 center, Vector3 size ) : AxisAlignedBox

Return new bounding box from the supplied dimensions.

GetHashCode ( ) : int
Intersection ( AxisAlignedBox b2 ) : AxisAlignedBox

Calculate the area of intersection of this box and another

Intersects ( AxisAlignedBox box2 ) : bool

Returns whether or not this box intersects another.

Intersects ( Plane plane ) : bool

Intersects ( Sphere sphere ) : bool

Tests whether this box intersects a sphere.

Intersects ( Vector3 vector ) : bool

Tests whether the vector point is within this box.

Merge ( AxisAlignedBox box ) : void

Allows for merging two boxes together (combining).

Merge ( Vector3 point ) : void

Extends the box to encompass the specified point (if needed).

Scale ( Vector3 factor ) : void

Scales the size of the box by the supplied factor.

SetExtents ( Vector3 min, Vector3 max ) : void

Sets both Minimum and Maximum at once, so that UpdateCorners only needs to be called once as well.

ToString ( ) : string
Transform ( Matrix4 matrix ) : void

operator ( ) : bool

Private Methods

Method Description
UpdateCorners ( ) : void

Method Details

AxisAlignedBox() public method

public AxisAlignedBox ( ) : System
return System

AxisAlignedBox() public method

public AxisAlignedBox ( AxisAlignedBox box ) : System
box AxisAlignedBox
return System

AxisAlignedBox() public method

public AxisAlignedBox ( Vector3 min, Vector3 max ) : System
min Vector3
max Vector3
return System

Clone() public method

public Clone ( ) : object
return object

Contains() public method

Tests whether the given point contained by this box.
public Contains ( Vector3 v ) : bool
v Vector3
return bool

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool

FromDimensions() public static method

Return new bounding box from the supplied dimensions.
public static FromDimensions ( Vector3 center, Vector3 size ) : AxisAlignedBox
center Vector3 Center of the new box
size Vector3 Entire size of the new box
return AxisAlignedBox

GetHashCode() public method

public GetHashCode ( ) : int
return int

Intersection() public method

Calculate the area of intersection of this box and another
public Intersection ( AxisAlignedBox b2 ) : AxisAlignedBox
b2 AxisAlignedBox
return AxisAlignedBox

Intersects() public method

Returns whether or not this box intersects another.
public Intersects ( AxisAlignedBox box2 ) : bool
box2 AxisAlignedBox
return bool

Intersects() public method

public Intersects ( Plane plane ) : bool
plane Plane
return bool

Intersects() public method

Tests whether this box intersects a sphere.
public Intersects ( Sphere sphere ) : bool
sphere Sphere
return bool

Intersects() public method

Tests whether the vector point is within this box.
public Intersects ( Vector3 vector ) : bool
vector Vector3
return bool

Merge() public method

Allows for merging two boxes together (combining).
public Merge ( AxisAlignedBox box ) : void
box AxisAlignedBox Source box.
return void

Merge() public method

Extends the box to encompass the specified point (if needed).
public Merge ( Vector3 point ) : void
point Vector3
return void

Scale() public method

Scales the size of the box by the supplied factor.
public Scale ( Vector3 factor ) : void
factor Vector3 Factor of scaling to apply to the box.
return void

SetExtents() public method

Sets both Minimum and Maximum at once, so that UpdateCorners only needs to be called once as well.
public SetExtents ( Vector3 min, Vector3 max ) : void
min Vector3
max Vector3
return void

ToString() public method

public ToString ( ) : string
return string

Transform() public method

public Transform ( Matrix4 matrix ) : void
matrix Matrix4
return void

operator() public static method

public static operator ( ) : bool
return bool