diagrams-lib-1.3.0.8: Embedded domain-specific language for declarative graphics

Safe Haskell | None
Language | Haskell2010

Diagrams.Deform

Synopsis

- newtype Deformation v u n = Deformation (Point v n -> Point u n)
- class Deformable a b where
  - deform' :: N a -> Deformation (V a) (V b) (N a) -> a -> b
  - deform :: Deformation (V a) (V b) (N a) -> a -> b
- asDeformation :: (Additive v, Num n) => Transformation v n -> Deformation v v n

# Documentation

newtype Deformation v u n Source

`Deformations` are a superset of the affine transformations represented by the `Transformation` type. In general they are not invertible. `Deformation`s include projective transformations. `Deformation` can represent other functions from points to points which are "well-behaved", in that they do not introduce small wiggles.

Constructors

Deformation (Point v n -> Point u n) |

Instances

Semigroup (Deformation v v n) Source |
Monoid (Deformation v v n) Source |

class Deformable a b where Source

Methods

deform' :: N a -> Deformation (V a) (V b) (N a) -> a -> b Source

`deform' epsilon d a` transforms `a` by the deformation `d`. If the type of `a` is not closed under projection, approximate to accuracy `epsilon`.

deform :: Deformation (V a) (V b) (N a) -> a -> b Source

`deform d a` transforms `a` by the deformation `d`. If the type of `a` is not closed under projection, `deform` should call `deform'` with some reasonable default value of `epsilon`.

Instances

(Metric v, Metric u, OrderedField n, (~) * r (Located (Trail u n))) => Deformable (Located (Trail v n)) r Source |
(~) * r (Point u n) => Deformable (Point v n) r Source |
(Metric v, Metric u, OrderedField n, (~) * r (Path u n)) => Deformable (Path v n) r Source |

asDeformation :: (Additive v, Num n) => Transformation v n -> Deformation v v n Source

`asDeformation` converts a `Transformation` to a `Deformation` by discarding the inverse transform. This allows reusing `Transformation`s in the construction of `Deformation`s.