# Fractals/Computer graphic techniques/2D/transformation

Plane transformations

# Names

* transformations
** Geometric Image Transformations
** Geometrical transformations
** coordinate transformations
* projections
** Cartographic Map projection ( in case of 3D to 2D graphic)
* mappings

# Theory

Mapping in 2D raster graphic is a complex function $f$ that maps from complex plane to complex plane:
It is implemented as point transformations.
It is usually denoted as
where
* $z=x+yi$ is a point of complex plane ( input)
* $w=u+vi$ is a point of image complex plane ( output = result)

# Example code

For instance, Mercator:
If one work with discrete geometry ( polygons and polylines) then the projecting is much harder to imlement. One have to balance accuracy and performance.

# classifications

Maps classifications
* object-based mappings ( Image objects are sets of connected pixels having the same integer value )
* pixel based mappings
Transformations ( maps) in 2-D graphics
* basic types
* Composite Transformation

# Implementations

Use of matrices:
* without matrices ( using functions)
* with matrices
Coordinate
* with Cartesian coordinate
* with homogenous coordinate

## Matrix

* "Matrix multiplication is not commutative. The order of the transformations is vital– Rotation followed by translation isvery different from translation followed by rotation"
Implementations
* Imath is a C++ and python library of 2D and 3D vector, matrix, and math operations for computer graphics
* parts of the matrix
* rows
* columns

# types

* zoom
* inversion
* unrolling (a closed curve )
* Conformal maps applied to pictures
* Moebius transformation
* Exponential and Mercator map

## Affine transformations

To represent affine transformations with matrices, we can use homogeneous coordinates. This means representing a 2-vector (x, y) as a 3-vector (x, y, 1), and similarly for higher dimensions.
| Transformation name | Affine matrix | Example |
| Identity (transform to original image) | ${\begin{bmatrix}1&0&0\\0&1&0\\0&0&1\end{bmatrix}}$ | |
| Translation | ${\begin{bmatrix}1&0&v_{x}>0\\0&1&v_{y}=0\\0&0&1\end{bmatrix}}$ | |
| Reflection | ${\begin{bmatrix}-1&0&0\\0&1&0\\0&0&1\end{bmatrix}}$ | |
| Scale | ${\begin{bmatrix}c_{x}=2&0&0\\0&c_{y}=1&0\\0&0&1\end{bmatrix}}$ | |
| Rotate | ${\begin{bmatrix}\cos(\theta )&-\sin(\theta )&0\\\sin(\theta )&\cos(\theta )&0\\0&0&1\end{bmatrix}}$ | where θ = π/6 =30° |
| Shear | ${\begin{bmatrix}1&c_{x}=0.5&0\\c_{y}=0&1&0\\0&0&1\end{bmatrix}}$ | |
The affine transforms are applicable to the registration process where two or more images are aligned (registered). An example of image registration is the generation of panoramic images that are the product of multiple images stitched together.

### scale or resize

Scaling of object about origin by by a scale factor
becomes:
${\begin{bmatrix}x'\\y'\\1\end{bmatrix}}={\begin{bmatrix}s_{x}&0&0\\0&s_{y}&0\\0&0&1\end{bmatrix}}{\begin{bmatrix}x\\y\\1\end{bmatrix}}$
Scaling
* Uniform (maintains the object’s proportions as it scales): sx = sy
* non-uniform: sx != sy
Resizing objects while maintaining a fixed centre point = Scaling object about their own center
* width' = width * sx
* height' = height * sy
* compute coordinate of corners from the center

### translation

Complex transtlation is a map
    $z'\to z+t$
where
* $z=x+y*i$
* $z'=x'+y'*i$
* $t=t_{x}+t_{y}*i$
Using this system, translation can be expressed with matrix multiplication. The functional form
becomes:
${\begin{bmatrix}x'\\y'\\1\end{bmatrix}}={\begin{bmatrix}1&0&t_{x}\\0&1&t_{y}\\0&0&1\end{bmatrix}}{\begin{bmatrix}x\\y\\1\end{bmatrix}}.$

### rotation

For rotation by an angle θ counterclockwise (positive direction) about the origin the functional form is
Written in matrix form, this becomes:
Similarly, for a rotation clockwise (negative direction) about the origin, the functional form is
the matrix form is:
These formulae assume that the x axis points right and the y axis points up.
the counter-clockwise rotation matrix in normalised coordinate:
C code without matrix
Output:

## Other Interesting maps

* with python code
Examples:
* Jason Davies: maps
* barrel-distortion
* swirl
* log-polar map
* Parabolic Cylindrical Coordinates
* Parabolic Coordinates
* Numerical approximation of conformal mappings
* description
* inflection
* Altmetric: 25Citations: 1More detail Article | OPEN Exponential Sensitivity and its Cost in Quantum Physics by András Gilyén, Tamás Kiss & Igor Jex
* Blaschke product
* squaring the circle
* elliptic by Claude Heiland-Allen
* by Paul Bourke
* A cartographic projection is a nonlinear transformation in two dimensions
** map projections and coordinate transformations
* to sphere
* Mandelbrot set projected on a shrinking Riemann-sphere by Arneauxtje
* Mandelbrot's Elephant Valley (Short Version) Timothy Chase
* Mandelbrot Buds and Branches Timothy Chase Timothy Chase
* Mandelbrot Zoom on a Sphere video by craftvid : "This a 300-trillion time zoom-in on the Mandelbrot set. The images are set on a Spherical "mobius" projection, meant to be wrapped onto a spherical surface. The image zooms in on the front center of the Sphere, while fading away on the back of the sphere."
* Cat Eye : Inverted Mandelbrot Set by denis archambaud
* Inverse & Potens Mandelbrot Set by Jens-Peter Christensen
* Z² + Sin(Cˉᵐ+phase) by Jens-Peter Christensen
* snibgo's ImageMagick pages: Barrels and pincushions
* snibgo's ImageMagick pages: Scale, rotate and translate in 3D see Cube earth

