Copyright | (c) Alexey Kuleshevich 2016-2019 |
---|---|

License | BSD3 |

Maintainer | Alexey Kuleshevich <lehins@yandex.ru> |

Stability | experimental |

Portability | non-portable |

Safe Haskell | None |

Language | Haskell2010 |

## Synopsis

- data Complex a = !a :+ !a
- (+:) :: ColorSpace cs e => Pixel cs e -> Pixel cs e -> Pixel cs (Complex e)
- realPart :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> Pixel cs e
- imagPart :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> Pixel cs e
- mkPolar :: (ColorSpace cs e, RealFloat e) => Pixel cs e -> Pixel cs e -> Pixel cs (Complex e)
- cis :: (ColorSpace cs e, RealFloat e) => Pixel cs e -> Pixel cs (Complex e)
- polar :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> (Pixel cs e, Pixel cs e)
- magnitude :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> Pixel cs e
- phase :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> Pixel cs e
- conjugate :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> Pixel cs (Complex e)

### Rectangular form

Complex numbers are an algebraic type.

For a complex number `z`

,

is a number with the magnitude of `abs`

z`z`

,
but oriented in the positive real direction, whereas

has the phase of `signum`

z`z`

, but unit magnitude.

The `Foldable`

and `Traversable`

instances traverse the real part first.

Note that `Complex`

's instances inherit the deficiencies from the type
parameter's. For example, `Complex Float`

's `Ord`

instance has similar
problems to `Float`

's.

!a :+ !a infix 6 | forms a complex number from its real and imaginary rectangular components. |

## Instances

realPart :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> Pixel cs e Source #

Extracts the real part of a complex pixel.

imagPart :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> Pixel cs e Source #

Extracts the imaginary part of a complex pixel.

### Polar form

mkPolar :: (ColorSpace cs e, RealFloat e) => Pixel cs e -> Pixel cs e -> Pixel cs (Complex e) Source #

Form a complex pixel from polar components of magnitude and phase.

polar :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> (Pixel cs e, Pixel cs e) Source #

magnitude :: (ColorSpace cs e, RealFloat e) => Pixel cs (Complex e) -> Pixel cs e Source #

The nonnegative magnitude of a complex pixel.