package mlpost

  1. Overview
  2. Docs

Apply linear transformations to objects in Mlpost

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.

  • parameter scale

    a scaling function to be applied to each float; see Num.t for scaling functions for usual units. This makes only sense when the object to be transformed is given in "bp" units

val rotated : float -> t'

Scale an object by a constant factor.

  • parameter scale

    a scaling function to be applied to each float; see Num.t for scaling functions for usual units. This makes only sense when the object to be transformed is given in "bp" units

Rotate an object by an angle given in degrees

val shifted : Point.t -> t'

Rotate an object by an angle given in degrees

Shift an object with respect to a point

val slanted : Num.t -> t'

Shift an object with respect to a point

Slant an object: the point (x,y) becomes (x+ay,y), with slanting factor a

val xscaled : Num.t -> t'

Slant an object: the point (x,y) becomes (x+ay,y), with slanting factor a

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 x direction

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

val zscaled : Point.t -> t'

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

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'

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)

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

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

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

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

type matrix = Ctypes.matrix
val explicit : matrix -> t'
type t = t' list

A transformation is a list of single transformations

val id : t

The identity transformation