# Fractals/Computer graphic techniques/2D/grid

The domain has been discretized into a mesh and then rasterized to the image

## Image

Digital image
* binary image ( 1-bit color)
* grayscale image
* color image
* binary ( 1 bit) image
* 8-bit grayscale image
* 24-bit color image

# grid

* grid
* tiling
* tesselation of the plane
** Set partitions
* Lattice
* Mesh
* checkerboard
see also:
* ruler
* axis

## Dimension

* 2D
* 3D

## Types

classify grids is by their basic grid elements:
* regular mesh = Structured grid = global grid ( finite differences)
** a quadrilateral grid is most common in structured grids
*** quadratic = rectangular mesh
** a triangular mesh : triangles are one of the most basic and standard ways to draw all kinds of meshes and shapes
*** "the Coxeter-Freudenthal triangulation. It is constructed by dividing space using a uniform cubic grid and the triangulation is obtained by subdividing each cube."
** hexagonal
* An unstructured = irregular grid, adaptive grid, local grid ( fast marching methods). Grid Refinement = Adaptive Meshes
** Quadtree Grid
** BSP tree
** A triangular surface mesh is always quick and easy to create. It is most common in unstructured grids.
** Spatially adaptive Fibonacci grids
* Basic 2D Cell Shapes
* Basic 3D Cell Shapes
tilings by regular polygons: regular (=structured ) grid
* triangular: the Coxeter-Freudenthal triangulation
* quadratic
* Hexagonal tiling

### triangulation

* Surface_triangulation
* Category:Triangulation_(geometry) in commons
* Category:Triangulation_(geometry) in wikipedia
* Delaunay_triangulation in wikibooks
* CONREC A Contouring Subroutine Written by Paul Bourke July 1987 ( using triangulation) - surface represented as a regular triangular mesh
* delaunator - A really fast JavaScript library for Delaunay triangulation of 2D points
* Illustration of a dolphin, represented with triangles.

#### Applications

* For morphing images the Delaunay triangulation provides a 'good' way to create a triangular mesh from points that are going to be moved. Each triangle can be distorted in a simple way, leading to a complex 'morphing' distortion of the overall image. In the example of morphing shown, the triangular shapes are distorted from one image to the next, so for example the hair in the first image is distorted to fit the hair in the second. At the same time as that happens, the colours 'cross fade' from one colour to another so the grey cross fades to brown.
| Sierra Nevada terrain map | 2D triangular mesh | 2D solution calculated from mesh |
* For modelling terrain or other objects given a set of sample points, the Delaunay triangulation gives a nice set of triangles to use as polygons in the model. In particular, the Delaunay triangulation avoids narrow triangles (as they have large circumcircles compared to their area).
* Delaunay triangulations are used in many other applications where a shape has to be divided up into triangles. Analysis of stresses and strains in structures is often done using a triangular mesh. In the analysis shown above, more points are put in the area of most interest to get a finer more detailed analysis in that area. That's also what we do when morphing images - we put more points where we want most control over the fine details of the morphing. If you want to change a frown into a smile, put more points around the mouth so you can change the shape more easily.

## Pixel connectivity

Pixel connectivity in wikipedia
* Square 4 connectivity
* Square 8 connectivity
* Hexagonal 6 connectivity

## creating

* gnuplot

# mesh

A mesh is a representation of a larger geometric domain by smaller discrete cells.
Types by cells:
* polygon mesh is a collection of vertices, edges and faces that defines the shape of a polyhedral object.
** The faces usually consist of triangles (triangle mesh)
** quadrilaterals (quads)
** simple convex polygons (n-gons)
Software
* openmesh - A generic and efficient polygon mesh data structure ( C++)
* meshlab
* paraview
* The Polygon Mesh Processing Library is a modern C++ open-source library for processing and visualizing polygon surface meshes. demo
* VCG The Visualization and Computer Graphics Library (VCG for short) is a open source portable C++ templated library for manipulation, processing and displaying with OpenGL of triangle and tetrahedral meshes
* meshio input/output for many mesh formats in python
* mesh pro commercial
Mesh generation in wikipedia

# coordinate system

In geometry, a coordinate system is a system which uses one or more numbers (= coordinates) to uniquely determine the position of a point in the space

# See also

* Tessellation is the process of partitioning space into a set of smaller polygons.
* commons:Category:Mesh in computer graphics
* wikipedia: Grid cell topology
* Pathfinding
* Triangle strip is a series of connected triangles, sharing vertices, allowing for more efficient memory usage for computer graphics.
* transformations
* rasterisation
** dimension-aware rasterising
* plane decomposition
* tiling
** robert heaton : wavefunction-collapse-algorithm

# references

* ↑ stackoverflow question: how-can-i-display-a-2d-binary-matrix-as-a-black-white-plot
* ↑ wikipedia: Regular_grid
* ↑ Stuttgart Visualization Course
* ↑ Amit Patel : gridsin game programming
* ↑ log polar graph paper by Claude
* ↑ Three-Dimensional Mesh Generation for Device and Process Simulation by Johann Cervenka
* ↑ Image Segmentation Using Topologically Adaptable Surfaces by Tim McInerney and Demetri Terzopoulos. Published in the Proc. CVRMed'97, Grenoble, France, March, 1997.
* ↑ T-snakes: Topology adaptive snakes by Tim McInerney , Demetri Terzopoulos. Medical Image Analysis 4 (2000) 73–91
* ↑ gnuplot docs: grid
* ↑ wikipedia : coordinate system
* ↑ dimension-aware-rasterising by TGlad