Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
A module for basic 2x2 (+2) matrix operations.
type t = {
mutable m0 : float;
cos a, scalex
*)mutable m1 : float;
sin a, shearx
*)mutable m2 : float;
-sin a, sheary
*)mutable m3 : float;
cos a, scaley
*)mutable m4 : float;
translatex
*)mutable m5 : float;
translatey
*)}
A 2x2 transform matrix with 2 more values for translation.
m0 m1
m2 m3
m4 m5
val create : unit -> t
val zero : t -> unit
val translate : t -> x:float -> y:float -> unit
val get_average_scale : t -> float
The formula is:
sx = sqrt(m0*m0 + m2*m2)
sy = sqrt(m1*m1 + m3*m3)
(sx + sy) * 0.5
val transform_point : t -> float -> float -> float * float
val scale : t -> xs:float -> ys:float -> unit
val rotate : t -> angle:float -> unit
val identity : t -> unit
val skew_x : t -> angle:float -> unit
val skew_y : t -> angle:float -> unit
val to_3x4 : t -> float array
Returns an array:
m0 m1 0 0
m2 m3 0 0
m4 m5 1 0
val is_flipped : t -> bool
m0*m3 - m2*m1 < 0
val print : t -> unit