Show / Hide Table of Contents

Class TransformModifier

Changes the world space positioning of the grid by a linear transform, leaving everything else unchanged.

Inheritance
object
BaseModifier
TransformModifier
XZModifier
Implements
IGrid
Inherited Members
BaseModifier.GetCellTypes()
BaseModifier.GetDiagonalGrid()
BaseModifier.GetCompactGrid()
BaseModifier.GetCells()
BaseModifier.GetCellType(Cell)
BaseModifier.IsCellInGrid(Cell)
BaseModifier.TryMove(Cell, CellDir, out Cell, out CellDir, out Connection)
BaseModifier.TryMoveByOffset(Cell, Vector3Int, Vector3Int, CellRotation, out Cell, out CellRotation)
BaseModifier.ParallelTransport(IGrid, Cell, Cell, Cell, CellRotation, out Cell, out CellRotation)
BaseModifier.GetCellDirs(Cell)
BaseModifier.GetCellCorners(Cell)
BaseModifier.FindBasicPath(Cell, Cell)
BaseModifier.GetIndex(Cell)
BaseModifier.GetCellByIndex(int)
BaseModifier.GetBound()
BaseModifier.GetBound(IEnumerable<Cell>)
BaseModifier.BoundBy(IBound)
BaseModifier.IntersectBounds(IBound, IBound)
BaseModifier.UnionBounds(IBound, IBound)
BaseModifier.GetCellsInBounds(IBound)
BaseModifier.IsCellInBound(Cell, IBound)
BaseModifier.FindGridSymmetry(ISet<Cell>, ISet<Cell>, Cell, CellRotation)
BaseModifier.TryApplySymmetry(GridSymmetry, IBound, out IBound)
BaseModifier.TryApplySymmetry(GridSymmetry, Cell, out Cell, out CellRotation)
BaseModifier.Is2d
BaseModifier.Is3d
BaseModifier.IsPlanar
BaseModifier.IsRepeating
BaseModifier.IsOrientable
BaseModifier.IsFinite
BaseModifier.IsSingleCellType
BaseModifier.CoordinateDimension
BaseModifier.Unbounded
BaseModifier.Unwrapped
BaseModifier.Underlying
BaseModifier.IndexCount
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Sylves
Assembly: Sylves.dll
Syntax
public class TransformModifier : BaseModifier, IGrid

Constructors

TransformModifier(IGrid, Matrix4x4)

Declaration
public TransformModifier(IGrid underlying, Matrix4x4 transform)
Parameters
Type Name Description
IGrid underlying
Matrix4x4 transform

Properties

Transform

Declaration
public Matrix4x4 Transform { get; }
Property Value
Type Description
Matrix4x4

Methods

FindCell(Matrix4x4, out Cell, out CellRotation)

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
Type Name Description
Matrix4x4 matrix
Cell cell
CellRotation rotation
Returns
Type Description
bool
Overrides
BaseModifier.FindCell(Matrix4x4, out Cell, out CellRotation)

FindCell(Vector3, out Cell)

Finds the cell containg the give position

Declaration
public override bool FindCell(Vector3 position, out Cell cell)
Parameters
Type Name Description
Vector3 position
Cell cell
Returns
Type Description
bool
Overrides
BaseModifier.FindCell(Vector3, out Cell)

GetAabb(Cell)

Gets a bounding box for a single cell.

Declaration
public override Aabb GetAabb(Cell cell)
Parameters
Type Name Description
Cell cell
Returns
Type Description
Aabb
Overrides
BaseModifier.GetAabb(Cell)

GetAabb(IEnumerable<Cell>)

Gets a bounding box for a collection of cells. Throws if cells is empty.

Declaration
public override Aabb GetAabb(IEnumerable<Cell> cells)
Parameters
Type Name Description
IEnumerable<Cell> cells
Returns
Type Description
Aabb
Overrides
BaseModifier.GetAabb(IEnumerable<Cell>)

GetBoundAabb(IBound)

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
Type Description
Aabb?
Overrides
BaseModifier.GetBoundAabb(IBound)

GetCellCenter(Cell)

Returns the center of the cell in local space

Declaration
public override Vector3 GetCellCenter(Cell cell)
Parameters
Type Name Description
Cell cell
Returns
Type Description
Vector3
Overrides
BaseModifier.GetCellCenter(Cell)

GetCellCorner(Cell, CellCorner)

Returns the position of a corner.

Declaration
public override Vector3 GetCellCorner(Cell cell, CellCorner corner)
Parameters
Type Name Description
Cell cell
CellCorner corner
Returns
Type Description
Vector3
Overrides
BaseModifier.GetCellCorner(Cell, CellCorner)

GetCellsIntersectsApprox(Vector3, Vector3)

Gets the set of cells that potentially overlap bounds.

Declaration
public override IEnumerable<Cell> GetCellsIntersectsApprox(Vector3 min, Vector3 max)
Parameters
Type Name Description
Vector3 min
Vector3 max
Returns
Type Description
IEnumerable<Cell>
Overrides
BaseModifier.GetCellsIntersectsApprox(Vector3, Vector3)

GetDeformation(Cell)

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
Type Description
Deformation
Overrides
BaseModifier.GetDeformation(Cell)

GetDual()

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
Type Description
IDualMapping
Overrides
BaseModifier.GetDual()

GetMeshData(Cell, out MeshData, out Matrix4x4)

For 3d cells, returns the mesh of a given cell.

Declaration
public override void GetMeshData(Cell cell, out MeshData meshData, out Matrix4x4 transform)
Parameters
Type Name Description
Cell cell
MeshData meshData
Matrix4x4 transform
Overrides
BaseModifier.GetMeshData(Cell, out MeshData, out Matrix4x4)

GetPolygon(Cell, out Vector3[], out Matrix4x4)

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
BaseModifier.GetPolygon(Cell, out Vector3[], out Matrix4x4)

GetTRS(Cell)

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
Type Description
TRS
Overrides
BaseModifier.GetTRS(Cell)

GetTriangleMesh(Cell)

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
Type Description
IEnumerable<(Vector3, Vector3, Vector3, CellDir)>
Overrides
BaseModifier.GetTriangleMesh(Cell)

Raycast(Vector3, Vector3, float)

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
Type Name Description
Vector3 origin
Vector3 direction
float maxDistance
Returns
Type Description
IEnumerable<RaycastInfo>
Overrides
BaseModifier.Raycast(Vector3, Vector3, float)

Rebind(IGrid)

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
Type Description
IGrid
Overrides
BaseModifier.Rebind(IGrid)

Recenter(Cell)

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
Type Description
IGrid
Overrides
BaseModifier.Recenter(Cell)

Implements

IGrid

Extension Methods

GridExtensions.FindCell(IGrid, Vector3)
GridExtensions.GetCellsIntersectsApprox(IGrid, Aabb)
GridExtensions.GetMeshData(IGrid, Cell)
GridExtensions.GetNeighbours(IGrid, Cell)
GridExtensions.GetPolygon(IGrid, Cell)
GridExtensions.Masked(IGrid, ISet<Cell>)
GridExtensions.Masked(IGrid, Func<Cell, bool>, IEnumerable<Cell>)
GridExtensions.Move(IGrid, Cell, CellDir)
GridExtensions.ToMeshData(IGrid)
GridExtensions.ToMeshData(IGrid, IEnumerable<Cell>)
GridExtensions.Transformed(IGrid, Matrix4x4)
In this article
Back to top Generated by DocFX