C# Class Glare.Box2d

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

Public Properties

Property Type Description
Max Vector2d
Min Vector2d
Zero Box2d

Public Methods

Method Description
Box2d ( Double minX, Double minY, Double maxX, Double maxY ) : System

Create a Box2d by providing minimum and maximum extents.

Box2d ( Vector2d min, Vector2d max ) : System

Create a Box2d by providing minimum and maximum extents.

Distance ( Vector2d point ) : Double

Get the closest distance between this Box2d and the Vector2d.

Intersect ( Vector2d point ) : Containment

Get the intersection type between this box and the point.

NearestPointTo ( Vector2d point ) : Vector2d

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

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

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

Overlaps ( Vector2d point ) : bool

Get whether this Box2d inclusively intersects with the Vector2d.

Random ( Random rng ) : Vector2d

Get a random position within the box.

Random ( Random rng, Vector2d &result ) : void

Get a random position within the box.

Relative ( Double minX, Double minY, Double sizeX, Double sizeY ) : Box2d

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

Relative ( Vector2d min, Vector2d size ) : Box2d

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

Relative ( Double minX, Double minY, Double sizeX, Double sizeY, Box2d &result ) : void

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

Relative ( Vector2d min, Vector2d size, Box2d &result ) : void

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

ToString ( ) : string

Convert to a string representation of the Box2d.

ToString ( string format, IFormatProvider provider ) : string

Convert to a string representation of the Box2d.

Method Details

Box2d() public method

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

Box2d() public method

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

Distance() public method

Get the closest distance between this Box2d and the Vector2d.
public Distance ( Vector2d point ) : Double
point Vector2d
return Double

Intersect() public method

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

NearestPointTo() public method

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

NearestPointTo() public method

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

Overlaps() public method

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

Random() public method

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

Random() public method

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

Relative() public static method

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

Relative() public static method

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

Relative() public static method

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

Relative() public static method

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

ToString() public method

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

ToString() public method

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

Property Details

Max public property

The maximum extents of the Box2d.
public Vector2d Max
return Vector2d

Min public property

The minimum extents of the Box2d.
public Vector2d Min
return Vector2d

Zero public static property

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