package scad_ml

  1. Overview
  2. Docs

A rotation matrix.

Used in conjunction with Quaternion to provide an additional means of rotating OpenSCAD objects and vectors (Vec3.t).

type t = private float array array
val of_row_list_exn : (float * float * float) list -> t

of_row_list_exn l

Create a rotation matrix from a list l of three rows. Throws an exception if l is not the correct length.

val of_row_list : (float * float * float) list -> (t, string) result
val of_col_list_exn : (float * float * float) list -> t

of_col_list_exn l

Create a rotation matrix from a list l of three columns. Throws an exception if l is not the correct length.

val of_col_list : (float * float * float) list -> (t, string) result
val align_exn : Vec3.t -> Vec3.t -> t

align_exn a b

Calculate a rotation matrix that would bring a into alignment with b. Throws an exception if the vectors are equal or zero.

val align : Vec3.t -> Vec3.t -> (t, string) result
val to_euler : t -> Vec3.t

to_euler t

Convert t to an equivalent (x, y, z) euler rotation vector.

val trace : t -> float

trace t

Sum the elements on the main diagonal (upper left to lower right) of t.

val get : t -> int -> int -> float

get t r c

Get the element at row and column of t. Equivalent to t.(r).(c).

val mul : t -> t -> t
val add : t -> t -> t
val sub : t -> t -> t
val transpose : t -> t
val map : (float -> float) -> t -> t
val mul_scalar : t -> float -> t
val div_scalar : t -> float -> t
val add_scalar : t -> float -> t
val sub_scalar : t -> float -> t
OCaml

Innovation. Community. Security.