package ocaml-canvas

  1. Overview
  2. Docs

Transform manipulation functions

type t = {
  1. a : float;
    (*

    x scaling/flipping, rotation

    *)
  2. b : float;
    (*

    x shearing, rotation

    *)
  3. c : float;
    (*

    y shearing, rotation

    *)
  4. d : float;
    (*

    y scaling/flipping, rotation

    *)
  5. e : float;
    (*

    x translation

    *)
  6. f : float;
    (*

    y translation

    *)
}

A type to represent transformation matrices of the form:

a b 0
c d 0
e f 1 
val id : t

Identity transformation

val create : (float * float * float * float * float * float) -> t

create t creates a transformation given the matrix t = (a, b, c, d, e, f)

val mul : t -> t -> t

mul t1 t2 multiplies t1 by t2

val translate : t -> Vector.t -> t

translate t v composes t by a translation of vector v

val scale : t -> Vector.t -> t

scale t v composes t by a scaling of vector v

val shear : t -> Vector.t -> t

shear t v composes t by a shearing of vector v

val rotate : t -> float -> t

rotate t a composes t by a rotation of angle a around the origin

val inverse : t -> t

inverse t returns the inverse of t

Exceptions:

OCaml

Innovation. Community. Security.