reanimate-0.5.0.1: Animation library based on SVGs.

CopyrightWritten by David Himmelstrup
LicenseUnlicense
Maintainerlemmih@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Reanimate.Builtin.TernaryPlot

Description

Implementation of ternary plots: https://en.wikipedia.org/wiki/Ternary_plot

Synopsis

Documentation

type ACoord = Double Source #

Left-most coordinate.

type BCoord = Double Source #

Top-most coordinate.

type CCoord = Double Source #

Right-most coordinate.

ternaryPlot Source #

Arguments

:: Int

Pixels in the X-axis. More pixels => higher quality.

-> (ACoord -> BCoord -> CCoord -> PixelRGBA8)

a+b+c=1. A=1 is the left-most position, B=1 is the top-most position, and C=1 is the right-most position.

-> Tree 

Creates a centered ternary plot with a width of 5.

Example:

ternaryPlot 100 $ \aCoord bCoord cCoord -> promotePixel $
  let red   = round $ aCoord*255
      green = round $ bCoord*255
      blue  = round $ cCoord*255
  in PixelRGB8 red green blue

toCartesianCoords :: ACoord -> BCoord -> (Double, Double) Source #

Compute the XY coordinates from ternary coordinates. Note that CCoord is given because a+b+c=1.

toOffsetCartesianCoords :: ACoord -> BCoord -> (Double, Double) Source #

Compute the XY coordinates relative from the center of the ternary plot. Note that CCoord is given because a+b+c=1.

fromCartesianCoords :: Double -> Double -> (ACoord, BCoord, CCoord) Source #

Compute ternary coordinates from XY coordinates.