module Transform:Apply linear transformations to objects in Mlpost`sig`

..`end`

Transformations are an important way to modify objects in Mlpost. Objects can be scaled, shifted, rotated, etc, and any combination of these transformations is possible. Currently, transformations can be applied to Pictures, Pens and Paths.

`type `

t'

The abstract type of a single transformation

`val scaled : ``Num.t -> t'`

Scale an object by a constant factor.

`val rotated : ``float -> t'`

Rotate an object by an angle given in degrees

`val shifted : ``Point.t -> t'`

Shift an object with respect to a point

`val slanted : ``Num.t -> t'`

Slant an object: the point

`(x,y)`

becomes `(x+ay,y)`

, with slanting
factor `a`

`val xscaled : ``Num.t -> t'`

Scale an object by a constant factor, but only in the

`x`

direction`val yscaled : ``Num.t -> t'`

Scale an object by a constant factor, but only in the

`y`

direction`val zscaled : ``Point.t -> t'`

Zscaled multiplies points of the object by the given point, using
"complex" multiplication:

`(x,y) * (a,b) = (ax - by, bx + ay)`

;
its effect is to rotate and scale so as to map `(1,0)`

into `(a,b)`

`val reflect : ``Point.t -> Point.t -> t'`

Reflect an object with respect to the line that goes through the two
given points

`val rotate_around : ``Point.t -> float -> t'`

Rotate an object by an angle given in degrees, around a given point

`type `

matrix = {

` ` |
`xx : ` |

` ` |
`yx : ` |

` ` |
`xy : ` |

` ` |
`yy : ` |

` ` |
`x0 : ` |

` ` |
`y0 : ` |

`val explicit : ``matrix -> t'`

type`t =`

`t' list`

A transformation is a list of single transformations

`val id : ``t`

The identity transformation