Class RelaxModifier
Applies relaxation to an infinite 2d plane, similar to MeshDataOperations.Relax.
Inheritance
RelaxModifier
Assembly: Sylves.dll
Syntax
public class RelaxModifier : PlanarLazyGrid, IGrid
Constructors
RelaxModifier(IGrid, float, float, int, ICachePolicy)
Declaration
public RelaxModifier(IGrid underlying, float chunkSize = 10, float weldTolerance = 1E-07, int relaxIterations = 3, ICachePolicy cachePolicy = null)
Parameters
Properties
CoordinateDimension
Returns the number of co-ordinates needed to identify a cell.
i.e.
dim 1 means cell.y === 0 and cell.z === 0
dim 2 means cell.z === 0
dim 3 means all three co-ordinates are relevant.
Declaration
public override int CoordinateDimension { get; }
Property Value
Overrides
Is2d
True if this grid uses 2d cell types
Declaration
public override bool Is2d { get; }
Property Value
Overrides
Is3d
True if this grid uses 3d cell types
Declaration
public override bool Is3d { get; }
Property Value
Overrides
IsFinite
True if there is a finite amout of cells in the grid.
Declaration
public override bool IsFinite { get; }
Property Value
Overrides
IsOrientable
True if tile connections never set Mirror to true.
Declaration
public override bool IsOrientable { get; }
Property Value
Overrides
IsPlanar
True if this grid uses 2d cell types, and all cells fit in the XY plane.
Declaration
public override bool IsPlanar { get; }
Property Value
Overrides
IsRepeating
True for grids that are some fixed pattern repeated over and over.
Declaration
public override bool IsRepeating { get; }
Property Value
Overrides
IsSingleCellType
True if GetCellTypes always returns a single value.
Declaration
public override bool IsSingleCellType { get; }
Property Value
Overrides
Unbounded
Returns the grid with any bounds removed.
Declaration
public override IGrid Unbounded { get; }
Property Value
Overrides
Methods
BoundBy(IBound)
Returns a new grid restricted to just the given bound.
If the grid already has a bound, the new grid will have the intersection of both.
Declaration
public override IGrid BoundBy(IBound bound)
Parameters
| Type |
Name |
Description |
| IBound |
bound |
|
Returns
Overrides
Combine(Cell, Cell)
Declaration
protected override Cell Combine(Cell childCell, Cell chunkCell)
Parameters
| Type |
Name |
Description |
| Cell |
childCell |
|
| Cell |
chunkCell |
|
Returns
Overrides
GetAdjacentChunks(Cell)
Declaration
protected override IEnumerable<Cell> GetAdjacentChunks(Cell chunkCell)
Parameters
| Type |
Name |
Description |
| Cell |
chunkCell |
|
Returns
Overrides
GetCellTypes()
Declaration
public override IEnumerable<ICellType> GetCellTypes()
Returns
Overrides
GetChildGrid(Cell)
The grid associated with each chunk. This grid has extra requirements:
- It should only use the x-coordinate of the cell. The other two should be zero, (to be offset by the chunk position)
- The dest of moves is also offset by the chunk position. Moves may be off grid (illegal in a normal grid)
As building a grid with off-grid moves is difficult, you can also just override TryMove to whatever.
Declaration
protected override IGrid GetChildGrid(Cell chunkCell)
Parameters
| Type |
Name |
Description |
| Cell |
chunkCell |
|
Returns
Overrides
Split(Cell)
Declaration
protected override (Cell childCell, Cell chunkCell) Split(Cell cell)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
Returns
Overrides
TryMove(Cell, CellDir, out Cell, out CellDir, out Connection)
Attempts to move from a cell in a given direction, and returns information about the move if successful.
Declaration
public override bool TryMove(Cell cell, CellDir dir, out Cell dest, out CellDir inverseDir, out Connection connection)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
The cell to move from
|
| CellDir |
dir |
The direction to move in
|
| Cell |
dest |
The cell moved to
|
| CellDir |
inverseDir |
The direction leading back from dest to cell.
|
| Connection |
connection |
A descriptor of how cell-local space relates between cell and dest.
|
Returns
Overrides
Implements
Extension Methods