## Conformal map

* "Conformal maps preserve angles and take infinitesimal circles to infinitesimal circles. Non-conformal maps take infinitesimal circles to infinitesimal ellipses (or worse)." Claude Heiland-Allen
* "A complex function $f(z)$ is conformal at infinity if the function $f(1/z)$ is conformal at 0. This equivalent to the usual definition of conformal in terms of leaving angles unchanged in size and sense (clockwise/anticlockwise) if you think of $f$ as being conformal at infinity if it leaves angles unchanged at the "North Pole" of the Riemann sphere."
* conformal power
Conformal maps
* henry seg: spherical_image_editing in python
* newconformist: Conformally map the hyperbolic plane to arbitrary shapes by Zeno Rogue
* examples of conformal maps applied to pictures
* Moebius transformation
* An Overview of Conformal Geometry Processing (2017) by Keenan Crane
* Discrete Conformal Deformation: Algorithm and Experiments by Jian Sun, Tianqi Wu, Xianfeng Gu, Feng Luo
* Conformal map
* Poincaré Hyperbolic Disk Conformal Mapping Recipe by bugman123
* Visualizing Conformal Maps in Python by MJ Gruber
* Conformal Animation by denis archambaud
* ConformalMaps is a Julia package for approximating the Riemann map from a simply connected planar domain to a disk. It uses the zipper algorithm as described in Convergence of the zipper algorithm for conformal mapping by Don Marshall and Steffen Rohde.
* sswatson: ConformalMaps
Dictionary of Conformal Mapping by John H. Mathews, Russell W. Howell ( 2008)
* part 1
* part 2
* part 3
* part 4

## Cartographic Map projection
### cylindrical projection

Cylindrical projection ( or cylindric p. ) maps from sphere ( without poles) to cylinder

## Joukowsky transformation (map)

Description :
* John D Cook

## domain coloring or complex phase plots

Visualisation of complex functions
* The 5 ways to visualize complex functions
* commons : Category:Complex_functions
* Complex Mappings by Rand Asswad
* Poincaré Hyperbolic Disk Conformal Mapping Recipe by Paul Nylander
* david lowry-duda : phase_mag_plot/

## modular forms

* MODULAR FORMS by David Lowry-Duda
* The L-functions and modular forms database (LMFDB)

## Riemann mappings

* The Riemann Mapping Theorem by Christopher J. Bishop
* Riemman for anti-dummies by ©2015 LYM Canada
* Maping component to the unit disk ( Riemann map ):
** Multiplier map and internal ray
*** on the parameter plane
*** on the dynamic plane
** Boettcher map, complex potential and external ray
*** on the parameter plane
**** parameter ray = field lines
**** complex potential , external angle

# References

* ↑ Map projection in wikipedia
* ↑ observable: plot-projections
* ↑ Transverse_Mercator_projection in wikipedia
* ↑ : Geographic projections, spherical shapes and spherical trigonometry in JavaScript
* ↑ geeksforgeeks : composite-transformation-in-2-d-graphics
* ↑ 2D transformations and homogeneous coordinates by Dr Nicolas Holzschuch University of Cape Town
* ↑ Terr, David. "Complex Translation." From MathWorld--A Wolfram Web Resource, created by Eric W. Weisstein.
* ↑ http://ocw.mit.edu/courses/aeronautics-and-astronautics/16-07-dynamics-fall-2009/lecture-notes/MIT16_07F09_Lec03.pdf Template:Bare URL PDF
* ↑ opentextbc.ca: nature of geographic information
* ↑ wolfram : ComplexFunctionsAppliedToASquare
* ↑ scikit-image.org docs: swirl
* ↑ Log-Polar Mapping by Alexandre Bernardino
* ↑ Weisstein, Eric W. "Parabolic Cylindrical Coordinates." From MathWorld--A Wolfram Web Resource
* ↑ Weisstein, Eric W. "Parabolic Coordinates." From MathWorld--A Wolfram Web Resource.
* ↑ Numerical approximation of conformal mappings by Bjørnar Steinnes Luteberget
* ↑ processing : transform2d
* ↑ Squares that Look Round: Transforming Spherical Images by Saul Schleimer Henry Segerman
* ↑ fractalforums inflection-mappings
* ↑ theinnerframe : playing-with-circular-images
* ↑ theinnerframe :squaring-the-circle
* ↑ fractalforums: fractal-on-sphere
* ↑ math.stackexchange question: conformal-mappings-of-riemann-sphere
* ↑ Spherical Projections (Stereographic and Cylindrical) Written by Paul Bourke
* ↑ Weisstein, Eric W. "Cylindrical Projection." From MathWorld--A Wolfram Web Resource.
* ↑ johndcook : joukowsky-transformation
* immersive linear algebra by J. Ström, K. Åström, and T. Akenine-Möller