Module Gg.M3
type t= m3The type for 3D square matrices.
type v= v3The type for rows and columns as vectors.
Constructors, accessors and constants
val v : float -> float -> float -> float -> float -> float -> float -> float -> float -> m3v e00 e01 e02 e10 e11 e12 e20 e21 e22is a matrix whose components are specified in row-major order
val el : int -> int -> m3 -> floatel i j ais the elementaij. See also the direct element accessors.- raises Invalid_argument
if
iorjis not in [0;dim[.
val col : int -> m3 -> v3col j ais thejth column ofa.- raises Invalid_argument
if
jis not in [0;dim[.
Functions
val mul : m3 -> m3 -> m3mul a bis the matrix multiplicationa * b.
val trace : m3 -> floattrace ais the matrix tracetrace(a).
val det : m3 -> floatdet ais the determinant|a|.
val inv : m3 -> m3inv ais the inverse matrixa-1.
2D space transformations
val rot2 : ?pt:p2 -> float -> m3rot2 pt thetarotates 2D space around the pointptbythetaradians.ptdefaults toP2.o.
3D space transformations
val rot3_map : v3 -> v3 -> m3rot3_map u vrotates 3D space to map the unit vectoruon the unit vectorv.
val rot3_axis : v3 -> float -> m3rot_axis v thetarotates 3D space bythetaradians around the unit vectorv.
Traversal
val mapi : (int -> int -> float -> float) -> m3 -> m3mapi f ais likemapbut the element indices are also given.
val fold : ('a -> float -> 'a) -> 'a -> m3 -> 'afold f acc aisf (...(f (f acc a00) a10)...).
val foldi : ('a -> int -> int -> float -> 'a) -> 'a -> m3 -> 'afoldi f acc aisf (...(f (f acc 0 0 a00) 1 0 a10)...).
val iter : (float -> unit) -> m3 -> unititer f aisf a00; f a10;...
val iteri : (int -> int -> float -> unit) -> m3 -> unititeri f aisf 0 0 a00; f 1 0 a10;...
Predicates and comparisons
val for_all : (float -> bool) -> m3 -> boolfor_all p aisp a00&& p a10&&...
val exists : (float -> bool) -> m3 -> boolexists p aisp a00|| p a10||...
val equal_f : (float -> float -> bool) -> m3 -> m3 -> boolequal_f eq a btestsaandblikeequalbut useseqto test floating point values.
Printers
val pp : Stdlib.Format.formatter -> m3 -> unitpp ppf aprints a textual representation ofaonppf.
val pp_f : (Stdlib.Format.formatter -> float -> unit) -> Stdlib.Format.formatter -> m3 -> unitpp_f pp_e ppf aprintsalikeppbut usespp_eto print floating point values.