Class PolygonOverlapBase<TShape>
Inheritance
System.Object
PolygonOverlapBase<TShape>
Assembly: Edgar.dll
Syntax
public abstract class PolygonOverlapBase<TShape> : Object, IPolygonOverlap<TShape>
Type Parameters
Constructors
PolygonOverlapBase()
Declaration
protected PolygonOverlapBase()
Methods
DoHaveMinimumDistance(TShape, Vector2Int, TShape, Vector2Int, Int32)
Declaration
public bool DoHaveMinimumDistance(TShape polygon1, Vector2Int position1, TShape polygon2, Vector2Int position2, int minimumDistance)
Parameters
Type |
Name |
Description |
TShape |
polygon1 |
|
Vector2Int |
position1 |
|
TShape |
polygon2 |
|
Vector2Int |
position2 |
|
System.Int32 |
minimumDistance |
|
Returns
Type |
Description |
System.Boolean |
|
DoHaveMinimumDistance(RectangleGrid2D, RectangleGrid2D, Int32)
Declaration
protected bool DoHaveMinimumDistance(RectangleGrid2D rectangle1, RectangleGrid2D rectangle2, int minimumDistance)
Parameters
Returns
Type |
Description |
System.Boolean |
|
DoOverlap(TShape, Vector2Int, TShape, Vector2Int)
Checks if two polygons overlap.
Declaration
public bool DoOverlap(TShape polygon1, Vector2Int position1, TShape polygon2, Vector2Int position2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
DoOverlap(RectangleGrid2D, RectangleGrid2D)
Checks if two rectangles overlap.
Declaration
public bool DoOverlap(RectangleGrid2D rectangle1, RectangleGrid2D rectangle2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
DoOverlap(RectangleGrid2D, Vector2Int, RectangleGrid2D, Vector2Int)
Declaration
public bool DoOverlap(RectangleGrid2D rectangle1, Vector2Int position1, RectangleGrid2D rectangle2, Vector2Int position2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
DoTouch(TShape, Vector2Int, TShape, Vector2Int, Int32)
Checks if two polygons touch
Declaration
public bool DoTouch(TShape polygon1, Vector2Int position1, TShape polygon2, Vector2Int position2, int minimumLength = 0)
Parameters
Type |
Name |
Description |
TShape |
polygon1 |
|
Vector2Int |
position1 |
|
TShape |
polygon2 |
|
Vector2Int |
position2 |
|
System.Int32 |
minimumLength |
|
Returns
Type |
Description |
System.Boolean |
|
DoTouch(RectangleGrid2D, RectangleGrid2D, Int32)
Declaration
protected bool DoTouch(RectangleGrid2D rectangle1, RectangleGrid2D rectangle2, int minimumLength)
Parameters
Returns
Type |
Description |
System.Boolean |
|
GetBoundingRectangle(TShape)
Gets the bounding rectangle for a given polygon.
Declaration
protected abstract RectangleGrid2D GetBoundingRectangle(TShape polygon)
Parameters
Type |
Name |
Description |
TShape |
polygon |
|
Returns
GetDecomposition(TShape)
Gets a decomposition of a given polygon.
Declaration
protected abstract List<RectangleGrid2D> GetDecomposition(TShape polygon)
Parameters
Type |
Name |
Description |
TShape |
polygon |
|
Returns
GetDistance(TShape, Vector2Int, TShape, Vector2Int)
Gets distance between the two polygons.
Declaration
public int GetDistance(TShape polygon1, Vector2Int position1, TShape polygon2, Vector2Int position2)
Parameters
Returns
Type |
Description |
System.Int32 |
-1 if polygons overlap
0 if polygons share at least one point
positive number othetwise
|
MergeEvents(List<Tuple<Vector2Int, Boolean>>, List<Tuple<Vector2Int, Boolean>>, OrthogonalLineGrid2D)
Merges two lists of events.
Declaration
protected List<Tuple<Vector2Int, bool>> MergeEvents(List<Tuple<Vector2Int, bool>> events1, List<Tuple<Vector2Int, bool>> events2, OrthogonalLineGrid2D line)
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<System.Tuple<Vector2Int, System.Boolean>> |
events1 |
|
System.Collections.Generic.List<System.Tuple<Vector2Int, System.Boolean>> |
events2 |
|
OrthogonalLineGrid2D |
line |
|
Returns
Type |
Description |
System.Collections.Generic.List<System.Tuple<Vector2Int, System.Boolean>> |
|
OverlapAlongLine(TShape, TShape, OrthogonalLineGrid2D)
Returns a list of point where a given moving polygon starts or ends overlapping a given fixed polygon.
Declaration
public IList<Tuple<Vector2Int, bool>> OverlapAlongLine(TShape movingPolygon, TShape fixedPolygon, OrthogonalLineGrid2D line)
Parameters
Type |
Name |
Description |
TShape |
movingPolygon |
A polygon that will move along a given line.
|
TShape |
fixedPolygon |
A polygon that stays fixed.
|
OrthogonalLineGrid2D |
line |
|
Returns
Type |
Description |
System.Collections.Generic.IList<System.Tuple<Vector2Int, System.Boolean>> |
|
OverlapAlongLine(RectangleGrid2D, RectangleGrid2D, OrthogonalLineGrid2D, Int32)
Computes the overlap along a line of a given moving rectangle and a fixed rectangle.
Declaration
protected List<Tuple<Vector2Int, bool>> OverlapAlongLine(RectangleGrid2D movingRectangle, RectangleGrid2D fixedRectangle, OrthogonalLineGrid2D line, int movingRectangleOffset = 0)
Parameters
Returns
Type |
Description |
System.Collections.Generic.List<System.Tuple<Vector2Int, System.Boolean>> |
|
OverlapAlongLine(RectangleGrid2D, IList<RectangleGrid2D>, OrthogonalLineGrid2D, Int32)
Computes the overlap along a line of a given moving rectangle and a set o fixed rectangles.
Declaration
protected List<Tuple<Vector2Int, bool>> OverlapAlongLine(RectangleGrid2D movingRectangle, IList<RectangleGrid2D> fixedRectangles, OrthogonalLineGrid2D line, int movingRectangleOffset = 0)
Parameters
Returns
Type |
Description |
System.Collections.Generic.List<System.Tuple<Vector2Int, System.Boolean>> |
|
OverlapArea(TShape, Vector2Int, TShape, Vector2Int)
Computes the area of overlap of two given polygons.
Declaration
public int OverlapArea(TShape polygon1, Vector2Int position1, TShape polygon2, Vector2Int position2)
Parameters
Returns
Type |
Description |
System.Int32 |
|
ReverseEvents(List<Tuple<Vector2Int, Boolean>>, OrthogonalLineGrid2D)
Reverses a given events list in a way that the line has the opposite direction.
Declaration
protected List<Tuple<Vector2Int, bool>> ReverseEvents(List<Tuple<Vector2Int, bool>> events, OrthogonalLineGrid2D line)
Parameters
Returns
Type |
Description |
System.Collections.Generic.List<System.Tuple<Vector2Int, System.Boolean>> |
|
Implements