fCraft  0.638
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
fCraft.BoundingBox Class Reference

Defines a 3D bounding box, in integer cartesian coordinates. Coordinates are always inclusive, so note that even a bounding box with coinciding vertices is a 1x1x1 cube, and has non-zero volume and non-zero dimensions. More...

+ Inheritance diagram for fCraft.BoundingBox:
+ Collaboration diagram for fCraft.BoundingBox:

Public Member Functions

 BoundingBox (Vector3I p1, Vector3I p2)
 Constructs a bounding box using two vectors as opposite corners.
 
 BoundingBox (BoundingBox other)
 Creates a copy of the given BoundingBox.
 
 BoundingBox (Vector3I origin, int width, int length, int height)
 Constructs a bounding box at a given origin, with given dimensions.
 
 BoundingBox (int x1, int y1, int z1, int x2, int y2, int z2)
 Constructs a bounding box between two given coordinates.
 
bool Insersects ([NotNull] BoundingBox other)
 Checks whether this bounding box intersects/touches another one.
 
bool Contains ([NotNull] BoundingBox other)
 Checks if another bounding box is wholly contained inside this one.
 
bool Contains (int x, int y, int z)
 Checks if a given point is inside this bounding box.
 
bool Contains (Vector3I point)
 Checks if a given point is inside this bounding box.
 
BoundingBox GetIntersection ([NotNull] BoundingBox other)
 Returns a BoundingBox object that describes the space shared between this and another box.
 
 BoundingBox ([NotNull] XElement root)
 
XElement Serialize ([NotNull] string tagName)
 
XElement Serialize ()
 
bool Equals ([NotNull] BoundingBox other)
 
override string ToString ()
 
object Clone ()
 

Public Attributes

int XMin
 
const string XmlRootElementName = "BoundingBox"
 

Static Public Attributes

static readonly BoundingBox Empty = new BoundingBox( 0, 0, 0, 0, 0, 0 )
 Empty BoundingBox (1x1x1), at origin (0,0,0).
 

Properties

int Volume [get]
 Returns volume of this bounding box. Guaranteed to be at least 1.
 
Vector3I Dimensions [get]
 Gets a vector of the box's dimensions: (width,length,height) - that's (x,y,z). Guaranteed to be non-zero in every direction.
 
int Width [get]
 Width of the bounding box (XMax - XMin + 1). Inclusive, and always at least 1.
 
int Length [get]
 Width of the bounding box (YMax - YMin + 1). Notch's Z. Inclusive, and always at least 1.
 
int Height [get]
 Width of the bounding box (ZMax - ZMin + 1). Notch's Y. Inclusive, and always at least 1.
 
Vector3I MinVertex [get, set]
 Gets or sets the vertex closest to the coordinate origin, opposite MaxVertex. When setting, MaxVertex may be adjusted as well, to keep minimums/maximums consistent.
 
Vector3I MaxVertex [get, set]
 Gets or sets the vertex farthest from the origin, opposite MinVertex. When setting, MaxVertex may be adjusted as well, to keep minimums/maximums consistent.
 

Detailed Description

Defines a 3D bounding box, in integer cartesian coordinates. Coordinates are always inclusive, so note that even a bounding box with coinciding vertices is a 1x1x1 cube, and has non-zero volume and non-zero dimensions.

Constructor & Destructor Documentation

fCraft.BoundingBox.BoundingBox ( Vector3I  p1,
Vector3I  p2 
)

Constructs a bounding box using two vectors as opposite corners.

fCraft.BoundingBox.BoundingBox ( BoundingBox  other)

Creates a copy of the given BoundingBox.

fCraft.BoundingBox.BoundingBox ( Vector3I  origin,
int  width,
int  length,
int  height 
)

Constructs a bounding box at a given origin, with given dimensions.

Parameters
originOrigin point of the bounding box.
widthWidth (X-axis, horizontal). May be negative.
lengthLength (Y-axis, horizontal). May be negative.
heightWidth (Z-axis, vertical). May be negative.
fCraft.BoundingBox.BoundingBox ( int  x1,
int  y1,
int  z1,
int  x2,
int  y2,
int  z2 
)

Constructs a bounding box between two given coordinates.

fCraft.BoundingBox.BoundingBox ( [NotNull] XElement  root)

Member Function Documentation

object fCraft.BoundingBox.Clone ( )
bool fCraft.BoundingBox.Contains ( [NotNull] BoundingBox  other)

Checks if another bounding box is wholly contained inside this one.

Exceptions
ArgumentNullExceptionother is null.
bool fCraft.BoundingBox.Contains ( int  x,
int  y,
int  z 
)

Checks if a given point is inside this bounding box.

bool fCraft.BoundingBox.Contains ( Vector3I  point)

Checks if a given point is inside this bounding box.

bool fCraft.BoundingBox.Equals ( [NotNull] BoundingBox  other)
BoundingBox fCraft.BoundingBox.GetIntersection ( [NotNull] BoundingBox  other)

Returns a BoundingBox object that describes the space shared between this and another box.

Returns
Intersecting volume, or BoundingBox.Empty if there is no overlap.
Exceptions
ArgumentNullExceptionother is null.
bool fCraft.BoundingBox.Insersects ( [NotNull] BoundingBox  other)

Checks whether this bounding box intersects/touches another one.

Exceptions
ArgumentNullExceptionother is null.
XElement fCraft.BoundingBox.Serialize ( [NotNull] string  tagName)
XElement fCraft.BoundingBox.Serialize ( )
override string fCraft.BoundingBox.ToString ( )

Member Data Documentation

readonly BoundingBox fCraft.BoundingBox.Empty = new BoundingBox( 0, 0, 0, 0, 0, 0 )
static

Empty BoundingBox (1x1x1), at origin (0,0,0).

int fCraft.BoundingBox.XMin
const string fCraft.BoundingBox.XmlRootElementName = "BoundingBox"

Property Documentation

Vector3I fCraft.BoundingBox.Dimensions
get

Gets a vector of the box's dimensions: (width,length,height) - that's (x,y,z). Guaranteed to be non-zero in every direction.

int fCraft.BoundingBox.Height
get

Width of the bounding box (ZMax - ZMin + 1). Notch's Y. Inclusive, and always at least 1.

int fCraft.BoundingBox.Length
get

Width of the bounding box (YMax - YMin + 1). Notch's Z. Inclusive, and always at least 1.

Vector3I fCraft.BoundingBox.MaxVertex
getset

Gets or sets the vertex farthest from the origin, opposite MinVertex. When setting, MaxVertex may be adjusted as well, to keep minimums/maximums consistent.

Vector3I fCraft.BoundingBox.MinVertex
getset

Gets or sets the vertex closest to the coordinate origin, opposite MaxVertex. When setting, MaxVertex may be adjusted as well, to keep minimums/maximums consistent.

int fCraft.BoundingBox.Volume
get

Returns volume of this bounding box. Guaranteed to be at least 1.

int fCraft.BoundingBox.Width
get

Width of the bounding box (XMax - XMin + 1). Inclusive, and always at least 1.


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