Class TransformModifier
Changes the world space positioning of the grid by a linear transform,
leaving everything else unchanged.
Inheritance
TransformModifier
Assembly: Sylves.dll
public class TransformModifier : BaseModifier, IGrid
Constructors
Declaration
public TransformModifier(IGrid underlying, Matrix4x4 transform)
Parameters
Properties
Declaration
public Matrix4x4 Transform { get; }
Property Value
Methods
Returns the cell and rotation corresponding to a given transform matrix.
Declaration
public override bool FindCell(Matrix4x4 matrix, out Cell cell, out CellRotation rotation)
Parameters
Returns
Overrides
Finds the cell containg the give position
Declaration
public override bool FindCell(Vector3 position, out Cell cell)
Parameters
Returns
Overrides
Gets a bounding box for a single cell.
Declaration
public override Aabb GetAabb(Cell cell)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
Returns
Overrides
Gets a bounding box for a collection of cells.
Throws if cells is empty.
Declaration
public override Aabb GetAabb(IEnumerable<Cell> cells)
Parameters
Returns
Overrides
Returns a bounding box that fully covers all the cells in bounds.
Returns null
Declaration
public override Aabb? GetBoundAabb(IBound bound)
Parameters
| Type |
Name |
Description |
| IBound |
bound |
|
Returns
Overrides
Returns the center of the cell in local space
Declaration
public override Vector3 GetCellCenter(Cell cell)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
Returns
Overrides
Returns the position of a corner.
Declaration
public override Vector3 GetCellCorner(Cell cell, CellCorner corner)
Parameters
Returns
Overrides
Gets the set of cells that potentially overlap bounds.
Declaration
public override IEnumerable<Cell> GetCellsIntersectsApprox(Vector3 min, Vector3 max)
Parameters
Returns
Overrides
Returns a deformation mapping from the cell's co-ordinates
to something that fits in the grids co-ordinates.
Declaration
public override Deformation GetDeformation(Cell cell)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
Returns
Overrides
Returns a second grid which has one cell for every vertex of this grid,
and also methods for mapping corners of one grid to the other.
Declaration
public override IDualMapping GetDual()
Returns
Overrides
For 3d cells, returns the mesh of a given cell.
Declaration
public override void GetMeshData(Cell cell, out MeshData meshData, out Matrix4x4 transform)
Parameters
Overrides
For 2d cells, returns the polygon of the boundary of the cell.
For performance reasons, cells can share a vertices array, so you need to apply
a specific transform to get the polygon specific to a particular cell.
Declaration
public override void GetPolygon(Cell cell, out Vector3[] vertices, out Matrix4x4 transform)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
| Vector3[] |
vertices |
The vertices of the polygon. This should not be mutated.
|
| Matrix4x4 |
transform |
A transformation that needs to be applied to each vertex.
|
Overrides
Returns the appropriate transform for the cell.
The translation will always be to GetCellCenter,
rotation reflects the particular orientation of this cell
and the scale will reflect cell sizing.
GetTRS is often "best effort", there might not be an obvious
linear transformation from the canonical cell to the grid cell.
Declaration
public override TRS GetTRS(Cell cell)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
Returns
Overrides
For 3d cells, returns triangles on the boundary of a given cell, and which direction they correspond to.
Declaration
public override IEnumerable<(Vector3, Vector3, Vector3, CellDir)> GetTriangleMesh(Cell cell)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
Returns
Overrides
Returns the cells intersecting a ray starting at origin, of length direction.magnitude * maxDistance, in order.
Declaration
public override IEnumerable<RaycastInfo> Raycast(Vector3 origin, Vector3 direction, float maxDistance = Infinity)
Parameters
Returns
Overrides
Creates a new grid applying the current wrapper to a new underlying.
Declaration
protected override IGrid Rebind(IGrid underlying)
Parameters
| Type |
Name |
Description |
| IGrid |
underlying |
|
Returns
Overrides
Translates the grid so that the given cell is at the origin,
trying to minimize floating point error for nearby cells.
Declaration
public override IGrid Recenter(Cell cell)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
Returns
Overrides
Implements
Extension Methods