module M3: sig .. end
type t = Gg.m3
The type for 3D square matrices.
val dim : int
dim is the dimension of rows and columns.
type v = Gg.v3
The type for rows and columns as vectors.
Constructors, accessors and constants
val v : float ->
float -> float -> float -> float -> float -> float -> float -> float -> Gg.m3
v e00 e01 e02 e10 e11 e12 e20 e21 e22 is a matrix whose components
are specified in
row-major order
val of_rows : Gg.v3 -> Gg.v3 -> Gg.v3 -> Gg.m3
of_rows r0 r1 r2 is the matrix whose rows are r0, r1 and r2.
val of_cols : Gg.v3 -> Gg.v3 -> Gg.v3 -> Gg.m3
of_cols c0 c1 c2 is the matrix whose columns are c0, c1 and c2.
val el : int -> int -> Gg.m3 -> float
val row : int -> Gg.m3 -> Gg.v3
row i a is the
ith row of
a.
Raises Invalid_argument if
i is not in [
0;Gg.M3.dim[.
val col : int -> Gg.m3 -> Gg.v3
col j a is the
jth column of
a.
Raises Invalid_argument if
j is not in [
0;Gg.M3.dim[.
val zero : Gg.m3
val id : Gg.m3
id is the identity matrix, the neutral element for
Gg.M3.mul.
val of_m2_v2 : Gg.m2 -> Gg.v2 -> Gg.m3
of_m2_v2 m v is the matrix whose first two rows are
those of m,v side by side and the third is 0 0 1.
val of_m4 : Gg.m4 -> Gg.m3
of_m4 m extracts the 3D linear part (top-left 3x3 matrix) of m.
val of_quat : Gg.quat -> Gg.m3
of_quat q is the rotation of the unit quaternion q as
3D matrix.
Functions
val neg : Gg.m3 -> Gg.m3
neg a is the negated matrix -a.
val add : Gg.m3 -> Gg.m3 -> Gg.m3
add a b is the matrix addition a + b.
val sub : Gg.m3 -> Gg.m3 -> Gg.m3
sub a b is the matrix subtraction a - b.
val mul : Gg.m3 -> Gg.m3 -> Gg.m3
val emul : Gg.m3 -> Gg.m3 -> Gg.m3
emul a b is the element wise multiplication of a and b.
val ediv : Gg.m3 -> Gg.m3 -> Gg.m3
ediv a b is the element wise division of a and b.
val smul : float -> Gg.m3 -> Gg.m3
smul s a is a's elements multiplied by the scalar s.
val transpose : Gg.m3 -> Gg.m3
val trace : Gg.m3 -> float
val det : Gg.m3 -> float
val inv : Gg.m3 -> Gg.m3
val move : Gg.v2 -> Gg.m3
move d translates 2D space in the x and y dimensions according
to d.
val rot : float -> Gg.m3
val scale2 : Gg.v2 -> Gg.m3
val rigid : move:Gg.v2 -> rot:float -> Gg.m3
rigid move theta is the rigid body transformation of
2D space that rotates by theta and then translates by move.
val srigid : move:Gg.v2 -> rot:float -> scale:Gg.v2 -> Gg.m3
srigid move theta scale is like
Gg.M3.rigid but starts by
scaling according to
scale.
val rot_map : Gg.v3 -> Gg.v3 -> Gg.m3
rot_map u v rotates 3D space to map the unit vector u on
the unit vector v.
val rot_axis : Gg.v3 -> float -> Gg.m3
rot_axis v theta rotates 3D space by theta around
the unit vector v.
val rot_zyx : Gg.v3 -> Gg.m3
rot_zyx r rotates 3D space first by V3.x r around the
x-axis, then by V3.y r around the y-axis and finally by V3.z
r around the z-axis.
val scale : Gg.v3 -> Gg.m3
scale s scales 3D space in the x, y and z dimensions
according to s.
Traversal
val map : (float -> float) -> Gg.m3 -> Gg.m3
map f a is the element wise application of f to a.
val mapi : (int -> int -> float -> float) -> Gg.m3 -> Gg.m3
mapi f a is like
Gg.M3.map but the element indices are also given.
val fold : ('a -> float -> 'a) -> 'a -> Gg.m3 -> 'a
fold f acc a is f (...(f (f acc a00) a10)...).
val foldi : ('a -> int -> int -> float -> 'a) -> 'a -> Gg.m3 -> 'a
foldi f acc a is
f (...(f (f acc 0 0 a00) 1 0 a10)...).
val iter : (float -> unit) -> Gg.m3 -> unit
iter f a is f a00; f a10; ...
val iteri : (int -> int -> float -> unit) -> Gg.m3 -> unit
iteri f a is f 0 0 a00; f 1 0 a10; ...
Predicates and comparisons
val for_all : (float -> bool) -> Gg.m3 -> bool
for_all p a is p a00 && p a10 && ...
val exists : (float -> bool) -> Gg.m3 -> bool
exists p a is p a00 || p a10 || ...
val equal : Gg.m3 -> Gg.m3 -> bool
equal a b is a = b.
val equal_f : (float -> float -> bool) -> Gg.m3 -> Gg.m3 -> bool
equal_f eq a b tests
a and
b like
Gg.M3.equal but
uses
eq to test floating point values.
val compare : Gg.m3 -> Gg.m3 -> int
compare a b is Pervasives.compare a b. That is
lexicographic comparison in column-major order.
val compare_f : (float -> float -> int) -> Gg.m3 -> Gg.m3 -> int
compare_f cmp a b compares
a and
b like
Gg.M3.compare
but uses
cmp to compare floating point values.
Printers
val to_string : Gg.m3 -> string
to_string a is a textual representation of a.
val pp : Format.formatter -> Gg.m3 -> unit
pp ppf a prints a textual representation of a on ppf.
val pp_f : (Format.formatter -> float -> unit) -> Format.formatter -> Gg.m3 -> unit
pp_f pp_e ppf a prints
a like
Gg.M3.pp but uses
pp_e to print floating point values.
Element accessors
val e00 : Gg.m3 -> float
val e01 : Gg.m3 -> float
val e02 : Gg.m3 -> float
val e10 : Gg.m3 -> float
val e11 : Gg.m3 -> float
val e12 : Gg.m3 -> float
val e20 : Gg.m3 -> float
val e21 : Gg.m3 -> float
val e22 : Gg.m3 -> float