Class Area
Represents a collection of adjacent points that form a single area.
Inheritance
System.Object
Area
Namespace: InsaneScatterbrain.MapGraph
Syntax
public class Area : IPoint
Constructors
Area()
Declaration
public Area()
Area(IEnumerable<Vector2Int>)
Declaration
public Area(IEnumerable<Vector2Int> points)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Vector2Int> | points |
Properties
BorderPoints
Gets all the points on the outer edge of the area.
Declaration
public IReadOnlyCollection<Vector2Int> BorderPoints { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<Vector2Int> |
BoundingBox
Declaration
public RectInt BoundingBox { get; }
Property Value
Type | Description |
---|---|
RectInt |
Centroid
Gets the centroid of the area.
Declaration
public Vector2Int Centroid { get; }
Property Value
Type | Description |
---|---|
Vector2Int |
Points
Gets all the points the area consists of.
Declaration
public ReadOnlyCollection<Vector2Int> Points { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<Vector2Int> |
X
Declaration
public double X { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Y
Declaration
public double Y { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
Add(Vector2Int)
Declaration
public void Add(Vector2Int point)
Parameters
Type | Name | Description |
---|---|---|
Vector2Int | point |
Contains(Vector2Int)
Declaration
public bool Contains(Vector2Int point)
Parameters
Type | Name | Description |
---|---|---|
Vector2Int | point |
Returns
Type | Description |
---|---|
System.Boolean |
CreateFromRect(RectInt)
Create an area from a rectangle.
Declaration
public static Area CreateFromRect(RectInt rect)
Parameters
Type | Name | Description |
---|---|---|
RectInt | rect | The rectangle. |
Returns
Type | Description |
---|---|
Area | The area. |
Merge(Area)
Merges this area and another one together, creating a new area object.
Declaration
public Area Merge(Area other)
Parameters
Type | Name | Description |
---|---|---|
Area | other | The other area. |
Returns
Type | Description |
---|---|
Area | The merged area. |
Merge(Area, Area)
Merges this area and another one together, creating a new area object.
Declaration
public void Merge(Area other, Area result)
Parameters
Type | Name | Description |
---|---|---|
Area | other | The other area. |
Area | result | The merged result. |
Overlaps(Area)
Checks whether this area overlaps with another.
Declaration
public bool Overlaps(Area other)
Parameters
Type | Name | Description |
---|---|---|
Area | other | The other area. |
Returns
Type | Description |
---|---|
System.Boolean | True if they overlap, false otherwise. |
Reset()
Declaration
public void Reset()
Set(IEnumerable<Vector2Int>)
Creates a new area of the given points.
Declaration
public void Set(IEnumerable<Vector2Int> initialPoints)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Vector2Int> | initialPoints | The points. |