Class RectangleGrid2D
Inheritance
System.Object
RectangleGrid2D
Namespace: Edgar.Geometry
Assembly: Edgar.dll
Syntax
public sealed class RectangleGrid2D : ValueType
Constructors
RectangleGrid2D(Vector2Int, Vector2Int)
Constructs a rectangle from given two points.
Declaration
public RectangleGrid2D(Vector2Int a, Vector2Int b)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | a | |
| Vector2Int | b |
Remarks
Resulting reference points of the created rectangle may be different from the given points.
Fields
A
Bottom-left corner of the rectangle.
Declaration
public readonly Vector2Int A
Field Value
| Type | Description |
|---|---|
| Vector2Int |
B
Top right corner of the rectangle.
Declaration
public readonly Vector2Int B
Field Value
| Type | Description |
|---|---|
| Vector2Int |
Properties
Area
Area of the rectangle.
Declaration
public int Area { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Center
Center point of the rectangle. (Possibly rounded)
Declaration
public Vector2Int Center { get; }
Property Value
| Type | Description |
|---|---|
| Vector2Int |
Height
Height of the rectangle.
Declaration
public int Height { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Width
Width of the rectangle.
Declaration
public int Width { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
Rotate(Int32)
Rotates the rectangle.
Declaration
public RectangleGrid2D Rotate(int degrees)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | degrees | Degrees divisible by 90. |
Returns
| Type | Description |
|---|---|
| RectangleGrid2D |
Operators
Addition(RectangleGrid2D, Vector2Int)
Adds a given offset to both reference points of the rectangle.
Declaration
public static RectangleGrid2D operator +(RectangleGrid2D rectangle, Vector2Int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| RectangleGrid2D | rectangle | |
| Vector2Int | offset |
Returns
| Type | Description |
|---|---|
| RectangleGrid2D |