module M4:sig
..end
typet =
Gg.m4
val dim : int
dim
is the dimension of rows and columns.typev =
Gg.v4
val v : float ->
float ->
float ->
float ->
float ->
float ->
float ->
float ->
float -> float -> float -> float -> float -> float -> float -> float -> Gg.m4
v e00 e01 e02 e03 e10 e11 e12 e13 e20 e21 e22 e23 e30 e31 e32 e33
is a matrix whose components are specified in
row-major orderval of_rows : Gg.v4 -> Gg.v4 -> Gg.v4 -> Gg.v4 -> Gg.m4
of_rows r0 r1 r2 r3
is the matrix whose rows are r0
, r1
, r2
and
r3
.val of_cols : Gg.v4 -> Gg.v4 -> Gg.v4 -> Gg.v4 -> Gg.m4
of_cols c0 c1 c2 c3
is the matrix whose columns are c0
, c1
, c2
and c3
.val el : int -> int -> Gg.m4 -> float
el i j a
is the element a
ij
. See also the direct
element accessors.Invalid_argument
if i
or j
is not in [0;
Gg.M4.dim
[.val row : int -> Gg.m4 -> v
val col : int -> Gg.m4 -> v
val zero : Gg.m4
val id : Gg.m4
val of_m3_v3 : Gg.m3 -> Gg.v3 -> Gg.m4
of_m3_v3 m v
is the matrix whose first three rows are
those of m
,v
side by side and the fourth is 0 0 0 1
.val of_quat : Gg.quat -> Gg.m4
to_quat q
is the rotation of the unit quaternion q
as
4D matrix.val neg : Gg.m4 -> Gg.m4
neg a
is the negated matrix -a
.val add : Gg.m4 -> Gg.m4 -> Gg.m4
add a b
is the matrix addition a + b
.val sub : Gg.m4 -> Gg.m4 -> Gg.m4
sub a b
is the matrix subtraction a - b
.val mul : Gg.m4 -> Gg.m4 -> Gg.m4
val emul : Gg.m4 -> Gg.m4 -> Gg.m4
emul a b
is the element wise multiplication of a
and b
.val ediv : Gg.m4 -> Gg.m4 -> Gg.m4
ediv a b
is the element wise division of a
and b
.val smul : float -> Gg.m4 -> Gg.m4
smul s a
is a
's elements multiplied by the scalar s
.val transpose : Gg.m4 -> Gg.m4
val trace : Gg.m4 -> float
val det : Gg.m4 -> float
val inv : Gg.m4 -> Gg.m4
val move : Gg.v3 -> Gg.m4
move d
translates 3D space in the x, y and z dimensions according
to d
.val rot_map : Gg.v3 -> Gg.v3 -> Gg.m4
Gg.M3.rot_map
.val rot_axis : Gg.v3 -> float -> Gg.m4
Gg.M3.rot_axis
.val rot_zyx : Gg.v3 -> Gg.m4
Gg.M3.rot_zyx
.val scale3 : Gg.v3 -> Gg.m4
Gg.M3.scale
.val rigid : move:Gg.v3 -> rot:Gg.v3 * float -> Gg.m4
rigid move rot
is the rigid body transformation
of 3D space that rotates by the axis/angle rot
and then translates by move
.val rigidq : move:Gg.v3 -> rot:Gg.quat -> Gg.m4
rigid move rot
is the rigid body transformation of 3D space
that rotates by the quaternion rot
and then translates by
move
.val srigid : move:Gg.v3 -> rot:Gg.v3 * float -> scale:Gg.v3 -> Gg.m4
val srigidq : move:Gg.v3 -> rot:Gg.quat -> scale:Gg.v3 -> Gg.m4
Projection matrices assume a right-handed coordinate
system with the eye at the origin looking down the z-axis.
val ortho : left:float ->
right:float -> bottom:float -> top:float -> near:float -> far:float -> Gg.m4
ortho left right bottom top near far
maps the axis aligned box with
corners (left, bottom, -near)
and (right, top, -far)
to
the axis aligned cube with corner (-1, -1, -1)
and (1, 1, 1)
.val persp : left:float ->
right:float -> bottom:float -> top:float -> near:float -> far:float -> Gg.m4
persp left right bottom top near far
maps the frustum with top of
the underlying pyramid at the origin, near clip rectangle corners
(left, bottom, -near)
, (right, top, -near)
and far plane at
-far
to the axis aligned cube with corners (-1, -1, -1)
and
(1,1,1)
.val scale : Gg.v4 -> Gg.m4
scale s
scales 4D space in the x, y, z and w dimensions according
to s
.val map : (float -> float) -> Gg.m4 -> Gg.m4
map f a
is the element wise application of f
to a
.val mapi : (int -> int -> float -> float) -> Gg.m4 -> Gg.m4
val fold : ('a -> float -> 'a) -> 'a -> Gg.m4 -> 'a
fold f acc a
is f (
...(f (f acc a
00) a
10)
...)
.val foldi : ('a -> int -> int -> float -> 'a) -> 'a -> Gg.m4 -> 'a
foldi f acc a
is
f (
...(f (f acc 0 0 a
00) 1 0 a
10)
...)
.val iter : (float -> unit) -> Gg.m4 -> unit
iter f a
is f a
00; f a
10;
...val iteri : (int -> int -> float -> unit) -> Gg.m4 -> unit
iteri f a
is f 0 0 a
00; f 1 0 a
10;
...val for_all : (float -> bool) -> Gg.m4 -> bool
for_all p a
is p a
00 && p a
10 &&
...val exists : (float -> bool) -> Gg.m4 -> bool
exists p a
is p a
00 || p a
10 ||
...val equal : Gg.m4 -> Gg.m4 -> bool
equal a b
is a = b
.val equal_f : (float -> float -> bool) -> Gg.m4 -> Gg.m4 -> bool
val compare : Gg.m4 -> Gg.m4 -> int
compare a b
is Pervasives.compare a b
. That is
lexicographic comparison in column-major order.val compare_f : (float -> float -> int) -> Gg.m4 -> Gg.m4 -> int
compare_f cmp a b
compares a
and b
like Gg.M4.compare
but uses cmp
to compare floating point values.val to_string : Gg.m4 -> string
to_string a
is a textual representation of a
.val pp : Format.formatter -> Gg.m4 -> unit
pp ppf a
prints a textual representation of a
on ppf
.val pp_f : (Format.formatter -> float -> unit) -> Format.formatter -> Gg.m4 -> unit
val e00 : Gg.m4 -> float
val e01 : Gg.m4 -> float
val e02 : Gg.m4 -> float
val e03 : Gg.m4 -> float
val e10 : Gg.m4 -> float
val e11 : Gg.m4 -> float
val e12 : Gg.m4 -> float
val e13 : Gg.m4 -> float
val e20 : Gg.m4 -> float
val e21 : Gg.m4 -> float
val e22 : Gg.m4 -> float
val e23 : Gg.m4 -> float
val e30 : Gg.m4 -> float
val e31 : Gg.m4 -> float
val e32 : Gg.m4 -> float
val e33 : Gg.m4 -> float