C# Class Glare.Box2i

A two-dimensional box that uses Int32 elements.
Show file Open project: Burton-Radons/Alexandria Class Usage Examples

Public Properties

Property Type Description
Max Vector2i
Min Vector2i
Zero Box2i

Public Methods

Method Description
Box2i ( Int32 minX, Int32 minY, Int32 maxX, Int32 maxY ) : System

Create a Box2i by providing minimum and maximum extents.

Box2i ( Vector2i min, Vector2i max ) : System

Create a Box2i by providing minimum and maximum extents.

Distance ( Vector2i point ) : double

Get the closest distance between this Box2i and the Vector2i.

Intersect ( Vector2i point ) : Containment

Get the intersection type between this box and the point.

NearestPointTo ( Vector2i point ) : Vector2i

Get the nearest point between this Box2i and a Vector2i. If the Vector2i is inside this Box2i, it is returned untouched.

NearestPointTo ( Vector2i &point, Vector2i &result ) : void

Get the nearest point between this Box2i and a Vector2i. If the Vector2i is inside this Box2i, it is returned untouched.

Overlaps ( Vector2i point ) : bool

Get whether this Box2i inclusively intersects with the Vector2i.

Random ( Random rng ) : Vector2i

Get a random position within the box.

Random ( Random rng, Vector2i &result ) : void

Get a random position within the box.

Relative ( Int32 minX, Int32 minY, Int32 sizeX, Int32 sizeY ) : Box2i

Create a Box2i by providing the minimum extent and the size of each side.

Relative ( Vector2i min, Vector2i size ) : Box2i

Create a Box2i by providing the minimum extent and the size of each side.

Relative ( Int32 minX, Int32 minY, Int32 sizeX, Int32 sizeY, Box2i &result ) : void

Create a Box2i by providing the minimum extent and the size of each side.

Relative ( Vector2i min, Vector2i size, Box2i &result ) : void

Create a Box2i by providing the minimum extent and the size of each side.

ToString ( ) : string

Convert to a string representation of the Box2i.

ToString ( string format, IFormatProvider provider ) : string

Convert to a string representation of the Box2i.

Method Details

Box2i() public method

Create a Box2i by providing minimum and maximum extents.
public Box2i ( Int32 minX, Int32 minY, Int32 maxX, Int32 maxY ) : System
minX System.Int32
minY System.Int32
maxX System.Int32
maxY System.Int32
return System

Box2i() public method

Create a Box2i by providing minimum and maximum extents.
public Box2i ( Vector2i min, Vector2i max ) : System
min Vector2i
max Vector2i
return System

Distance() public method

Get the closest distance between this Box2i and the Vector2i.
public Distance ( Vector2i point ) : double
point Vector2i
return double

Intersect() public method

Get the intersection type between this box and the point.
public Intersect ( Vector2i point ) : Containment
point Vector2i
return Containment

NearestPointTo() public method

Get the nearest point between this Box2i and a Vector2i. If the Vector2i is inside this Box2i, it is returned untouched.
public NearestPointTo ( Vector2i point ) : Vector2i
point Vector2i
return Vector2i

NearestPointTo() public method

Get the nearest point between this Box2i and a Vector2i. If the Vector2i is inside this Box2i, it is returned untouched.
public NearestPointTo ( Vector2i &point, Vector2i &result ) : void
point Vector2i
result Vector2i
return void

Overlaps() public method

Get whether this Box2i inclusively intersects with the Vector2i.
public Overlaps ( Vector2i point ) : bool
point Vector2i
return bool

Random() public method

Get a random position within the box.
public Random ( Random rng ) : Vector2i
rng System.Random
return Vector2i

Random() public method

Get a random position within the box.
public Random ( Random rng, Vector2i &result ) : void
rng System.Random
result Vector2i
return void

Relative() public static method

Create a Box2i by providing the minimum extent and the size of each side.
public static Relative ( Int32 minX, Int32 minY, Int32 sizeX, Int32 sizeY ) : Box2i
minX System.Int32
minY System.Int32
sizeX System.Int32
sizeY System.Int32
return Box2i

Relative() public static method

Create a Box2i by providing the minimum extent and the size of each side.
public static Relative ( Vector2i min, Vector2i size ) : Box2i
min Vector2i
size Vector2i
return Box2i

Relative() public static method

Create a Box2i by providing the minimum extent and the size of each side.
public static Relative ( Int32 minX, Int32 minY, Int32 sizeX, Int32 sizeY, Box2i &result ) : void
minX System.Int32
minY System.Int32
sizeX System.Int32
sizeY System.Int32
result Box2i
return void

Relative() public static method

Create a Box2i by providing the minimum extent and the size of each side.
public static Relative ( Vector2i min, Vector2i size, Box2i &result ) : void
min Vector2i
size Vector2i
result Box2i
return void

ToString() public method

Convert to a string representation of the Box2i.
public ToString ( ) : string
return string

ToString() public method

Convert to a string representation of the Box2i.
public ToString ( string format, IFormatProvider provider ) : string
format string
provider IFormatProvider
return string

Property Details

Max public property

The maximum extents of the Box2i.
public Vector2i Max
return Vector2i

Min public property

The minimum extents of the Box2i.
public Vector2i Min
return Vector2i

Zero public static property

Get an empty Box2i centred on the origin.
public static Box2i,Glare Zero
return Box2i