(** Immutable 2d transform module. @author Victor Nicollet *) (** Transform type. Transforms are represented as complex plane transforms f(z) = za + b. Therefore, a represents the the rotation/scaling and b represents the translation. *) type transform = { ar : float; ai : float; br : float; bi : float; } (** Identity transform. *) val identity : transform (** Rotate a transform by a certain angle. *) val rotate : transform -> float -> transform (** Scale a transform by a certain angle. *) val scale : transform -> float -> transform (** Translate a transform by a vector. *) val translate : transform -> Vector.vector -> transform (** A description of a transform in less compressed terms. *) type transform_description = { angle : float; scale : float; position : Vector.vector } (** Construct a transform from a description *) val make : transform_description -> transform (** Describe a transform in simpler terms *) val describe : transform -> transform_description (** Transform a vector by a transform. *) val apply : transform -> Vector.vector -> Vector.vector (** Compose a transform by applying it after another. That is, [apply a (apply b v)] is equivalent to [apply (compose a b) v] *) val compose : transform -> transform -> transform