Struct Box2d
Defines a 2d box (rectangle).
Implements
Inherited Members
Namespace: OpenTK
Assembly: OpenTK.dll
Syntax
public struct Box2d : IEquatable<Box2d>
Constructors
Box2d(Vector2d, Vector2d)
Constructs a new Box2d with the specified dimensions.
Declaration
public Box2d(Vector2d topLeft, Vector2d bottomRight)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | topLeft | An OpenTK.Vector2d describing the top-left corner of the Box2d. |
Vector2d | bottomRight | An OpenTK.Vector2d describing the bottom-right corner of the Box2d. |
Box2d(Double, Double, Double, Double)
Constructs a new Box2d with the specified dimensions.
Declaration
public Box2d(double left, double top, double right, double bottom)
Parameters
Type | Name | Description |
---|---|---|
Double | left | The position of the left boundary. |
Double | top | The position of the top boundary. |
Double | right | The position of the right boundary. |
Double | bottom | The position of the bottom boundary. |
Fields
Bottom
The bottom boundary of the structure.
Declaration
public double Bottom
Field Value
Type | Description |
---|---|
Double |
Left
The left boundary of the structure.
Declaration
public double Left
Field Value
Type | Description |
---|---|
Double |
Right
The right boundary of the structure.
Declaration
public double Right
Field Value
Type | Description |
---|---|
Double |
Top
The top boundary of the structure.
Declaration
public double Top
Field Value
Type | Description |
---|---|
Double |
Properties
Height
Gets a double describing the height of the Box2d structure.
Declaration
public readonly double Height { get; }
Property Value
Type | Description |
---|---|
Double |
Width
Gets a double describing the width of the Box2d structure.
Declaration
public readonly double Width { get; }
Property Value
Type | Description |
---|---|
Double |
Methods
Contains(Vector2d)
Returns whether the box contains the specified point on the closed region described by this Box2.
Declaration
public bool Contains(Vector2d point)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | point | The point to query. |
Returns
Type | Description |
---|---|
Boolean | Whether this box contains the point. |
Contains(Vector2d, Boolean)
Returns whether the box contains the specified point.
Declaration
public bool Contains(Vector2d point, bool closedRegion)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | point | The point to query. |
Boolean | closedRegion | Whether to include the box boundary in the test region. |
Returns
Type | Description |
---|---|
Boolean | Whether this box contains the point. |
Equals(Box2d)
Functional equality comparator.
Declaration
public bool Equals(Box2d other)
Parameters
Type | Name | Description |
---|---|---|
Box2d | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Implements Object.Equals.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
FromDimensions(Vector2d, Vector2d)
Creates a new Box2d with the specified dimensions.
Declaration
public static Box2d FromDimensions(Vector2d position, Vector2d size)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | position | The position of the top left corner. |
Vector2d | size | The size of the box. |
Returns
Type | Description |
---|---|
Box2d | A new OpenTK.Box2d with the specfied dimensions. |
FromDimensions(Double, Double, Double, Double)
Creates a new Box2d with the specified dimensions.
Declaration
public static Box2d FromDimensions(double left, double top, double width, double height)
Parameters
Type | Name | Description |
---|---|---|
Double | left | The position of the left boundary. |
Double | top | The position of the top boundary. |
Double | width | The width of the box. |
Double | height | The height of the box. |
Returns
Type | Description |
---|---|
Box2d | A new OpenTK.Box2d with the specfied dimensions. |
FromTLRB(Double, Double, Double, Double)
Creates a new Box2d with the specified dimensions.
Declaration
public static Box2d FromTLRB(double top, double left, double right, double bottom)
Parameters
Type | Name | Description |
---|---|---|
Double | top | The position of the top boundary. |
Double | left | The position of the left boundary. |
Double | right | The position of the right boundary. |
Double | bottom | The position of the bottom boundary. |
Returns
Type | Description |
---|---|
Box2d | A new OpenTK.Box2d with the specfied dimensions. |
GetHashCode()
Gets the hash code for this Box2d.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
ToString()
Returns a String describing the current instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
Translate(Vector2d)
Translates this Box2d by the given amount.
Declaration
public void Translate(Vector2d point)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | point |
Translated(Vector2d)
Returns a Box2d translated by the given amount.
Declaration
public Box2d Translated(Vector2d point)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | point |
Returns
Type | Description |
---|---|
Box2d |
Operators
Equality(Box2d, Box2d)
Equality comparator.
Declaration
public static bool operator ==(Box2d left, Box2d right)
Parameters
Type | Name | Description |
---|---|---|
Box2d | left | |
Box2d | right |
Returns
Type | Description |
---|---|
Boolean |
Inequality(Box2d, Box2d)
Inequality comparator.
Declaration
public static bool operator !=(Box2d left, Box2d right)
Parameters
Type | Name | Description |
---|---|---|
Box2d | left | |
Box2d | right |
Returns
Type | Description |
---|---|
Boolean |