## Rectilinear Grid

Rectilinear grids are a frequently used structure in simulations and visualization due to their compromise of speed and flexibility.

A rectilinear grid is very similar to a Cartesian Grid in that it is a basic square matrix arrangement of data. The one addition is that the uniform spacing restriction is lifted. In a rectilinear grid an additional transform function is used to transform integer I and J (and K in 3-dimensional grids) into floating-point X, Y (and Z) coordinates. Because of this the data can still be maintained in memory and addressed via its IJK indices, and mapped into XYZ space as a final step. This allows the grid cell size to vary across the space, allowing certain regions to be of high density and others sparse. Also several algorithms, like Marching Cubes, can be performed in the integer IJK space extremely fast and the final results can be transformed back into the XYZ space.

**Directional Uniformity**- Like a Cartesian grid, the direction from Cell(I,J,K) to Cell(I+1,J,K) is constant for all I.**Partial Distance Uniformity**- The distance between Cell(I,J,K) and Cell(I+1,J,K) will vary depending on I, but for all J and K should remain the same. Similar properties apply for J and K.**No Volume Uniformity**- Cells are of varying volumes, depending on their I,J,K location.

As with Cartesian grids, they lack the ability to represent non-rectangular spaces with much accuracy. While the variable resolution aspect of the grid can help give you the extra resolution in the needed areas, it still does not solve the problem of digitizing the edges of curved or diagonal shapes.

Historically, the definition of rectilinear grids was constrained so that the mapping of I to X (and J to Y, etc.) was independent of the other variables across the space. This makes mapping between the two spaces fast and simple and enforces the rectangular shape of the grid. With faster processors and better programming techniques, most systems have begun to blur the line between rectilinear and Curvilinear Grids and call them both rectilinear grids.

The following is an example of a rectilinear grid using the legacy VTK format.

# vtk DataFile Version 3.0 Non-uniform Rectilinear - Rectilinear Grid ASCII DATASET RECTILINEAR_GRID DIMENSIONS 10 10 4 X_COORDINATES 10 float 0.0 0.1 0.2 0.4 0.8 1.6 2.4 3.2 4.0 4.8 Y_COORDINATES 10 float 0.0 0.1 0.2 0.4 0.8 1.6 2.4 3.2 4.0 4.8 Z_COORDINATES 4 float 0.0 0.4 0.8 1.6