Skip to content

Instantly share code, notes, and snippets.

@dbuenzli
Created August 24, 2014 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbuenzli/d7ab0d74ff29a95167fe to your computer and use it in GitHub Desktop.
Save dbuenzli/d7ab0d74ff29a95167fe to your computer and use it in GitHub Desktop.
merlin hang
{"time":0.0,"level":"info","section":"general","title":"monitor start","content":["general","info"]}
{"time":0.0,"level":"info","section":"general","title":"available logging sections","content":["general","command","parser","locate","recover","protocol"]}
{"time":0.0,"level":"info","section":"general","title":"monitor start","content":["protocol","info"]}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.005412,"delta":0.0011029999999999998,"body":["project","find","/Users/dbuenzli/gg/src/gg.ml"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.0054789999999999995,"delta":6.699999999999935e-05,"body":["return",{"result":[]}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.005525,"delta":4.60000000000009e-05,"body":["reset","ml","/Users/dbuenzli/gg/src/gg.ml"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.005885,"delta":0.0003599999999999992,"body":["return",{"cursor":{"line":1,"col":0},"marker":false}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.005946,"delta":6.100000000000029e-05,"body":["tell","start","at",{"line":1,"col":0}]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.005988,"delta":4.200000000000037e-05,"body":["return",{"cursor":{"line":1,"col":0},"marker":false}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.006033,"delta":4.49999999999999e-05,"body":["tell","source",""]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.006085,"delta":5.199999999999996e-05,"body":["return",{"cursor":{"line":1,"col":0},"marker":false}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.006141,"delta":5.5999999999999626e-05,"body":["tell","marker"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.0061790000000000005,"delta":3.800000000000071e-05,"body":["return",{"cursor":{"line":1,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.006288,"delta":0.00010899999999999972,"body":["tell","source","(*---------------------------------------------------------------------------\n Copyright (c) 2013 Daniel C. Bünzli. All rights reserved.\n Distributed under a BSD license, see license at the end of the file.\n %%PROJECTNAME%% release %%VERSION%%\n ---------------------------------------------------------------------------*)\n\nlet str = Format.asprintf\nlet pp = Format.fprintf\nlet err_unsupported_by = str \"unsupported bigarray kind\"\nlet err_not_nan = \"not a NaN\"\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.006425,"delta":0.00013699999999999997,"body":["return",{"cursor":{"line":11,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.006539,"delta":0.00011399999999999952,"body":["tell","source","let err_empty_box = \"empty box\"\nlet err_packed_sf = \"packed sample format\"\nlet err_illegal_fourcc c = str \"illegal FourCC code (%S)\" c\nlet err_rresnone = \"raster's res is None\"\nlet err_rindex a v = str \"index %s is %f but should be >= 1.\" a v\nlet err_rfirst v = str \"first is %d but non-negative int expected\" v\nlet err_rstride a v min = str \"%s_stride is %d but should be >= %d\" a v min\nlet err_rrange k a v min max =\n str \"%s %s is %d but exepected in [%d;%d] range\" k a v min max\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.006724,"delta":0.00018500000000000027,"body":["return",{"cursor":{"line":21,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.006821000000000001,"delta":9.700000000000073e-05,"body":["tell","source","let err_sample_pack p st =\n str \"sample pack %s incompatible with scalar type %s\" p st\n\nlet err_pp_ba_spec ~first ~stride ~count ~len =\n str \"invalid bounds: first:%d + stride:%d * count:%d >= len:%d\"\n first stride count len\n\nlet err_buffer_data data k =\n str \"data argument %s is irrelevant for bigarray kind %s\" data k\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.006997,"delta":0.00017599999999999907,"body":["return",{"cursor":{"line":31,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.007117,"delta":0.00012000000000000031,"body":["tell","source","let err_buffer_kind =\n str \"bigarray kind can't be represented by a Gg.Ba.scalar_type\"\n\nlet pp_pad ppf len = for i = 1 to len do Format.pp_print_space ppf () done\nlet pp_buf buf ppf fmt =\n let flush ppf =\n Format.pp_print_flush ppf ();\n let s = Buffer.contents buf in\n Buffer.clear buf;\n s, String.length s\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.007256,"delta":0.00013900000000000023,"body":["return",{"cursor":{"line":41,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.007352,"delta":9.599999999999973e-05,"body":["tell","source"," in\n Format.kfprintf flush ppf fmt\n\nlet gg_eps = 1e-9\n\n(* Floating point utilities. *)\n\nmodule Float = struct\n type t = float\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.007431999999999999,"delta":7.999999999999934e-05,"body":["return",{"cursor":{"line":51,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.007566999999999999,"delta":0.0001349999999999997,"body":["tell","source"," (* See the .mli for a quick recall on OCaml's float representation. *)\n\n let bfloat_sign = 0x80_00_00_00_00_00_00_00L (* sign bit mask. *)\n let bfloat_exp = 0x7F_F0_00_00_00_00_00_00L (* biased exponent mask. *)\n let bfloat_frac = 0x00_0F_FF_FF_FF_FF_FF_FFL (* significand mask. *)\n let bfloat_nanp = 0x00_07_FF_FF_FF_FF_FF_FFL (* nan payload mask. *)\n let bfloat_qnan = 0x7F_F8_00_00_00_00_00_00L (* a quiet nan, payload 0. *)\n\n (* Constants *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.00766,"delta":9.300000000000107e-05,"body":["return",{"cursor":{"line":61,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.007796000000000001,"delta":0.0001360000000000007,"body":["tell","source"," let e = 2.7182818284590452353602874713526625 (* values from math.h. *)\n let pi = 3.1415926535897932384626433832795029\n let two_pi = 2. *. pi\n let pi_div_2 = 1.5707963267948966192313216916397514\n let pi_div_4 = 0.7853981633974483096156608458198757\n let inv_pi = 0.3183098861837906715377675267450287\n\n let max_sub_float = Int64.float_of_bits 0x00_0F_FF_FF_FF_FF_FF_FFL\n let min_sub_float = Int64.float_of_bits 0x00_00_00_00_00_00_00_01L\n let max_frac_float = 4503599627370495.5 (* Float.pred 2^52. *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.007913,"delta":0.00011699999999999905,"body":["return",{"cursor":{"line":71,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.008018000000000001,"delta":0.00010500000000000093,"body":["tell","source"," let max_int_arith = 9007199254740992. (* 2^53. *)\n\n (* Functions *)\n\n let r2d = 180. /. pi\n let d2r = pi /. 180.\n let deg_of_rad r = r *. r2d\n let rad_of_deg d = d *. d2r\n\n let pi2 = 2. *. pi\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.008114,"delta":9.599999999999886e-05,"body":["return",{"cursor":{"line":81,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.008229,"delta":0.00011500000000000052,"body":["tell","source"," let wrap_angle r =\n let r = mod_float (r +. pi) pi2 in\n if r < 0. then r +. pi else r -. pi\n\n let random ?(min = 0.) ~len () =\n let t0 = float (Random.bits ()) /. 1073741823. in (* ≠ from Random.float *)\n let t1 = (float (Random.bits ()) +. t0) /. 1073741824. in\n let t2 = (float (Random.bits ()) +. t1) /. 1073741824. in\n min +. (t2 *. len)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.008428,"delta":0.00019899999999999952,"body":["return",{"cursor":{"line":91,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.00856,"delta":0.00013200000000000017,"body":["tell","source"," let srandom s ?(min = 0.) ~len () =\n let t0 = float (Random.State.bits s) /. 1073741823. in (* see above. *)\n let t1 = (float (Random.State.bits s) +. t0) /. 1073741824. in\n let t2 = (float (Random.State.bits s) +. t1) /. 1073741824. in\n min +. (t2 *. len)\n\n let mix x y t = x +. t *. (y -. x)\n let step : float -> float -> float = fun edge x -> if x < edge then 0. else 1.\n let smooth_step e0 e1 x =\n if x <= e0 then 0. else\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.00958,"delta":0.00102,"body":["return",{"cursor":{"line":101,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.009687999999999999,"delta":0.00010799999999999872,"body":["tell","source"," if x >= e1 then 1. else\n let t = (x -. e0) /. (e1 -. e0) in\n t *. t *. (3. -. 2. *. t)\n\n let fmax : float -> float -> float = fun x y ->\n if x <> x then (* x is NaN *) y else\n if x < y then y else (* x >= y or y = NaN *) x\n\n let fmin : float -> float -> float = fun x y ->\n if x <> x then (* x is NaN *) y else\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.009856,"delta":0.00016800000000000148,"body":["return",{"cursor":{"line":111,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.009985000000000001,"delta":0.00012900000000000064,"body":["tell","source"," if y < x then y else (* x <= y or y = NaN *) x\n\n let clamp : min:float -> max:float -> float -> float = fun ~min ~max x ->\n if x < min then min else\n if x > max then max else x\n\n let remap ~x0 ~x1 ~y0 ~y1 v =\n if x0 = x1 then y0 else\n y0 +. ((v -. x0) /. (x1 -. x0)) *. (y1 -. y0)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.010110000000000001,"delta":0.0001250000000000001,"body":["return",{"cursor":{"line":121,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.010249999999999999,"delta":0.00013999999999999777,"body":["tell","source"," let round x = floor (x +. 0.5)\n let int_of_round x = truncate (round x)\n let round_dfrac d x =\n if x -. (round x) = 0. then x else (* x is an integer. *)\n let m = 10. ** (float d) in (* m moves 10^-d to 1. *)\n (floor ((x *. m) +. 0.5)) /. m\n\n let round_dsig d x =\n if x = 0. then 0. else\n let m = 10. ** (floor (log10 (abs_float x))) in (* to normalize x. *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.010371,"delta":0.00012100000000000131,"body":["return",{"cursor":{"line":131,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.010498,"delta":0.00012700000000000038,"body":["tell","source"," (round_dfrac d (x /. m)) *. m\n\n let round_zero ~eps x = if abs_float x < eps then 0. else x\n let chop ~eps x =\n if abs_float x > max_frac_float then x else\n let xi = floor (x +. 0.5) in\n if (abs_float (x -. xi)) < eps then xi else x\n\n let sign x = if x > 0. then 1. else (if x < 0. then -1. else x)\n let sign_bit x = (Int64.logand (Int64.bits_of_float x) bfloat_sign) <> 0L\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.010612,"delta":0.00011399999999999952,"body":["return",{"cursor":{"line":141,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.010748,"delta":0.0001360000000000007,"body":["tell","source"," let succ x = match classify_float x with\n | FP_normal | FP_subnormal ->\n if x > 0. then Int64.float_of_bits (Int64.add (Int64.bits_of_float x) 1L)\n else Int64.float_of_bits (Int64.sub (Int64.bits_of_float x) 1L)\n | FP_zero -> min_sub_float\n | FP_infinite -> if x = neg_infinity then -. max_float else infinity\n | FP_nan -> x\n\n let pred x = match classify_float x with\n | FP_normal | FP_subnormal ->\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.010851,"delta":0.00010299999999999893,"body":["return",{"cursor":{"line":151,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.010971999999999999,"delta":0.00012099999999999958,"body":["tell","source"," if x > 0. then Int64.float_of_bits (Int64.sub (Int64.bits_of_float x) 1L)\n else Int64.float_of_bits (Int64.add (Int64.bits_of_float x) 1L)\n | FP_zero -> -. min_sub_float\n | FP_infinite -> if x = infinity then max_float else neg_infinity\n | FP_nan -> x\n\n let nan p =\n let p = (Int64.logand (Int64.of_int p) bfloat_nanp) in\n Int64.float_of_bits (Int64.logor bfloat_qnan p)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.011065,"delta":9.300000000000107e-05,"body":["return",{"cursor":{"line":161,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.011168999999999998,"delta":0.00010399999999999819,"body":["tell","source"," let nan_payload x =\n if x = x then invalid_arg err_not_nan else\n Int64.to_int (Int64.logand (Int64.bits_of_float x) bfloat_nanp)\n\n (* Predicates and comparisons *)\n\n let is_zero ~eps x = abs_float x < eps\n let is_nan x = x <> x\n let is_inf x = classify_float x = FP_infinite\n let is_int x = x -. (floor x) = 0.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.011261,"delta":9.20000000000018e-05,"body":["return",{"cursor":{"line":171,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.011379,"delta":0.00011800000000000005,"body":["tell","source"," let equal x y = x = y\n let equal_tol ~eps x y = (* NOTE code duplicate with compare_tol. *)\n if compare x y = 0 then true else\n let ax = abs_float x in\n let ay = abs_float y in\n let amax = if ax > ay then ax else ay in\n let max = if 1. > amax then 1. else amax in\n if max = infinity then false else\n abs_float (x -. y) <= eps *. max\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.011471,"delta":9.200000000000007e-05,"body":["return",{"cursor":{"line":181,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.011591,"delta":0.00012000000000000031,"body":["tell","source"," let compare = Pervasives.compare\n let compare_tol ~eps x y = (* NOTE code duplicate with equal_tol. *)\n let c = compare x y in\n if c = 0 then 0 else\n let ax = abs_float x in\n let ay = abs_float y in\n let amax = if ax > ay then ax else ay in\n let max = if 1. > amax then 1. else amax in\n if max = infinity then c else\n if abs_float (x -. y) <= eps *. max then 0 else c\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.011689999999999999,"delta":9.899999999999839e-05,"body":["return",{"cursor":{"line":191,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.011807999999999999,"delta":0.00011800000000000005,"body":["tell","source","\n (* Printers *)\n\n let pp ppf x = (* too slow, ∃ better ? *)\n let pr_neg ppf neg = if neg then pp ppf \"-\" else () in\n match classify_float x with\n | FP_normal ->\n let x = Int64.bits_of_float x in\n let neg = Int64.logand x bfloat_sign <> 0L in\n let f = Int64.logand x bfloat_frac in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.011896,"delta":8.800000000000127e-05,"body":["return",{"cursor":{"line":201,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.01202,"delta":0.0001239999999999991,"body":["tell","source"," let e =\n Int64.sub (Int64.shift_right (Int64.logand x bfloat_exp) 52) 1023L\n in\n pp ppf \"%a0x1.%013LXp%Ld\" pr_neg neg f e\n | FP_subnormal ->\n let f = Int64.logand (Int64.bits_of_float x) bfloat_frac in\n let neg = x < 0. in\n pp ppf \"%a0x0.%013LXp-1022\" pr_neg neg f\n | FP_zero ->\n let neg = Int64.logand (Int64.bits_of_float x) bfloat_sign <> 0L in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.012113,"delta":9.300000000000107e-05,"body":["return",{"cursor":{"line":211,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.012223,"delta":0.00010999999999999899,"body":["tell","source"," pp ppf \"%a0.\" pr_neg neg\n | FP_infinite ->\n let neg = x < 0. in\n pp ppf \"%ainf\" pr_neg neg\n | FP_nan ->\n let x = Int64.bits_of_float x in\n let neg = Int64.logand x bfloat_sign <> 0L in\n let p = Int64.logand x bfloat_nanp in\n pp ppf \"%anan(0x%LX)\" pr_neg neg p\nend\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.014001,"delta":0.001778,"body":["return",{"cursor":{"line":221,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.014124000000000001,"delta":0.00012300000000000158,"body":["tell","source","\n(* Vector and matrix types are defined here so that they can be seen\n in every module. We use records of floats. This allows unboxed\n float storage and avoids the bound checks we'd get with arrays.\n\n The value [i] allows to (slowly) index the types like a linear array. *)\n\nmodule V2t = struct\n type t = { x : float; y : float }\n let i = [| (fun a -> a.x); (fun a -> a.y); |]\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.014255,"delta":0.00013099999999999917,"body":["return",{"cursor":{"line":231,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.014384000000000001,"delta":0.00012900000000000064,"body":["tell","source","end\n\nmodule V3t = struct\n type t = { x : float; y : float; z : float }\n let i = [| (fun a -> a.x); (fun a -> a.y); (fun a -> a.z) |]\nend\n\nmodule V4t = struct\n type t = { x : float; y : float; z : float; w : float }\n let i = [| (fun a -> a.x); (fun a -> a.y); (fun a -> a.z); (fun a -> a.w) |]\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.014529,"delta":0.0001449999999999993,"body":["return",{"cursor":{"line":241,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.014639,"delta":0.00010999999999999899,"body":["tell","source","end\n\nmodule M2t = struct\n type t = { e00 : float; e10 : float; (* col 0 *)\n e01 : float; e11 : float; (* col 1 *) }\n let i = [| (fun a -> a.e00); (fun a -> a.e10);\n (fun a -> a.e01); (fun a -> a.e11); |]\n\n open V2t\n let row = [| (fun a -> { x = a.e00; y = a.e01 });\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.014734999999999998,"delta":9.599999999999886e-05,"body":["return",{"cursor":{"line":251,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.014859999999999998,"delta":0.0001250000000000001,"body":["tell","source"," (fun a -> { x = a.e10; y = a.e11 }) |]\n let col = [| (fun a -> { x = a.e00; y = a.e10 });\n (fun a -> { x = a.e01; y = a.e11 }) |]\nend\n\nmodule M3t = struct\n type t = { e00 : float; e10 : float; e20 : float; (* col 0 *)\n e01 : float; e11 : float; e21 : float; (* col 1 *)\n e02 : float; e12 : float; e22 : float; (* col 2 *) }\n let i = [| (fun a -> a.e00); (fun a -> a.e10); (fun a -> a.e20);\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.014997,"delta":0.0001370000000000017,"body":["return",{"cursor":{"line":261,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.015127999999999999,"delta":0.00013099999999999917,"body":["tell","source"," (fun a -> a.e01); (fun a -> a.e11); (fun a -> a.e21);\n (fun a -> a.e02); (fun a -> a.e12); (fun a -> a.e22); |]\n\n open V3t\n let row = [| (fun a -> { x = a.e00; y = a.e01; z = a.e02});\n (fun a -> { x = a.e10; y = a.e11; z = a.e12});\n (fun a -> { x = a.e20; y = a.e21; z = a.e22}); |]\n let col = [| (fun a -> { x = a.e00; y = a.e10; z = a.e20});\n (fun a -> { x = a.e01; y = a.e11; z = a.e21});\n (fun a -> { x = a.e02; y = a.e12; z = a.e22}); |]\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.015293,"delta":0.00016500000000000022,"body":["return",{"cursor":{"line":271,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.015422,"delta":0.00012900000000000064,"body":["tell","source","end\n\nmodule M4t = struct\n type t = { e00 : float; e10 : float; e20 : float; e30 : float; (* col 0 *)\n e01 : float; e11 : float; e21 : float; e31 : float; (* col 1 *)\n e02 : float; e12 : float; e22 : float; e32 : float; (* col 2 *)\n e03 : float; e13 : float; e23 : float; e33 : float; (* col 3 *) }\n let i =\n [| (fun a -> a.e00); (fun a -> a.e10); (fun a -> a.e20); (fun a -> a.e30);\n (fun a -> a.e01); (fun a -> a.e11); (fun a -> a.e21); (fun a -> a.e31);\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.015559,"delta":0.00013699999999999997,"body":["return",{"cursor":{"line":281,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.015694,"delta":0.0001349999999999997,"body":["tell","source"," (fun a -> a.e02); (fun a -> a.e12); (fun a -> a.e22); (fun a -> a.e32);\n (fun a -> a.e03); (fun a -> a.e13); (fun a -> a.e23); (fun a -> a.e33);|]\n\n open V4t\n let row = [| (fun a -> { x = a.e00; y = a.e01; z = a.e02; w = a.e03});\n (fun a -> { x = a.e10; y = a.e11; z = a.e12; w = a.e13});\n (fun a -> { x = a.e20; y = a.e21; z = a.e22; w = a.e23});\n (fun a -> { x = a.e30; y = a.e31; z = a.e32; w = a.e33}); |]\n let col = [| (fun a -> { x = a.e00; y = a.e10; z = a.e20; w = a.e30});\n (fun a -> { x = a.e01; y = a.e11; z = a.e21; w = a.e31});\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.015883,"delta":0.00018900000000000167,"body":["return",{"cursor":{"line":291,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.015978,"delta":9.499999999999786e-05,"body":["tell","source"," (fun a -> { x = a.e02; y = a.e12; z = a.e22; w = a.e32});\n (fun a -> { x = a.e03; y = a.e13; z = a.e23; w = a.e33}); |]\nend\n\ntype m2 = M2t.t\ntype m3 = M3t.t\ntype m4 = M4t.t\n\n(* Vectors *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.017213,"delta":0.001235,"body":["return",{"cursor":{"line":301,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.017275,"delta":6.199999999999956e-05,"body":["tell","source","type v2 = V2t.t\ntype v3 = V3t.t\ntype v4 = V4t.t\n\nmodule type V = sig\n type t\n val dim : int\n type m\n\n (* Constructors, accessors and constants *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.017346,"delta":7.100000000000162e-05,"body":["return",{"cursor":{"line":311,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.017437,"delta":9.10000000000008e-05,"body":["tell","source","\n val comp : int -> t -> float\n val zero : t\n val infinity : t\n val neg_infinity : t\n val basis : int -> t\n\n (* Functions *)\n\n val neg : t -> t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.017498,"delta":6.0999999999998555e-05,"body":["return",{"cursor":{"line":321,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.017601,"delta":0.00010299999999999893,"body":["tell","source"," val add : t -> t -> t\n val sub : t -> t -> t\n val mul : t -> t -> t\n val div : t -> t -> t\n val smul : float -> t -> t\n val half : t -> t\n val dot : t -> t -> float\n val norm : t -> float\n val norm2 : t -> float\n val unit : t -> t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.017692,"delta":9.10000000000008e-05,"body":["return",{"cursor":{"line":331,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.017785000000000002,"delta":9.30000000000028e-05,"body":["tell","source"," val homogene : t -> t\n val mix : t -> t -> float -> t\n val ltr : m -> t -> t\n\n (* Overridden Pervasives operators. *)\n\n val ( + ) : t -> t -> t\n val ( - ) : t -> t -> t\n val ( * ) : float -> t -> t\n val ( / ) : t -> float -> t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.01787,"delta":8.499999999999827e-05,"body":["return",{"cursor":{"line":341,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.017973,"delta":0.00010299999999999893,"body":["tell","source","\n (* Traversal *)\n\n val map : (float -> float) -> t -> t\n val mapi : (int -> float -> float) -> t -> t\n val fold : ('a -> float -> 'a) -> 'a -> t -> 'a\n val foldi : ('a -> int -> float -> 'a) -> 'a -> t -> 'a\n val iter : (float -> unit) -> t -> unit\n val iteri : (int -> float -> unit) -> t -> unit\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.018067,"delta":9.400000000000033e-05,"body":["return",{"cursor":{"line":351,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.018174,"delta":0.00010699999999999946,"body":["tell","source"," (* Predicates and comparisons *)\n\n val for_all : (float -> bool) -> t -> bool\n val exists : (float -> bool) -> t -> bool\n val equal : t -> t -> bool\n val equal_f : (float -> float -> bool) -> t -> t -> bool\n val compare : t -> t -> int\n val compare_f : (float -> float -> int) -> t -> t -> int\n\n (* Printers *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.018265,"delta":9.10000000000008e-05,"body":["return",{"cursor":{"line":361,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.018353,"delta":8.800000000000127e-05,"body":["tell","source","\n val pp : Format.formatter -> t -> unit\n val pp_f : (Format.formatter -> float -> unit) -> Format.formatter ->\n t -> unit\nend\n\nmodule V2 = struct\n open V2t\n type t = v2\n type m = m2\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.01841,"delta":5.6999999999998024e-05,"body":["return",{"cursor":{"line":371,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.018501,"delta":9.10000000000008e-05,"body":["tell","source"," let dim = 2\n\n (* Constructors, accessors and constants *)\n\n let v x y = { x = x; y = y }\n let comp i = V2t.i.(i)\n let x a = a.x\n let y a = a.y\n let ox = v 1. 0.\n let oy = v 0. 1.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.018582,"delta":8.100000000000121e-05,"body":["return",{"cursor":{"line":381,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.018697,"delta":0.00011499999999999705,"body":["tell","source"," let zero = v 0. 0.\n let infinity = v infinity infinity\n let neg_infinity = v neg_infinity neg_infinity\n let _basis = [| ox; oy |]\n let basis i = _basis.(i)\n let of_tuple (x, y) = v x y\n let to_tuple a = (a.x, a.y)\n let of_polar pv = v (pv.x *. (cos pv.y)) (pv.x *. (sin pv.y))\n let to_polar a = v (sqrt (a.x *. a.x +. a.y *. a.y)) (atan2 a.y a.x)\n let of_v3 a = v a.V3t.x a.V3t.y\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.018827,"delta":0.00013000000000000164,"body":["return",{"cursor":{"line":391,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.018929,"delta":0.0001020000000000014,"body":["tell","source"," let of_v4 a = v a.V4t.x a.V4t.y\n\n (* Functions *)\n\n let neg a = v (-. a.x) (-. a.y)\n let add a b = v (a.x +. b.x) (a.y +. b.y)\n let sub a b = v (a.x -. b.x) (a.y -. b.y)\n let mul a b = v (a.x *. b.x) (a.y *. b.y)\n let div a b = v (a.x /. b.x) (a.y /. b.y)\n let smul s a = v (s *. a.x) (s *. a.y)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.01913,"delta":0.0002009999999999998,"body":["return",{"cursor":{"line":401,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.019263000000000002,"delta":0.00013300000000000117,"body":["tell","source"," let half a = smul 0.5 a\n let dot a b = a.x *. b.x +. a.y *. b.y\n let norm a = sqrt (a.x *. a.x +. a.y *. a.y)\n let norm2 a = a.x *. a.x +. a.y *. a.y\n let unit a = smul (1.0 /. (norm a)) a\n let polar r theta = v (r *. (cos theta)) ( r *. (sin theta))\n let angle a = atan2 a.y a.x\n let homogene a = if a.y <> 0. then v (a.x /. a.y) 1.0 else a\n let ortho a = v (-. a.y) a.x\n let mix a b t = v (a.x +. t *. (b.x -. a.x)) (a.y +. t *. (b.y -. a.y))\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.019499,"delta":0.00023599999999999663,"body":["return",{"cursor":{"line":411,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.019598,"delta":9.900000000000186e-05,"body":["tell","source"," let ltr m a =\n let open M2t in\n v (m.e00 *. a.x +. m.e01 *. a.y) (m.e10 *. a.x +. m.e11 *. a.y)\n\n let tr m a =\n let open M3t in\n v (m.e00 *. a.x +. m.e01 *. a.y) (m.e10 *. a.x +. m.e11 *. a.y)\n\n (* Overridden Pervasives operators. *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.022860000000000002,"delta":0.003262000000000001,"body":["return",{"cursor":{"line":421,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.022973,"delta":0.00011299999999999852,"body":["tell","source"," let ( + ) = add\n let ( - ) = sub\n let ( * ) = smul\n let ( / ) v t = smul (1. /. t) v\n\n (* Traversal *)\n\n let map f a = v (f a.x) (f a.y)\n let mapi f a = v (f 0 a.x) (f 1 a.y)\n let fold f acc a = f (f acc a.x) a.y\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.023084,"delta":0.00011099999999999999,"body":["return",{"cursor":{"line":431,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.023178,"delta":9.400000000000033e-05,"body":["tell","source"," let foldi f acc a = f (f acc 0 a.x) 1 a.y\n let iter f a = f a.x; f a.y\n let iteri f a = f 0 a.x; f 1 a.y\n\n (* Predicates and comparisons *)\n\n let for_all p a = p a.x && p a.y\n let exists p a = p a.x || p a.y\n let equal = ( = )\n let equal_f eq a b = (eq a.x b.x) && (eq a.y b.y)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.023341,"delta":0.00016299999999999995,"body":["return",{"cursor":{"line":441,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.023439,"delta":9.800000000000086e-05,"body":["tell","source"," let compare = Pervasives.compare\n let compare_f cmp a b =\n let c = cmp a.x b.x in if c <> 0 then c else\n let c = cmp a.y b.y in c\n\n (* Printers *)\n\n let pp ppf a = pp ppf \"@[<1>(%g@ %g)@]\" a.x a.y\n let pp_f pp_c ppf a = Format.fprintf ppf \"@[<1>(%a@ %a)@]\" pp_c a.x pp_c a.y\nend\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.023554,"delta":0.00011499999999999705,"body":["return",{"cursor":{"line":451,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.023637,"delta":8.299999999999974e-05,"body":["tell","source","\nmodule V3 = struct\n open V3t\n type t = v3\n type m = m3\n let dim = 3\n\n (* Constructors, accessors and constants *)\n\n let v x y z = { x = x; y = y; z = z }\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.023719,"delta":8.200000000000221e-05,"body":["return",{"cursor":{"line":461,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.023834,"delta":0.00011500000000000052,"body":["tell","source"," let comp i = V3t.i.(i)\n let x a = a.x\n let y a = a.y\n let z a = a.z\n let ox = v 1. 0. 0.\n let oy = v 0. 1. 0.\n let oz = v 0. 0. 1.\n let zero = v 0. 0. 0.\n let infinity = v infinity infinity infinity\n let neg_infinity = v neg_infinity neg_infinity neg_infinity\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.023945,"delta":0.00011099999999999999,"body":["return",{"cursor":{"line":471,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.024044,"delta":9.899999999999839e-05,"body":["tell","source"," let _basis = [| ox; oy; oz |]\n let basis i = _basis.(i)\n let of_tuple (x, y, z) = v x y z\n let to_tuple a = (a.x, a.y, a.z)\n\n let of_spherical sv =\n let tc = cos sv.y in let ts = sin sv.y in\n let pc = cos sv.z in let ps = sin sv.z in\n v (sv.x *. tc *. ps) (sv.x *. ts *. ps) (sv.x *. pc)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.024177,"delta":0.00013300000000000117,"body":["return",{"cursor":{"line":481,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.024263,"delta":8.599999999999927e-05,"body":["tell","source"," let to_spherical a =\n let r = sqrt (a.x *. a.x +. a.y *. a.y +. a.z *. a.z) in\n v r (atan2 a.y a.x) (acos (a.z /. r))\n\n let of_v2 a ~z = v a.V2t.x a.V2t.y z\n let of_v4 a = v a.V4t.x a.V4t.y a.V4t.z\n\n (* Functions *)\n\n let neg a = v (-. a.x) (-. a.y) (-. a.z)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.02438,"delta":0.00011699999999999905,"body":["return",{"cursor":{"line":491,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.024512,"delta":0.00013200000000000017,"body":["tell","source"," let add a b = v (a.x +. b.x) (a.y +. b.y) (a.z +. b.z)\n let sub a b = v (a.x -. b.x) (a.y -. b.y) (a.z -. b.z)\n let mul a b = v (a.x *. b.x) (a.y *. b.y) (a.z *. b.z)\n let div a b = v (a.x /. b.x) (a.y /. b.y) (a.z /. b.z)\n let smul s a = v (s *. a.x) (s *. a.y) (s *. a.z)\n let half a = smul 0.5 a\n let cross a b = v\n ((a.y *. b.z) -. (a.z *. b.y))\n ((a.z *. b.x) -. (a.x *. b.z))\n ((a.x *. b.y) -. (a.y *. b.x))\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.024742,"delta":0.00023000000000000104,"body":["return",{"cursor":{"line":501,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.024846999999999998,"delta":0.00010499999999999746,"body":["tell","source","\n let dot a b = a.x *. b.x +. a.y *. b.y +. a.z *. b.z\n let norm a = sqrt (a.x *. a.x +. a.y *. a.y +. a.z *. a.z)\n let norm2 a = a.x *. a.x +. a.y *. a.y +. a.z *. a.z\n let unit a = smul (1. /. (norm a)) a\n let spherical r theta phi =\n let tc = cos theta in let ts = sin theta in\n let pc = cos phi in let ps = sin phi in\n v (r *. tc *. ps) (r *. ts *. ps) (r *. pc)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.0266,"delta":0.001753000000000001,"body":["return",{"cursor":{"line":511,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.026730999999999998,"delta":0.00013099999999999917,"body":["tell","source"," let azimuth a = atan2 a.y a.x\n let zenith a =\n let r = sqrt (a.x *. a.x +. a.y *. a.y +. a.z *. a.z) in\n acos (a.z /. r)\n\n let homogene a = if a.z <> 0. then v (a.x /. a.z) (a.y /. a.z) 1.0 else a\n let mix a b t = v\n (a.x +. t *. (b.x -. a.x))\n (a.y +. t *. (b.y -. a.y))\n (a.z +. t *. (b.z -. a.z))\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.026901,"delta":0.00017000000000000348,"body":["return",{"cursor":{"line":521,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.027003,"delta":0.00010199999999999793,"body":["tell","source","\n let ltr m a =\n let open M3t in\n v (m.e00 *. a.x +. m.e01 *. a.y +. m.e02 *. a.z)\n (m.e10 *. a.x +. m.e11 *. a.y +. m.e12 *. a.z)\n (m.e20 *. a.x +. m.e21 *. a.y +. m.e22 *. a.z)\n\n let tr m a =\n let open M4t in\n v (m.e00 *. a.x +. m.e01 *. a.y +. m.e02 *. a.z)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.027138000000000002,"delta":0.00013500000000000317,"body":["return",{"cursor":{"line":531,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.027236999999999997,"delta":9.899999999999493e-05,"body":["tell","source"," (m.e10 *. a.x +. m.e11 *. a.y +. m.e12 *. a.z)\n (m.e20 *. a.x +. m.e21 *. a.y +. m.e22 *. a.z)\n\n (* Overridden Pervasives operators. *)\n\n let ( + ) = add\n let ( - ) = sub\n let ( * ) = smul\n let ( / ) v t = smul (1. /. t) v\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.027357,"delta":0.00012000000000000205,"body":["return",{"cursor":{"line":541,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.027452,"delta":9.500000000000133e-05,"body":["tell","source"," (* Traversal *)\n\n let map f a = v (f a.x) (f a.y) (f a.z)\n let mapi f a = v (f 0 a.x) (f 1 a.y) (f 2 a.z)\n let fold f acc a = f (f (f acc a.x) a.y) a.z\n let foldi f acc a = f (f (f acc 0 a.x) 1 a.y) 2 a.z\n let iter f a = f a.x; f a.y; f a.z\n let iteri f a = f 0 a.x; f 1 a.y; f 2 a.z\n\n (* Predicates and comparisons *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.027609,"delta":0.0001570000000000009,"body":["return",{"cursor":{"line":551,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.027717,"delta":0.00010799999999999699,"body":["tell","source","\n let for_all p a = p a.x && p a.y && p a.z\n let exists p a = p a.x || p a.y || p a.z\n let equal = ( = )\n let equal_f eq a b = (eq a.x b.x) && (eq a.y b.y) && (eq a.z b.z)\n let compare = Pervasives.compare\n let compare_f cmp a b =\n let c = cmp a.x b.x in if c <> 0 then c else\n let c = cmp a.y b.y in if c <> 0 then c else\n let c = cmp a.z b.z in c\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.027881,"delta":0.00016400000000000095,"body":["return",{"cursor":{"line":561,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.027972999999999998,"delta":9.199999999999833e-05,"body":["tell","source","\n (* Printers *)\n\n let pp ppf a = pp ppf \"@[<1>(%g@ %g@ %g)@]\" a.x a.y a.z\n let pp_f pp_c ppf a = Format.fprintf ppf \"@[<1>(%a@ %a@ %a)@]\"\n pp_c a.x pp_c a.y pp_c a.z\nend\n\nmodule V4 = struct\n open V4t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.028089,"delta":0.00011600000000000152,"body":["return",{"cursor":{"line":571,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.02819,"delta":0.0001010000000000004,"body":["tell","source"," type t = v4\n type m = m4\n let dim = 4\n\n (* Constructors, accessors and constants *)\n\n let v x y z w = { x = x; y = y; z = z; w = w }\n let comp i = V4t.i.(i)\n let x a = a.x\n let y a = a.y\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.028287,"delta":9.699999999999986e-05,"body":["return",{"cursor":{"line":581,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.028381999999999998,"delta":9.499999999999786e-05,"body":["tell","source"," let z a = a.z\n let w a = a.w\n let ox = v 1. 0. 0. 0.\n let oy = v 0. 1. 0. 0.\n let oz = v 0. 0. 1. 0.\n let ow = v 0. 0. 0. 1.\n let zero = v 0. 0. 0. 0.\n let infinity = v infinity infinity infinity infinity\n let neg_infinity = v neg_infinity neg_infinity neg_infinity neg_infinity\n let _basis = [| ox; oy; oz; ow |]\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.028492999999999997,"delta":0.00011099999999999999,"body":["return",{"cursor":{"line":591,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.028592,"delta":9.900000000000186e-05,"body":["tell","source"," let basis i = _basis.(i)\n let of_tuple (x, y, z, w) = v x y z w\n let to_tuple a = (a.x, a.y, a.z, a.w)\n let of_v2 a ~z ~w = v a.V2t.x a.V2t.y z w\n let of_v3 a ~w = v a.V3t.x a.V3t.y a.V3t.z w\n\n (* Functions *)\n\n let neg a = v (-. a.x) (-. a.y) (-. a.z) (-. a.w)\n let add a b = v (a.x +. b.x) (a.y +. b.y) (a.z +. b.z) (a.w +. b.w)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.028751000000000002,"delta":0.0001590000000000029,"body":["return",{"cursor":{"line":601,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.029897,"delta":0.0011459999999999977,"body":["tell","source"," let sub a b = v (a.x -. b.x) (a.y -. b.y) (a.z -. b.z) (a.w -. b.w)\n let mul a b = v (a.x *. b.x) (a.y *. b.y) (a.z *. b.z) (a.w *. b.w)\n let div a b = v (a.x /. b.x) (a.y /. b.y) (a.z /. b.z) (a.w /. b.w)\n let smul s a = v (s *. a.x) (s *. a.y) (s *. a.z) (s *. a.w)\n let half a = smul 0.5 a\n let dot a b = (a.x *. b.x) +. (a.y *. b.y) +. (a.z *. b.z) +. (a.w *. b.w)\n let norm a = sqrt (a.x *. a.x +. a.y *. a.y +. a.z *. a.z +. a.w *. a.w)\n let norm2 a = a.x *. a.x +. a.y *. a.y +. a.z *. a.z +. a.w *. a.w\n let unit a = smul (1. /. (norm a)) a\n let homogene a =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.030153,"delta":0.0002559999999999993,"body":["return",{"cursor":{"line":611,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.030258,"delta":0.00010500000000000093,"body":["tell","source"," if a.w <> 0. then v (a.x /. a.w) (a.y /. a.w) (a.z /. a.w) 1.0 else a\n\n let mix a b t = v\n (a.x +. t *. (b.x -. a.x))\n (a.y +. t *. (b.y -. a.y))\n (a.z +. t *. (b.z -. a.z))\n (a.w +. t *. (b.w -. a.w))\n\n let ltr m a =\n let open M4t in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.030396,"delta":0.00013799999999999923,"body":["return",{"cursor":{"line":621,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.030501,"delta":0.00010500000000000093,"body":["tell","source"," v (m.e00 *. a.x +. m.e01 *. a.y +. m.e02 *. a.z +. m.e03 *. a.w)\n (m.e10 *. a.x +. m.e11 *. a.y +. m.e12 *. a.z +. m.e13 *. a.w)\n (m.e20 *. a.x +. m.e21 *. a.y +. m.e22 *. a.z +. m.e23 *. a.w)\n (m.e30 *. a.x +. m.e31 *. a.y +. m.e32 *. a.z +. m.e33 *. a.w)\n\n (* Overridden Pervasives operators. *)\n\n let ( + ) = add\n let ( - ) = sub\n let ( * ) = smul\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.03066,"delta":0.00015899999999999942,"body":["return",{"cursor":{"line":631,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.030765999999999998,"delta":0.00010599999999999846,"body":["tell","source"," let ( / ) v t = smul (1. /. t) v\n\n (* Traversal *)\n\n let map f a = v (f a.x) (f a.y) (f a.z) (f a.w)\n let mapi f a = v (f 0 a.x) (f 1 a.y) (f 2 a.z) (f 3 a.w)\n let fold f acc a = f (f (f (f acc a.x) a.y) a.z) a.w\n let foldi f acc a = f (f (f (f acc 0 a.x) 1 a.y) 2 a.z) 3 a.w\n let iter f a = f a.x; f a.y; f a.z; f a.w\n let iteri f a = f 0 a.x; f 1 a.y; f 2 a.z; f 3 a.w\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.030963,"delta":0.00019700000000000273,"body":["return",{"cursor":{"line":641,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.031057,"delta":9.400000000000033e-05,"body":["tell","source","\n (* Predicates and comparisons *)\n\n let for_all p a = p a.x && p a.y && p a.z && p a.w\n let exists p a = p a.x || p a.y || p a.z || p a.w\n let equal = ( = )\n let equal_f eq a b =\n (eq a.x b.x) && (eq a.y b.y) && (eq a.z b.z) && (eq a.w b.w)\n\n let compare = Pervasives.compare\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.031196,"delta":0.00013900000000000023,"body":["return",{"cursor":{"line":651,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.031297000000000005,"delta":0.00010100000000000386,"body":["tell","source"," let compare_f cmp a b =\n let c = cmp a.x b.x in if c <> 0 then c else\n let c = cmp a.y b.y in if c <> 0 then c else\n let c = cmp a.z b.z in if c <> 0 then c else\n let c = cmp a.w b.w in c\n\n (* Printers *)\n\n let pp ppf a = pp ppf \"@[<1>(%g@ %g@ %g@ %g)@]\" a.x a.y a.z a.w\n let pp_f pp_c ppf a = Format.fprintf ppf \"@[<1>(%a@ %a@ %a@ %a)@]\"\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.031419,"delta":0.00012199999999999711,"body":["return",{"cursor":{"line":661,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.031486,"delta":6.699999999999762e-05,"body":["tell","source"," pp_c a.x pp_c a.y pp_c a.z pp_c a.w\nend\n\n(* Points *)\n\ntype p2 = v2\ntype p3 = v3\n\nmodule type P = sig\n type t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.031564999999999996,"delta":7.899999999999574e-05,"body":["return",{"cursor":{"line":671,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.031638,"delta":7.300000000000362e-05,"body":["tell","source"," val dim : int\n type mh\n\n (* Constructors, accessors and constants *)\n\n val o : t\n\n (* Functions *)\n\n val mid : t -> t -> t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.031687,"delta":4.900000000000043e-05,"body":["return",{"cursor":{"line":681,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.031756,"delta":6.899999999999962e-05,"body":["tell","source"," val tr : mh -> t -> t\nend\n\nmodule P2 = struct\n open V2t\n type t = p2\n let dim = 2\n type mh = m3\n\n (* Constructors, accessors and constants *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.034966,"delta":0.0032099999999999976,"body":["return",{"cursor":{"line":691,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.035071,"delta":0.00010500000000000093,"body":["tell","source","\n let v = V2.v\n let x = V2.x\n let y = V2.y\n let o = V2.zero\n\n (* Functions *)\n\n let mid p q = v (0.5 *. (p.x +. q.x)) (0.5 *. (p.y +. q.y))\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.035156,"delta":8.500000000000174e-05,"body":["return",{"cursor":{"line":701,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.035235,"delta":7.900000000000268e-05,"body":["tell","source"," let tr m p =\n let open M3t in\n v (m.e00 *. p.x +. m.e01 *. p.y +. m.e02)\n (m.e10 *. p.x +. m.e11 *. p.y +. m.e12)\nend\n\nmodule P3 = struct\n open V3t\n type t = p3\n let dim = 3\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.035327,"delta":9.199999999999486e-05,"body":["return",{"cursor":{"line":711,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.035404,"delta":7.700000000000068e-05,"body":["tell","source"," type mh = m4\n\n (* Constructors, accessors and constants *)\n\n let v = V3.v\n let x = V3.x\n let y = V3.y\n let z = V3.z\n let o = V3.zero\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.035468,"delta":6.400000000000156e-05,"body":["return",{"cursor":{"line":721,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.03554,"delta":7.200000000000262e-05,"body":["tell","source"," (* Functions *)\n\n let mid p q =\n v (0.5 *. (p.x +. q.x))\n (0.5 *. (p.y +. q.y))\n (0.5 *. (p.z +. q.z))\n\n let tr m p =\n let open M4t in\n v (m.e00 *. p.x +. m.e01 *. p.y +. m.e02 *. p.z +. m.e03)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.035622,"delta":8.199999999999874e-05,"body":["return",{"cursor":{"line":731,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.035693,"delta":7.100000000000162e-05,"body":["tell","source"," (m.e10 *. p.x +. m.e11 *. p.y +. m.e12 *. p.z +. m.e13)\n (m.e20 *. p.x +. m.e21 *. p.y +. m.e22 *. p.z +. m.e23)\nend\n\n(* Quaternions *)\n\ntype quat = v4\n\nmodule Quat = struct\n open V4t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.03577,"delta":7.700000000000068e-05,"body":["return",{"cursor":{"line":741,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.035832,"delta":6.199999999999956e-05,"body":["tell","source"," type t = quat\n\n (* Constructors, accessors and constants *)\n\n let v = V4.v\n let zero = V4.zero\n let id = V4.ow\n\n (* Functions *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.035878,"delta":4.599999999999743e-05,"body":["return",{"cursor":{"line":751,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.035966,"delta":8.79999999999978e-05,"body":["tell","source"," let mul q r =\n v (q.y *. r.z -. q.z *. r.y +. q.x *. r.w +. q.w *. r.x)\n (q.z *. r.x -. q.x *. r.z +. q.y *. r.w +. q.w *. r.y)\n (q.x *. r.y -. q.y *. r.x +. q.z *. r.w +. q.w *. r.z)\n (q.w *. r.w -. q.x *. r.x -. q.y *. r.y -. q.z *. r.z)\n\n let conj q = v (-.q.x) (-.q.y) (-.q.z) q.w\n let unit = V4.unit\n let inv q =\n let m = V4.norm2 q in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.036114,"delta":0.0001480000000000023,"body":["return",{"cursor":{"line":761,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.036192,"delta":7.800000000000168e-05,"body":["tell","source"," V4.smul (1.0 /. m) (conj q)\n\n let slerp q r t =\n let cosv = V4.dot q r in\n let a = acos cosv in\n if a < gg_eps then q else\n let sinv = sin a in\n let c = (sin ((1.0 -. t) *. a)) /. sinv in\n let c' = (sin (t *. a)) /. sinv in\n V4.add (V4.smul c q) (V4.smul c' r)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.036301,"delta":0.00010899999999999799,"body":["return",{"cursor":{"line":771,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.036445,"delta":0.0001439999999999983,"body":["tell","source","\n let squad q cq cr r t =\n let u = slerp q r t in\n let v = slerp cq cr t in\n slerp u v (2.0 *. t *. (1.0 -. t))\n\n let nlerp q r t = V4.unit (V4.add q (V4.smul t (V4.sub r q)))\n\n (* 3D space transformations} *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.036532,"delta":8.700000000000374e-05,"body":["return",{"cursor":{"line":781,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.036633,"delta":0.00010099999999999693,"body":["tell","source"," let of_m3 m = (* NOTE code duplicate with of_m4. *)\n let open M3t in\n let v x y z w = unit (v x y z w) in\n let tr = 1. +. m.e00 +. m.e11 +. m.e22 in\n if (tr > 0.0) then\n let s = (sqrt tr) *. 2. in\n v ((m.e21 -. m.e12) /. s)\n ((m.e02 -. m.e20) /. s)\n ((m.e10 -. m.e01) /. s)\n (0.25 *. s)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.036764000000000005,"delta":0.0001310000000000061,"body":["return",{"cursor":{"line":791,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.036859,"delta":9.499999999999786e-05,"body":["tell","source"," else if (m.e00 > m.e11 && m.e00 > m.e22) then\n let s = sqrt (1. +. m.e00 -. m.e11 -. m.e22) *. 2. in\n v (0.25 *. s)\n ((m.e10 +. m.e01) /. s)\n ((m.e02 +. m.e20) /. s)\n ((m.e21 -. m.e12) /. s)\n else if (m.e11 > m.e22) then\n let s = sqrt (1. +. m.e11 -. m.e00 -. m.e22) *. 2. in\n v ((m.e10 +. m.e01) /. s)\n (0.25 *. s)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.03698,"delta":0.00012099999999999611,"body":["return",{"cursor":{"line":801,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.037064,"delta":8.400000000000074e-05,"body":["tell","source"," ((m.e21 +. m.e12) /. s)\n ((m.e02 -. m.e20) /. s)\n else\n let s = sqrt (1. +. m.e22 -. m.e00 -. m.e11) *. 2. in\n v ((m.e02 +. m.e20) /. s)\n ((m.e21 +. m.e12) /. s)\n (0.25 *. s)\n ((m.e10 -. m.e01) /. s)\n\n let of_m4 m = (* NOTE code duplicate with of_m3. *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.037162,"delta":9.800000000000086e-05,"body":["return",{"cursor":{"line":811,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.038862,"delta":0.0017000000000000001,"body":["tell","source"," let open M4t in\n let v x y z w = unit (v x y z w) in\n let tr = 1. +. m.e00 +. m.e11 +. m.e22 in\n if (tr > 0.0) then\n let s = (sqrt tr) *. 2. in\n v ((m.e21 -. m.e12) /. s)\n ((m.e02 -. m.e20) /. s)\n ((m.e10 -. m.e01) /. s)\n (0.25 *. s)\n else if (m.e00 > m.e11 && m.e00 > m.e22) then\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.038984000000000005,"delta":0.00012200000000000405,"body":["return",{"cursor":{"line":821,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.039065,"delta":8.099999999999774e-05,"body":["tell","source"," let s = sqrt (1. +. m.e00 -. m.e11 -. m.e22) *. 2. in\n v (0.25 *. s)\n ((m.e10 +. m.e01) /. s)\n ((m.e02 +. m.e20) /. s)\n ((m.e21 -. m.e12) /. s)\n else if (m.e11 > m.e22) then\n let s = sqrt (1. +. m.e11 -. m.e00 -. m.e22) *. 2. in\n v ((m.e10 +. m.e01) /. s)\n (0.25 *. s)\n ((m.e21 +. m.e12) /. s)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.039214,"delta":0.00014899999999999636,"body":["return",{"cursor":{"line":831,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.039315,"delta":0.00010100000000000386,"body":["tell","source"," ((m.e02 -. m.e20) /. s)\n else\n let s = sqrt (1. +. m.e22 -. m.e00 -. m.e11) *. 2. in\n v ((m.e02 +. m.e20) /. s)\n ((m.e21 +. m.e12) /. s)\n (0.25 *. s)\n ((m.e10 -. m.e01) /. s)\n\n let rot3_map u u' =\n let e = V3.dot u u' in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.039432999999999996,"delta":0.00011799999999999311,"body":["return",{"cursor":{"line":841,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.039517,"delta":8.400000000000074e-05,"body":["tell","source"," let c = V3.cross u u' in\n let r = sqrt (2. *. (1. +. e)) in\n v (c.V3t.x /. r) (c.V3t.y /. r) (c.V3t.z /. r) (r /. 2.)\n\n let rot3_axis u theta =\n let a = theta *. 0.5 in\n let s = sin a in\n v (s *. u.V3t.x) (s *. u.V3t.y) (s *. u.V3t.z) (cos a)\n\n let rot3_zyx r =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.039644,"delta":0.0001270000000000021,"body":["return",{"cursor":{"line":851,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.039739,"delta":9.499999999999786e-05,"body":["tell","source"," let hz = V3.z r *. 0.5 in\n let hy = V3.y r *. 0.5 in\n let hx = V3.x r *. 0.5 in\n let cz = cos hz in let sz = sin hz in\n let cy = cos hy in let sy = sin hy in\n let cx = cos hx in let sx = sin hx in\n let cycz = cy *. cz in let sysz = sy *. sz in\n let cysz = cy *. sz in let sycz = sy *. cz in\n v (cycz *. sx -. sysz *. cx)\n (cysz *. sx +. sycz *. cx)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.039872000000000005,"delta":0.0001330000000000081,"body":["return",{"cursor":{"line":861,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.039964,"delta":9.199999999999486e-05,"body":["tell","source"," (cysz *. cx -. sycz *. sx)\n (cycz *. cx +. sysz *. sx)\n\n let to_rot3_axis q =\n let a_2 = acos q.w in\n if a_2 < gg_eps then (V3.v 1.0 0.0 0.0), 0.0 else\n let d = 1.0 /. (sin a_2) in\n (V3.v (q.x *. d) (q.y *. d) (q.z *. d)), (a_2 *. 2.0)\n\n let to_rot3_zyx q =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.040067,"delta":0.00010299999999999893,"body":["return",{"cursor":{"line":871,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.04017,"delta":0.00010299999999999893,"body":["tell","source"," let xx = q.x *. q.x in let yy = q.y *. q.y in let zz = q.z *. q.z in\n let ww = q.w *. q.w in\n let wx = q.w *. q.x in let wy = q.w *. q.y in let wz = q.w *. q.z in\n let zx = q.z *. q.x in let zy = q.z *. q.y in\n let xy = q.x *. q.y in V3.v\n (atan2 (2. *. (zy +. wx)) (ww -. xx -. yy +. zz))\n (asin (-2. *. (zx -. wy)))\n (atan2 (2. *. (xy +. wz)) (ww +. xx -. yy -. zz))\n\n let apply3 q v = (* NOTE, code duplicate with apply4. *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.04033,"delta":0.00016000000000000042,"body":["return",{"cursor":{"line":881,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.040448,"delta":0.00011800000000000005,"body":["tell","source"," let wx = q.w *. q.x in let wy = q.w *. q.y in let wz = q.w *. q.z in\n let xx = q.x *. q.x in let xy = q.x *. q.y in let xz = q.x *. q.z in\n let yy = q.y *. q.y in let yz = q.y *. q.z in let zz = q.z *. q.z in\n let x = v.V3t.x in let y = v.V3t.y in let z = v.V3t.z in V3.v\n (x +. 2. *. ((-. yy -. zz) *. x +. (xy -. wz) *. y +. (wy +. xz) *. z))\n (y +. 2. *. ((wz +. xy) *. x +. (-. xx -. zz) *. y +. (yz -. wx) *. z))\n (z +. 2. *. ((xz -. wy) *. x +. (wx +. yz) *. y +. (-. xx -. yy) *. z))\n\n let apply4 q v = (* NOTE, code duplicate with apply3. *)\n let wx = q.w *. q.x in let wy = q.w *. q.y in let wz = q.w *. q.z in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.042246,"delta":0.001798000000000001,"body":["return",{"cursor":{"line":891,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.042379,"delta":0.00013300000000000117,"body":["tell","source"," let xx = q.x *. q.x in let xy = q.x *. q.y in let xz = q.x *. q.z in\n let yy = q.y *. q.y in let yz = q.y *. q.z in let zz = q.z *. q.z in\n let x = v.x in let y = v.y in let z = v.z in V4.v\n (x +. 2. *. ((-. yy -. zz) *. x +. (xy -. wz) *. y +. (wy +. xz) *. z))\n (y +. 2. *. ((wz +. xy) *. x +. (-. xx -. zz) *. y +. (yz -. wx) *. z))\n (z +. 2. *. ((xz -. wy) *. x +. (wx +. yz) *. y +. (-. xx -. yy) *. z))\n v.w\nend\n\n(* Matrices *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.042588,"delta":0.00020900000000000085,"body":["return",{"cursor":{"line":901,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.042663,"delta":7.499999999999868e-05,"body":["tell","source","\nmodule type M = sig\n type t\n val dim : int\n type v\n\n (* Constructors, accessors and constants *)\n\n val el : int -> int -> t -> float\n val row : int -> t -> v\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.042748999999999995,"delta":8.59999999999958e-05,"body":["return",{"cursor":{"line":911,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.042828,"delta":7.900000000000268e-05,"body":["tell","source"," val col : int -> t -> v\n val zero : t\n val id : t\n\n (* Functions *)\n\n val neg : t -> t\n val add : t -> t -> t\n val sub : t -> t -> t\n val mul : t -> t -> t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.042905,"delta":7.700000000000068e-05,"body":["return",{"cursor":{"line":921,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.042989,"delta":8.400000000000074e-05,"body":["tell","source"," val emul : t -> t -> t\n val ediv : t -> t -> t\n val smul : float -> t -> t\n val transpose : t -> t\n val trace : t -> float\n val det : t -> float\n val inv : t -> t\n\n (* Traversal *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.043071,"delta":8.199999999999874e-05,"body":["return",{"cursor":{"line":931,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.043165,"delta":9.40000000000038e-05,"body":["tell","source"," val map : (float -> float) -> t -> t\n val mapi : (int -> int -> float -> float) -> t -> t\n val fold : ('a -> float -> 'a) -> 'a -> t -> 'a\n val foldi : ('a -> int -> int -> float -> 'a) -> 'a -> t -> 'a\n val iter : (float -> unit) -> t -> unit\n val iteri : (int -> int -> float -> unit) -> t -> unit\n\n (* Predicates and comparisons *)\n\n val for_all : (float -> bool) -> t -> bool\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.043278,"delta":0.00011299999999999505,"body":["return",{"cursor":{"line":941,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.043365999999999995,"delta":8.79999999999978e-05,"body":["tell","source"," val exists : (float -> bool) -> t -> bool\n val equal : t -> t -> bool\n val equal_f : (float -> float -> bool) -> t -> t -> bool\n val compare : t -> t -> int\n val compare_f : (float -> float -> int) -> t -> t -> int\n\n (* Printers *)\n\n val pp : Format.formatter -> t -> unit\n val pp_f : (Format.formatter -> float -> unit) -> Format.formatter ->\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.043477,"delta":0.00011100000000000693,"body":["return",{"cursor":{"line":951,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.04353699999999999,"delta":5.9999999999990616e-05,"body":["tell","source"," t -> unit\nend\n\nmodule M2 = struct\n open M2t\n open V2t\n type t = m2\n let dim = 2\n type v = v2\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.043589,"delta":5.200000000001037e-05,"body":["return",{"cursor":{"line":961,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.043671,"delta":8.199999999999874e-05,"body":["tell","source"," (* Constructors, accessors and constants *)\n\n let v e00 e01 e10 e11 = { e00 = e00; e10 = e10; e01 = e01; e11 = e11}\n let of_rows r0 r1 = v r0.x r0.y r1.x r1.y\n let of_cols c0 c1 = v c0.x c1.x c0.y c1.y\n let el row col = M2t.i.(dim * col + row)\n let e00 a = a.e00\n let e01 a = a.e01\n let e10 a = a.e10\n let e11 a = a.e11\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.043785000000000004,"delta":0.00011400000000000299,"body":["return",{"cursor":{"line":971,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.043863,"delta":7.799999999999474e-05,"body":["tell","source"," let row r = M2t.row.(r)\n let col c = M2t.col.(c)\n let zero = v 0. 0. 0. 0.\n let id = v 1. 0. 0. 1.\n let of_m3 a = v a.M3t.e00 a.M3t.e01 a.M3t.e10 a.M3t.e11\n let of_m4 a = v a.M4t.e00 a.M4t.e01 a.M4t.e10 a.M4t.e11\n\n (* Functions *)\n\n let neg a =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.043957,"delta":9.40000000000038e-05,"body":["return",{"cursor":{"line":981,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.044032,"delta":7.499999999999868e-05,"body":["tell","source"," v (-. a.e00) (-. a.e01)\n (-. a.e10) (-. a.e11)\n\n let add a b =\n v (a.e00 +. b.e00) (a.e01 +. b.e01)\n (a.e10 +. b.e10) (a.e11 +. b.e11)\n\n let sub a b =\n v (a.e00 -. b.e00) (a.e01 -. b.e01)\n (a.e10 -. b.e10) (a.e11 -. b.e11)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.04413,"delta":9.800000000000086e-05,"body":["return",{"cursor":{"line":991,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.044240999999999996,"delta":0.00011099999999999305,"body":["tell","source","\n let mul a b =\n if a == id then b else\n if b == id then a else\n v (a.e00 *. b.e00 +. a.e01 *. b.e10) (a.e00 *. b.e01 +. a.e01 *. b.e11)\n (a.e10 *. b.e00 +. a.e11 *. b.e10) (a.e10 *. b.e01 +. a.e11 *. b.e11)\n\n let emul a b =\n v (a.e00 *. b.e00) (a.e01 *. b.e01)\n (a.e10 *. b.e10) (a.e11 *. b.e11)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.044361,"delta":0.00012000000000000205,"body":["return",{"cursor":{"line":1001,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.044433,"delta":7.200000000000262e-05,"body":["tell","source","\n let ediv a b =\n v (a.e00 /. b.e00) (a.e01 /. b.e01)\n (a.e10 /. b.e10) (a.e11 /. b.e11)\n\n let smul s a =\n v (s *. a.e00) (s *. a.e01)\n (s *. a.e10) (s *. a.e11)\n\n let transpose a =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.045681,"delta":0.0012479999999999991,"body":["return",{"cursor":{"line":1011,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.04578,"delta":9.900000000000186e-05,"body":["tell","source"," v a.e00 a.e10\n a.e01 a.e11\n\n let trace a = a.e00 +. a.e11\n let det a = a.e00 *. a.e11 -. a.e01 *. a.e10\n let inv a =\n let det = a.e00 *. a.e11 -. a.e01 *. a.e10 in\n v ( a.e11 /. det) (-. a.e01 /. det)\n (-. a.e10 /. det) ( a.e00 /. det)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.045894000000000004,"delta":0.00011400000000000299,"body":["return",{"cursor":{"line":1021,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.045964000000000005,"delta":7.000000000000062e-05,"body":["tell","source"," (* 2D space transformations *)\n\n let rot2 theta =\n let c = cos theta in\n let s = sin theta in\n v c (-. s)\n s c\n\n let scale2 s =\n v s.x 0.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.046045,"delta":8.099999999999774e-05,"body":["return",{"cursor":{"line":1031,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.046139,"delta":9.399999999999686e-05,"body":["tell","source"," 0. s.y\n\n (* Traversal *)\n\n let map f a =\n v (f a.e00) (f a.e01)\n (f a.e10) (f a.e11)\n\n let mapi f a =\n v (f 0 0 a.e00) (f 0 1 a.e01)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.046235,"delta":9.599999999999886e-05,"body":["return",{"cursor":{"line":1041,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.046315999999999996,"delta":8.099999999999774e-05,"body":["tell","source"," (f 1 0 a.e10) (f 1 1 a.e11)\n\n let fold f acc a =\n f (f (f (f acc a.e00) a.e10) a.e01) a.e11\n\n let foldi f acc a =\n f (f (f (f acc 0 0 a.e00) 1 0 a.e10) 0 1 a.e01) 1 1 a.e11\n\n let iter f a = f a.e00; f a.e10; f a.e01; f a.e11\n let iteri f a = f 0 0 a.e00; f 1 0 a.e10; f 0 1 a.e01; f 1 1 a.e11\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.046448,"delta":0.0001320000000000071,"body":["return",{"cursor":{"line":1051,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.04653,"delta":8.199999999999874e-05,"body":["tell","source","\n (* Predicates and comparisons *)\n\n let for_all p a = p a.e00 && p a.e10 && p a.e01 && p a.e11\n let exists p a = p a.e00 || p a.e10 || p a.e01 || p a.e11\n let equal = (=)\n let equal_f eq a b =\n eq a.e00 b.e00 && eq a.e10 b.e10 && eq a.e01 b.e01 && eq a.e11 b.e11\n\n let compare = Pervasives.compare\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.046632,"delta":0.00010199999999999793,"body":["return",{"cursor":{"line":1061,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.046713,"delta":8.099999999999774e-05,"body":["tell","source"," let compare_f cmp a b =\n let c = cmp a.e00 b.e00 in if c <> 0 then c else\n let c = cmp a.e10 b.e10 in if c <> 0 then c else\n let c = cmp a.e01 b.e01 in if c <> 0 then c else\n let c = cmp a.e11 b.e11 in c\n\n (* Printers *)\n\n let pp_f pp_e ppf a =\n let max : int -> int -> int = fun a b -> if a > b then a else b in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.046826,"delta":0.00011300000000000199,"body":["return",{"cursor":{"line":1071,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.046916,"delta":8.99999999999998e-05,"body":["tell","source"," let b = Buffer.create 30 in\n let bppf = Format.formatter_of_buffer b in\n let e00, e00l = pp_buf b bppf \"%a\" pp_e a.e00 in\n let e10, e10l = pp_buf b bppf \"%a\" pp_e a.e10 in\n let max0 = max e00l e10l in\n let e01, e01l = pp_buf b bppf \"%a\" pp_e a.e01 in\n let e11, e11l = pp_buf b bppf \"%a\" pp_e a.e11 in\n let max1 = max e01l e11l in\n pp ppf\n \"@[<v>@[<1>|%a%s@ %a%s|@]@,\\\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.047029,"delta":0.00011300000000000199,"body":["return",{"cursor":{"line":1080,"col":35},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.047104999999999994,"delta":7.599999999999274e-05,"body":["tell","source"," @[<1>|%a%s@ %a%s|@]@]\"\n pp_pad (max0 - e00l) e00 pp_pad (max1 - e01l) e01\n pp_pad (max0 - e10l) e10 pp_pad (max1 - e11l) e11\n\n let pp_e_default ppf = pp ppf \"%g\"\n let pp ppf a = pp_f pp_e_default ppf a\nend\n\nmodule M3 = struct\n open M3t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.047191000000000004,"delta":8.600000000000968e-05,"body":["return",{"cursor":{"line":1091,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.047262000000000005,"delta":7.100000000000162e-05,"body":["tell","source"," open V3t\n type t = m3\n let dim = 3\n type v = v3\n\n (* Constructors, accessors and constants *)\n\n let v e00 e01 e02 e10 e11 e12 e20 e21 e22 =\n { e00 = e00; e10 = e10; e20 = e20;\n e01 = e01; e11 = e11; e21 = e21;\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.047332,"delta":6.999999999999368e-05,"body":["return",{"cursor":{"line":1101,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.04741,"delta":7.800000000000168e-05,"body":["tell","source"," e02 = e02; e12 = e12; e22 = e22; }\n\n let of_rows r0 r1 r2 = v r0.x r0.y r0.z r1.x r1.y r1.z r2.x r2.y r2.z\n let of_cols c0 c1 c2 = v c0.x c1.x c2.x c0.y c1.y c2.y c0.z c1.z c2.z\n let el row col = M3t.i.(dim * col + row)\n let e00 a = a.e00\n let e01 a = a.e01\n let e02 a = a.e02\n let e10 a = a.e10\n let e11 a = a.e11\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.047533000000000006,"delta":0.00012300000000000505,"body":["return",{"cursor":{"line":1111,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.04761,"delta":7.699999999999374e-05,"body":["tell","source"," let e12 a = a.e12\n let e20 a = a.e20\n let e21 a = a.e21\n let e22 a = a.e22\n let row r = M3t.row.(r)\n let col c = M3t.col.(c)\n let zero = v 0. 0. 0. 0. 0. 0. 0. 0. 0.\n let id = v 1. 0. 0. 0. 1. 0. 0. 0. 1.\n let of_m2_v2 a u =\n v a.M2t.e00 a.M2t.e01 u.V2t.x\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.050433,"delta":0.002822999999999999,"body":["return",{"cursor":{"line":1121,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.05054,"delta":0.00010700000000000293,"body":["tell","source"," a.M2t.e10 a.M2t.e11 u.V2t.y\n 0. 0. 1.\n\n let of_m4 a =\n v a.M4t.e00 a.M4t.e01 a.M4t.e02\n a.M4t.e10 a.M4t.e11 a.M4t.e12\n a.M4t.e20 a.M4t.e21 a.M4t.e22\n\n let of_quat q = (* NOTE, code duplicate with M4.of_quat. *)\n let open V4t in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.050649,"delta":0.00010899999999999799,"body":["return",{"cursor":{"line":1131,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.050762,"delta":0.00011300000000000199,"body":["tell","source"," let x2 = q.x +. q.x in let y2 = q.y +. q.y in let z2 = q.z +. q.z in\n let xx2 = x2 *. q.x in let xy2 = x2 *. q.y in let xz2 = x2 *. q.z in\n let xw2 = x2 *. q.w in let yy2 = y2 *. q.y in let yz2 = y2 *. q.z in\n let yw2 = y2 *. q.w in let zz2 = z2 *. q.z in let zw2 = z2 *. q.w in v\n (1.0 -. yy2 -. zz2) (xy2 -. zw2) (xz2 +. yw2)\n (xy2 +. zw2) (1.0 -. xx2 -. zz2) (yz2 -. xw2)\n (xz2 -. yw2) (yz2 +. xw2) (1.0 -. xx2 -. yy2)\n\n (* Functions *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.050943,"delta":0.0001810000000000006,"body":["return",{"cursor":{"line":1141,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.051032,"delta":8.89999999999988e-05,"body":["tell","source"," let neg a =\n v (-. a.e00) (-. a.e01) (-. a.e02)\n (-. a.e10) (-. a.e11) (-. a.e12)\n (-. a.e20) (-. a.e21) (-. a.e22)\n\n let add a b =\n v (a.e00 +. b.e00) (a.e01 +. b.e01) (a.e02 +. b.e02)\n (a.e10 +. b.e10) (a.e11 +. b.e11) (a.e12 +. b.e12)\n (a.e20 +. b.e20) (a.e21 +. b.e21) (a.e22 +. b.e22)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.051167,"delta":0.00013499999999999623,"body":["return",{"cursor":{"line":1151,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.051257,"delta":8.99999999999998e-05,"body":["tell","source"," let sub a b =\n v (a.e00 -. b.e00) (a.e01 -. b.e01) (a.e02 -. b.e02)\n (a.e10 -. b.e10) (a.e11 -. b.e11) (a.e12 -. b.e12)\n (a.e20 -. b.e20) (a.e21 -. b.e21) (a.e22 -. b.e22)\n\n let mul a b =\n if a == id then b else\n if b == id then a else\n v (a.e00 *. b.e00 +. a.e01 *. b.e10 +. a.e02 *. b.e20)\n (a.e00 *. b.e01 +. a.e01 *. b.e11 +. a.e02 *. b.e21)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.051388,"delta":0.0001310000000000061,"body":["return",{"cursor":{"line":1161,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.051485,"delta":9.699999999999986e-05,"body":["tell","source"," (a.e00 *. b.e02 +. a.e01 *. b.e12 +. a.e02 *. b.e22)\n (a.e10 *. b.e00 +. a.e11 *. b.e10 +. a.e12 *. b.e20)\n (a.e10 *. b.e01 +. a.e11 *. b.e11 +. a.e12 *. b.e21)\n (a.e10 *. b.e02 +. a.e11 *. b.e12 +. a.e12 *. b.e22)\n (a.e20 *. b.e00 +. a.e21 *. b.e10 +. a.e22 *. b.e20)\n (a.e20 *. b.e01 +. a.e21 *. b.e11 +. a.e22 *. b.e21)\n (a.e20 *. b.e02 +. a.e21 *. b.e12 +. a.e22 *. b.e22)\n\n let emul a b =\n v (a.e00 *. b.e00) (a.e01 *. b.e01) (a.e02 *. b.e02)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.051646,"delta":0.00016099999999999448,"body":["return",{"cursor":{"line":1171,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.051733,"delta":8.700000000000374e-05,"body":["tell","source"," (a.e10 *. b.e10) (a.e11 *. b.e11) (a.e12 *. b.e12)\n (a.e20 *. b.e20) (a.e21 *. b.e21) (a.e22 *. b.e22)\n\n let ediv a b =\n v (a.e00 /. b.e00) (a.e01 /. b.e01) (a.e02 /. b.e02)\n (a.e10 /. b.e10) (a.e11 /. b.e11) (a.e12 /. b.e12)\n (a.e20 /. b.e20) (a.e21 /. b.e21) (a.e22 /. b.e22)\n\n let smul s a =\n v (s *. a.e00) (s *. a.e01) ( s *. a.e02)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.051866999999999996,"delta":0.00013399999999999523,"body":["return",{"cursor":{"line":1181,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.051944,"delta":7.700000000000068e-05,"body":["tell","source"," (s *. a.e10) (s *. a.e11) ( s *. a.e12)\n (s *. a.e20) (s *. a.e21) ( s *. a.e22)\n\n let transpose a =\n v a.e00 a.e10 a.e20\n a.e01 a.e11 a.e21\n a.e02 a.e12 a.e22\n\n let trace a = a.e00 +. a.e11 +. a.e22\n let det a =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.052038,"delta":9.40000000000038e-05,"body":["return",{"cursor":{"line":1191,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.052135,"delta":9.699999999999986e-05,"body":["tell","source"," let m00 = (a.e11 *. a.e22) -. (a.e21 *. a.e12) in (* minor. *)\n let m10 = (a.e01 *. a.e22) -. (a.e21 *. a.e02) in\n let m20 = (a.e01 *. a.e12) -. (a.e11 *. a.e02) in\n (a.e00 *. m00) -. (a.e10 *. m10) +. (a.e20 *. m20)\n\n let inv a =\n let m00 = (a.e11 *. a.e22) -. (a.e21 *. a.e12) in (* minor. *)\n let m10 = (a.e01 *. a.e22) -. (a.e21 *. a.e02) in\n let m20 = (a.e01 *. a.e12) -. (a.e11 *. a.e02) in\n let m01 = (a.e10 *. a.e22) -. (a.e20 *. a.e12) in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.055264999999999995,"delta":0.003129999999999994,"body":["return",{"cursor":{"line":1201,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.055421,"delta":0.00015600000000000336,"body":["tell","source"," let m11 = (a.e00 *. a.e22) -. (a.e20 *. a.e02) in\n let m21 = (a.e00 *. a.e12) -. (a.e10 *. a.e02) in\n let m02 = (a.e10 *. a.e21) -. (a.e20 *. a.e11) in\n let m12 = (a.e00 *. a.e21) -. (a.e20 *. a.e01) in\n let m22 = (a.e00 *. a.e11) -. (a.e10 *. a.e01) in\n let det = (a.e00 *. m00) -. (a.e10 *. m10) +. (a.e20 *. m20) in\n v ( m00 /. det) (-. m10 /. det) ( m20 /. det)\n (-. m01 /. det) ( m11 /. det) (-. m21 /. det)\n ( m02 /. det) (-. m12 /. det) ( m22 /. det)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.055616,"delta":0.00019500000000000073,"body":["return",{"cursor":{"line":1211,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.055696999999999997,"delta":8.099999999999774e-05,"body":["tell","source"," (* 2D space transforms *)\n\n let move2 d =\n v 1. 0. d.V2t.x\n 0. 1. d.V2t.y\n 0. 0. 1.\n\n let rot2 ?pt theta =\n let c = cos theta in\n let s = sin theta in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.055795,"delta":9.800000000000086e-05,"body":["return",{"cursor":{"line":1221,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.055886,"delta":9.10000000000008e-05,"body":["tell","source"," match pt with\n | None ->\n v c (-. s) 0.\n s c 0.\n 0. 0. 1.\n | Some pt ->\n let px = P2.x pt in\n let py = P2.y pt in\n v c (-. s) (-. c *. px +. s *. py +. px)\n s c (-. s *. px -. c *. py +. py)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.055994,"delta":0.00010800000000000393,"body":["return",{"cursor":{"line":1231,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.056073,"delta":7.899999999999574e-05,"body":["tell","source"," 0. 0. 0.\n\n let scale2 s =\n v s.V2t.x 0. 0.\n 0. s.V2t.y 0.\n 0. 0. 1.\n\n let rigid2 ~move ~rot =\n let c = cos rot in\n let s = sin rot in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.056142,"delta":6.899999999999962e-05,"body":["return",{"cursor":{"line":1241,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.056225,"delta":8.299999999999974e-05,"body":["tell","source"," v c (-. s) move.V2t.x\n s c move.V2t.y\n 0. 0. 1.\n\n let srigid2 ~move ~rot ~scale =\n let c = cos rot in\n let s = sin rot in\n v (c *. scale.V2t.x) ((-. s) *. scale.V2t.y) move.V2t.x\n (s *. scale.V2t.x) (c *. scale.V2t.y) move.V2t.y\n 0. 0. 1.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.056322,"delta":9.699999999999986e-05,"body":["return",{"cursor":{"line":1251,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.056396,"delta":7.400000000000462e-05,"body":["tell","source","\n (* 3D space transforms *)\n\n let rot3_map u u' =\n let n = V3.cross u u' in\n let e = V3.dot u u' in\n let h = 1. /. (1. +. e) in\n let xy = n.x *. n.y in\n let xz = n.x *. n.z in\n let yz = n.y *. n.z in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.056493,"delta":9.699999999999986e-05,"body":["return",{"cursor":{"line":1261,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.05658199999999999,"delta":8.899999999999186e-05,"body":["tell","source"," v (e +. h *. n.x *. n.x) (h *. xy -. n.z) (h *. xz +. n.y)\n (h *. xy +. n.z) (e +. h *. n.y *. n.y) (h *. yz -. n.x)\n (h *. xz -. n.y) (h *. yz +. n.x) (e +. h *. n.z *. n.z)\n\n let rot3_axis u theta =\n let xy = u.x *. u.y in\n let xz = u.x *. u.z in\n let yz = u.y *. u.z in\n let c = (cos theta) in\n let one_c = 1. -. c in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.056718000000000005,"delta":0.0001360000000000111,"body":["return",{"cursor":{"line":1271,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.056801000000000004,"delta":8.299999999999974e-05,"body":["tell","source"," let s = (sin theta) in\n v (u.x *. u.x *. one_c +. c)\n (xy *. one_c -. u.z *. s)\n (xz *. one_c +. u.y *. s)\n (xy *. one_c +. u.z *. s)\n (u.y *. u.y *. one_c +. c)\n (yz *. one_c -. u.x *. s)\n (xz *. one_c -. u.y *. s)\n (yz *. one_c +. u.x *. s)\n (u.z *. u.z *. one_c +. c)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.056911,"delta":0.00010999999999999899,"body":["return",{"cursor":{"line":1281,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.057037,"delta":0.00012599999999999417,"body":["tell","source","\n let rot3_zyx r =\n let cz = cos r.z in let sz = sin r.z in\n let cy = cos r.y in let sy = sin r.y in\n let cx = cos r.x in let sx = sin r.x in\n v (cy *. cz) (sy *. sx *. cz -. cx *. sz) (sy *. cx *. cz +. sx *. sz)\n (cy *. sz) (sy *. sx *. sz +. cx *. cz) (sy *. cx *. sz -. sx *. cz)\n (-. sy) (cy *. sx) (cy *. cx)\n\n let scale3 s =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.057169,"delta":0.00013200000000000017,"body":["return",{"cursor":{"line":1291,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.057242,"delta":7.300000000000362e-05,"body":["tell","source"," v s.x 0. 0.\n 0. s.y 0.\n 0. 0. s.z\n\n (* Traversal *)\n\n let map f a =\n v (f a.e00) (f a.e01) (f a.e02)\n (f a.e10) (f a.e11) (f a.e12)\n (f a.e20) (f a.e21) (f a.e22)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.058487,"delta":0.0012449999999999961,"body":["return",{"cursor":{"line":1301,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.058589,"delta":0.00010200000000000486,"body":["tell","source","\n let mapi f a =\n v (f 0 0 a.e00) (f 0 1 a.e01) (f 0 2 a.e02)\n (f 1 0 a.e10) (f 1 1 a.e11) (f 1 2 a.e12)\n (f 2 0 a.e20) (f 2 1 a.e21) (f 2 2 a.e22)\n\n let fold f acc a =\n f (f (f (f (f (f (f (f (f acc a.e00) a.e10) a.e20) a.e01) a.e11) a.e21)\n a.e02) a.e12) a.e22\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.058731000000000005,"delta":0.00014200000000000323,"body":["return",{"cursor":{"line":1311,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.058884,"delta":0.00015299999999999342,"body":["tell","source"," let foldi f acc a =\n f (f (f (f (f (f (f (f (f acc 0 0 a.e00) 1 0 a.e10) 2 0 a.e20) 0 1 a.e01)\n 1 1 a.e11) 2 1 a.e21) 0 2 a.e02) 1 2 a.e12) 2 2 a.e22\n\n let iter f a =\n f a.e00; f a.e10; f a.e20;\n f a.e01; f a.e11; f a.e21;\n f a.e02; f a.e12; f a.e22\n\n let iteri f a =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.059165999999999996,"delta":0.00028199999999999753,"body":["return",{"cursor":{"line":1321,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.059308,"delta":0.00014200000000000323,"body":["tell","source"," f 0 0 a.e00; f 1 0 a.e10; f 2 0 a.e20;\n f 0 1 a.e01; f 1 1 a.e11; f 2 1 a.e21;\n f 0 2 a.e02; f 1 2 a.e12; f 2 2 a.e22\n\n (* Predicates and comparisons *)\n\n let for_all p a =\n p a.e00 && p a.e10 && p a.e20 &&\n p a.e01 && p a.e11 && p a.e21 &&\n p a.e02 && p a.e12 && p a.e22\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.059433,"delta":0.0001250000000000001,"body":["return",{"cursor":{"line":1331,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.059538999999999995,"delta":0.00010599999999999499,"body":["tell","source","\n let exists p a =\n p a.e00 || p a.e10 || p a.e20 ||\n p a.e01 || p a.e11 || p a.e21 ||\n p a.e02 || p a.e12 || p a.e22\n\n let equal = (=)\n let equal_f eq a b =\n eq a.e00 b.e00 && eq a.e10 b.e10 && eq a.e20 b.e20 &&\n eq a.e01 b.e01 && eq a.e11 b.e11 && eq a.e21 b.e21 &&\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.059724,"delta":0.0001850000000000046,"body":["return",{"cursor":{"line":1341,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.059853,"delta":0.0001290000000000041,"body":["tell","source"," eq a.e02 b.e02 && eq a.e12 b.e12 && eq a.e22 b.e22\n\n let compare = Pervasives.compare\n let compare_f cmp a b =\n let c = cmp a.e00 b.e00 in if c <> 0 then c else\n let c = cmp a.e10 b.e10 in if c <> 0 then c else\n let c = cmp a.e20 b.e20 in if c <> 0 then c else\n let c = cmp a.e01 b.e01 in if c <> 0 then c else\n let c = cmp a.e11 b.e11 in if c <> 0 then c else\n let c = cmp a.e21 b.e21 in if c <> 0 then c else\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.060047,"delta":0.00019399999999999973,"body":["return",{"cursor":{"line":1351,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.060161,"delta":0.00011399999999999605,"body":["tell","source"," let c = cmp a.e02 b.e02 in if c <> 0 then c else\n let c = cmp a.e12 b.e12 in if c <> 0 then c else\n let c = cmp a.e22 b.e22 in c\n\n (* Printers *)\n\n let pp_f pp_e ppf a =\n let max : int -> int -> int -> int = fun a b c ->\n if a > b then (if a > c then a else c) else (if b > c then b else c)\n in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.060320000000000006,"delta":0.00015900000000000636,"body":["return",{"cursor":{"line":1361,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.060462,"delta":0.0001419999999999963,"body":["tell","source"," let b = Buffer.create 30 in\n let bppf = Format.formatter_of_buffer b in\n let e00, e00l = pp_buf b bppf \"%a\" pp_e a.e00 in\n let e10, e10l = pp_buf b bppf \"%a\" pp_e a.e10 in\n let e20, e20l = pp_buf b bppf \"%a\" pp_e a.e20 in\n let max0 = max e00l e10l e20l in\n let e01, e01l = pp_buf b bppf \"%a\" pp_e a.e01 in\n let e11, e11l = pp_buf b bppf \"%a\" pp_e a.e11 in\n let e21, e21l = pp_buf b bppf \"%a\" pp_e a.e21 in\n let max1 = max e01l e11l e21l in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.060641,"delta":0.0001789999999999986,"body":["return",{"cursor":{"line":1371,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.060781,"delta":0.00014000000000000123,"body":["tell","source"," let e02, e02l = pp_buf b bppf \"%a\" pp_e a.e02 in\n let e12, e12l = pp_buf b bppf \"%a\" pp_e a.e12 in\n let e22, e22l = pp_buf b bppf \"%a\" pp_e a.e22 in\n let max2 = max e02l e12l e22l in\n pp ppf\n \"@[<v>@[<1>|%a%s@ %a%s@ %a%s|@]@,\\\n @[<1>|%a%s@ %a%s@ %a%s|@]@,\\\n @[<1>|%a%s@ %a%s@ %a%s|@]@]\"\n pp_pad (max0 - e00l) e00 pp_pad (max1 - e01l) e01 pp_pad (max2 - e02l) e02\n pp_pad (max0 - e10l) e10 pp_pad (max1 - e11l) e11 pp_pad (max2 - e12l) e12\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.062975,"delta":0.0021940000000000015,"body":["return",{"cursor":{"line":1381,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.063113,"delta":0.00013799999999999923,"body":["tell","source"," pp_pad (max0 - e20l) e20 pp_pad (max1 - e21l) e21 pp_pad (max2 - e22l) e22\n\n\n let pp_e_default ppf = pp ppf \"%g\"\n let pp ppf a = pp_f pp_e_default ppf a\nend\n\nmodule M4 = struct\n open M4t\n open V4t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.063225,"delta":0.00011200000000000099,"body":["return",{"cursor":{"line":1391,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.063322,"delta":9.699999999999986e-05,"body":["tell","source"," type t = m4\n let dim = 4\n type v = v4\n\n (* Constructors, accessors and constants *)\n\n let v e00 e01 e02 e03 e10 e11 e12 e13 e20 e21 e22 e23 e30 e31 e32 e33 =\n { e00 = e00; e10 = e10; e20 = e20; e30 = e30;\n e01 = e01; e11 = e11; e21 = e21; e31 = e31;\n e02 = e02; e12 = e12; e22 = e22; e32 = e32;\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.063468,"delta":0.00014599999999999336,"body":["return",{"cursor":{"line":1401,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.06359300000000001,"delta":0.000125000000000014,"body":["tell","source"," e03 = e03; e13 = e13; e23 = e23; e33 = e33 }\n\n let of_rows r0 r1 r2 r3 =\n v r0.x r0.y r0.z r0.w\n r1.x r1.y r1.z r1.w\n r2.x r2.y r2.z r2.w\n r3.x r3.y r3.z r3.w\n\n let of_cols c0 c1 c2 c3 =\n v c0.x c1.x c2.x c3.x\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.063706,"delta":0.00011299999999998811,"body":["return",{"cursor":{"line":1411,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.063801,"delta":9.499999999999786e-05,"body":["tell","source"," c0.y c1.y c2.y c3.y\n c0.z c1.z c2.z c3.z\n c0.w c1.w c2.w c3.w\n\n let el row col = M4t.i.(dim * col + row)\n let e00 a = a.e00\n let e01 a = a.e01\n let e02 a = a.e02\n let e03 a = a.e03\n let e10 a = a.e10\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.06390799999999999,"delta":0.00010699999999999599,"body":["return",{"cursor":{"line":1421,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.064002,"delta":9.400000000001074e-05,"body":["tell","source"," let e11 a = a.e11\n let e12 a = a.e12\n let e13 a = a.e13\n let e20 a = a.e20\n let e21 a = a.e21\n let e22 a = a.e22\n let e23 a = a.e23\n let e30 a = a.e30\n let e31 a = a.e31\n let e32 a = a.e32\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.064084,"delta":8.199999999999874e-05,"body":["return",{"cursor":{"line":1431,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.06419999999999999,"delta":0.00011599999999999111,"body":["tell","source"," let e33 a = a.e33\n let row r = M4t.row.(r)\n let col c = M4t.col.(c)\n let zero = v 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n let id = v 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1.\n let of_m3_v3 a u =\n v a.M3t.e00 a.M3t.e01 a.M3t.e02 u.V3t.x\n a.M3t.e10 a.M3t.e11 a.M3t.e12 u.V3t.y\n a.M3t.e20 a.M3t.e21 a.M3t.e22 u.V3t.z\n 0. 0. 0. 1.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.064346,"delta":0.00014600000000000724,"body":["return",{"cursor":{"line":1441,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.06448999999999999,"delta":0.00014399999999999136,"body":["tell","source","\n let of_quat q = (* NOTE, code duplicate with M3.of_quat. *)\n let x2 = q.x +. q.x in let y2 = q.y +. q.y in let z2 = q.z +. q.z in\n let xx2 = x2 *. q.x in let xy2 = x2 *. q.y in let xz2 = x2 *. q.z in\n let xw2 = x2 *. q.w in let yy2 = y2 *. q.y in let yz2 = y2 *. q.z in\n let yw2 = y2 *. q.w in let zz2 = z2 *. q.z in let zw2 = z2 *. q.w in v\n (1.0 -. yy2 -. zz2) (xy2 -. zw2) (xz2 +. yw2) 0.0\n (xy2 +. zw2) (1.0 -. xx2 -. zz2) (yz2 -. xw2) 0.0\n (xz2 -. yw2) (yz2 +. xw2) (1.0 -. xx2 -. yy2) 0.0\n 0.0 0.0 0.0 1.0\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.064654,"delta":0.00016400000000001136,"body":["return",{"cursor":{"line":1451,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.06475,"delta":9.599999999999886e-05,"body":["tell","source","\n (* Functions *)\n\n let neg a =\n v (-. a.e00) (-. a.e01) (-. a.e02) (-. a.e03)\n (-. a.e10) (-. a.e11) (-. a.e12) (-. a.e13)\n (-. a.e20) (-. a.e21) (-. a.e22) (-. a.e23)\n (-. a.e30) (-. a.e31) (-. a.e32) (-. a.e33)\n\n let add a b =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.06486600000000001,"delta":0.00011600000000000499,"body":["return",{"cursor":{"line":1461,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.065001,"delta":0.00013499999999999623,"body":["tell","source"," v (a.e00 +. b.e00) (a.e01 +. b.e01) (a.e02 +. b.e02) (a.e03 +. b.e03)\n (a.e10 +. b.e10) (a.e11 +. b.e11) (a.e12 +. b.e12) (a.e13 +. b.e13)\n (a.e20 +. b.e20) (a.e21 +. b.e21) (a.e22 +. b.e22) (a.e23 +. b.e23)\n (a.e30 +. b.e30) (a.e31 +. b.e31) (a.e32 +. b.e32) (a.e33 +. b.e33)\n\n let sub a b =\n v (a.e00 -. b.e00) (a.e01 -. b.e01) (a.e02 -. b.e02) (a.e03 -. b.e03)\n (a.e10 -. b.e10) (a.e11 -. b.e11) (a.e12 -. b.e12) (a.e13 -. b.e13)\n (a.e20 -. b.e20) (a.e21 -. b.e21) (a.e22 -. b.e22) (a.e23 -. b.e23)\n (a.e30 -. b.e30) (a.e31 -. b.e31) (a.e32 -. b.e32) (a.e33 -. b.e33)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.066695,"delta":0.001694000000000001,"body":["return",{"cursor":{"line":1471,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.066855,"delta":0.00015999999999999348,"body":["tell","source","\n let mul a b =\n if a == id then b else\n if b == id then a else\n v (a.e00 *. b.e00 +. a.e01 *. b.e10 +. a.e02 *. b.e20 +. a.e03 *. b.e30)\n (a.e00 *. b.e01 +. a.e01 *. b.e11 +. a.e02 *. b.e21 +. a.e03 *. b.e31)\n (a.e00 *. b.e02 +. a.e01 *. b.e12 +. a.e02 *. b.e22 +. a.e03 *. b.e32)\n (a.e00 *. b.e03 +. a.e01 *. b.e13 +. a.e02 *. b.e23 +. a.e03 *. b.e33)\n (a.e10 *. b.e00 +. a.e11 *. b.e10 +. a.e12 *. b.e20 +. a.e13 *. b.e30)\n (a.e10 *. b.e01 +. a.e11 *. b.e11 +. a.e12 *. b.e21 +. a.e13 *. b.e31)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.067108,"delta":0.0002530000000000032,"body":["return",{"cursor":{"line":1481,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.067286,"delta":0.0001779999999999976,"body":["tell","source"," (a.e10 *. b.e02 +. a.e11 *. b.e12 +. a.e12 *. b.e22 +. a.e13 *. b.e32)\n (a.e10 *. b.e03 +. a.e11 *. b.e13 +. a.e12 *. b.e23 +. a.e13 *. b.e33)\n (a.e20 *. b.e00 +. a.e21 *. b.e10 +. a.e22 *. b.e20 +. a.e23 *. b.e30)\n (a.e20 *. b.e01 +. a.e21 *. b.e11 +. a.e22 *. b.e21 +. a.e23 *. b.e31)\n (a.e20 *. b.e02 +. a.e21 *. b.e12 +. a.e22 *. b.e22 +. a.e23 *. b.e32)\n (a.e20 *. b.e03 +. a.e21 *. b.e13 +. a.e22 *. b.e23 +. a.e23 *. b.e33)\n (a.e30 *. b.e00 +. a.e31 *. b.e10 +. a.e32 *. b.e20 +. a.e33 *. b.e30)\n (a.e30 *. b.e01 +. a.e31 *. b.e11 +. a.e32 *. b.e21 +. a.e33 *. b.e31)\n (a.e30 *. b.e02 +. a.e31 *. b.e12 +. a.e32 *. b.e22 +. a.e33 *. b.e32)\n (a.e30 *. b.e03 +. a.e31 *. b.e13 +. a.e32 *. b.e23 +. a.e33 *. b.e33)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.067637,"delta":0.0003510000000000041,"body":["return",{"cursor":{"line":1491,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.067783,"delta":0.00014599999999999336,"body":["tell","source","\n let emul a b =\n v (a.e00 *. b.e00) (a.e01 *. b.e01) (a.e02 *. b.e02) (a.e03 *. b.e03)\n (a.e10 *. b.e10) (a.e11 *. b.e11) (a.e12 *. b.e12) (a.e13 *. b.e13)\n (a.e20 *. b.e20) (a.e21 *. b.e21) (a.e22 *. b.e22) (a.e23 *. b.e23)\n (a.e30 *. b.e30) (a.e31 *. b.e31) (a.e32 *. b.e32) (a.e33 *. b.e33)\n\n let ediv a b =\n v (a.e00 /. b.e00) (a.e01 /. b.e01) (a.e02 /. b.e02) (a.e03 /. b.e03)\n (a.e10 /. b.e10) (a.e11 /. b.e11) (a.e12 /. b.e12) (a.e13 /. b.e13)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.06804399999999999,"delta":0.00026099999999999735,"body":["return",{"cursor":{"line":1501,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.06816999999999999,"delta":0.0001260000000000011,"body":["tell","source"," (a.e20 /. b.e20) (a.e21 /. b.e21) (a.e22 /. b.e22) (a.e23 /. b.e23)\n (a.e30 /. b.e30) (a.e31 /. b.e31) (a.e32 /. b.e32) (a.e33 /. b.e33)\n\n let smul s a =\n v (s *. a.e00) (s *. a.e01) (s *. a.e02) (s *. a.e03)\n (s *. a.e10) (s *. a.e11) (s *. a.e12) (s *. a.e13)\n (s *. a.e20) (s *. a.e21) (s *. a.e22) (s *. a.e23)\n (s *. a.e30) (s *. a.e31) (s *. a.e32) (s *. a.e33)\n\n let transpose a =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.06838,"delta":0.00021000000000000185,"body":["return",{"cursor":{"line":1511,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.068493,"delta":0.00011300000000000199,"body":["tell","source"," v a.e00 a.e10 a.e20 a.e30\n a.e01 a.e11 a.e21 a.e31\n a.e02 a.e12 a.e22 a.e32\n a.e03 a.e13 a.e23 a.e33\n\n let trace a = a.e00 +. a.e11 +. a.e22 +. a.e33\n let det a =\n let d1 = (a.e22 *. a.e33) -. (a.e32 *. a.e23) in (* second minor. *)\n let d2 = (a.e21 *. a.e33) -. (a.e31 *. a.e23) in\n let d3 = (a.e21 *. a.e32) -. (a.e31 *. a.e22) in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.068662,"delta":0.00016900000000000248,"body":["return",{"cursor":{"line":1521,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.06879199999999999,"delta":0.00012999999999999123,"body":["tell","source"," let m00 = (a.e11 *. d1) -. (a.e12 *. d2) +. (a.e13 *. d3) in (* minor. *)\n let m10 = (a.e01 *. d1) -. (a.e02 *. d2) +. (a.e03 *. d3) in\n let d4 = (a.e02 *. a.e13) -. (a.e12 *. a.e03) in\n let d5 = (a.e01 *. a.e13) -. (a.e11 *. a.e03) in\n let d6 = (a.e01 *. a.e12) -. (a.e11 *. a.e02) in\n let m20 = (a.e31 *. d4) -. (a.e32 *. d5) +. (a.e33 *. d6) in\n let m30 = (a.e21 *. d4) -. (a.e22 *. d5) +. (a.e23 *. d6) in\n (a.e00 *. m00) -. (a.e10 *. m10) +. (a.e20 *. m20) -. (a.e30 *. m30)\n\n let inv a =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.070784,"delta":0.0019920000000000077,"body":["return",{"cursor":{"line":1531,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07092999999999999,"delta":0.00014599999999999336,"body":["tell","source"," let d1 = (a.e22 *. a.e33) -. (a.e32 *. a.e23) in (* second minor. *)\n let d2 = (a.e21 *. a.e33) -. (a.e31 *. a.e23) in\n let d3 = (a.e21 *. a.e32) -. (a.e31 *. a.e22) in\n let m00 = (a.e11 *. d1) -. (a.e12 *. d2) +. (a.e13 *. d3) in (* minor. *)\n let m10 = (a.e01 *. d1) -. (a.e02 *. d2) +. (a.e03 *. d3) in\n let d4 = (a.e02 *. a.e13) -. (a.e12 *. a.e03) in\n let d5 = (a.e01 *. a.e13) -. (a.e11 *. a.e03) in\n let d6 = (a.e01 *. a.e12) -. (a.e11 *. a.e02) in\n let m20 = (a.e31 *. d4) -. (a.e32 *. d5) +. (a.e33 *. d6) in\n let m30 = (a.e21 *. d4) -. (a.e22 *. d5) +. (a.e23 *. d6) in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.071173,"delta":0.0002430000000000071,"body":["return",{"cursor":{"line":1541,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07130400000000001,"delta":0.0001310000000000061,"body":["tell","source"," let d7 = (a.e20 *. a.e33) -. (a.e30 *. a.e23) in\n let d8 = (a.e20 *. a.e32) -. (a.e30 *. a.e22) in\n let m01 = (a.e10 *. d1) -. (a.e12 *. d7) +. (a.e13 *. d8) in\n let m11 = (a.e00 *. d1) -. (a.e02 *. d7) +. (a.e03 *. d8) in\n let d9 = (a.e00 *. a.e13) -. (a.e10 *. a.e03) in\n let d10 = (a.e00 *. a.e12) -. (a.e10 *. a.e02) in\n let m21 = (a.e30 *. d4) -. (a.e32 *. d9) +. (a.e33 *. d10) in\n let m31 = (a.e20 *. d4) -. (a.e22 *. d9) +. (a.e23 *. d10) in\n let d11 = (a.e20 *. a.e31) -. (a.e30 *. a.e21) in\n let m02 = (a.e10 *. d2) -. (a.e11 *. d7) +. (a.e13 *. d11) in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.07153100000000001,"delta":0.00022700000000000498,"body":["return",{"cursor":{"line":1551,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.071654,"delta":0.00012299999999998423,"body":["tell","source"," let m12 = (a.e00 *. d2) -. (a.e01 *. d7) +. (a.e03 *. d11) in\n let d12 = (a.e00 *. a.e11) -. (a.e10 *. a.e01) in\n let m22 = (a.e30 *. d5) -. (a.e31 *. d9) +. (a.e33 *. d12) in\n let m32 =(a.e20 *. d5) -. (a.e21 *. d9) +. (a.e23 *. d12) in\n let m03 = (a.e10 *. d3) -. (a.e11 *. d8) +. (a.e12 *. d11) in\n let m13 = (a.e00 *. d3) -. (a.e01 *. d8) +. (a.e02 *. d11) in\n let m23 = (a.e30 *. d6) -. (a.e31 *. d10) +. (a.e32 *. d12) in\n let m33 = (a.e20 *. d6) -. (a.e21 *. d10) +. (a.e22 *. d12) in\n let det =\n (a.e00 *. m00) -. (a.e10 *. m10) +. (a.e20 *. m20) -. (a.e30 *. m30)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.071865,"delta":0.00021100000000000285,"body":["return",{"cursor":{"line":1561,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07195800000000001,"delta":9.300000000000974e-05,"body":["tell","source"," in\n v ( m00 /. det) (-. m10 /. det) ( m20 /. det) (-. m30 /. det)\n (-. m01 /. det) ( m11 /. det) (-. m21 /. det) ( m31 /. det)\n ( m02 /. det) (-. m12 /. det) ( m22 /. det) (-. m32 /. det)\n (-. m03 /. det) ( m13 /. det) (-. m23 /. det) ( m33 /. det)\n\n (* 2D space transforms *)\n\n (* 2D space transforms *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.072071,"delta":0.00011299999999998811,"body":["return",{"cursor":{"line":1571,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.072147,"delta":7.600000000000662e-05,"body":["tell","source"," let move2 d =\n v 1. 0. 0. d.V2t.x\n 0. 1. 0. d.V2t.y\n 0. 0. 1. 0.\n 0. 0. 0. 1.\n\n let rot2 ?pt theta =\n let c = cos theta in\n let s = sin theta in\n match pt with\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.07223499999999999,"delta":8.799999999999086e-05,"body":["return",{"cursor":{"line":1581,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.072321,"delta":8.600000000000274e-05,"body":["tell","source"," | None ->\n v c (-. s) 0. 0.\n s c 0. 0.\n 0. 0. 1. 0.\n 0. 0. 0. 1.\n | Some pt ->\n let px = P2.x pt in\n let py = P2.y pt in\n v c (-. s) (-. c *. px +. s *. py +. px) 0.\n s c (-. s *. px -. c *. py +. py) 0.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.07578699999999999,"delta":0.003465999999999997,"body":["return",{"cursor":{"line":1591,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.075903,"delta":0.00011600000000000499,"body":["tell","source"," 0. 0. 1. 0.\n 0. 0. 0. 1.\n\n let scale2 s =\n v s.V2t.x 0. 0. 0.\n 0. s.V2t.y 0. 0.\n 0. 0. 1. 0.\n 0. 0. 0. 1.\n\n let rigid2 ~move ~rot =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.07599400000000001,"delta":9.100000000000774e-05,"body":["return",{"cursor":{"line":1601,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.076072,"delta":7.799999999999474e-05,"body":["tell","source"," let c = cos rot in\n let s = sin rot in\n v c (-. s) 0. move.V2t.x\n s c 0. move.V2t.y\n 0. 0. 1. 0.\n 0. 0. 0. 1.\n\n let srigid2 ~move ~rot ~scale =\n let c = cos rot in\n let s = sin rot in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.076185,"delta":0.00011300000000000199,"body":["return",{"cursor":{"line":1611,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07627400000000001,"delta":8.900000000000574e-05,"body":["tell","source"," v (c *. scale.V2t.x) ((-. s) *. scale.V2t.y) 0. move.V2t.x\n (s *. scale.V2t.x) (c *. scale.V2t.y) 0. move.V2t.y\n 0. 0. 1. 0.\n 0. 0. 0. 1.\n\n (* 3D space transforms *)\n\n let move3 d =\n v 1. 0. 0. d.V3t.x\n 0. 1. 0. d.V3t.y\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.076365,"delta":9.099999999999386e-05,"body":["return",{"cursor":{"line":1621,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07643900000000001,"delta":7.400000000000462e-05,"body":["tell","source"," 0. 0. 1. d.V3t.z\n 0. 0. 0. 1.\n\n let rot3_map u u' =\n let n = V3.cross u u' in\n let e = V3.dot u u' in\n let h = 1. /. (1. +. e) in\n let x = n.V3t.x in\n let y = n.V3t.y in\n let z = n.V3t.z in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.07652100000000001,"delta":8.199999999999874e-05,"body":["return",{"cursor":{"line":1631,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07661,"delta":8.899999999999186e-05,"body":["tell","source"," let xy = x *. y in\n let xz = x *. z in\n let yz = y *. z in\n v (e +. h *. x *. x) (h *. xy -. z) (h *. xz +. y) 0.\n (h *. xy +. z) (e +. h *. y *. y) (h *. yz -. x) 0.\n (h *. xz -. y) (h *. yz +. x) (e +. h *. z *. z) 0.\n 0. 0. 0. 1.\n\n let rot3_axis u theta =\n let xy = u.V3t.x *. u.V3t.y in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.07673199999999999,"delta":0.00012199999999999711,"body":["return",{"cursor":{"line":1641,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.076816,"delta":8.400000000000074e-05,"body":["tell","source"," let xz = u.V3t.x *. u.V3t.z in\n let yz = u.V3t.y *. u.V3t.z in\n let c = (cos theta) in\n let one_c = 1. -. c in\n let s = (sin theta) in\n v (u.V3t.x *. u.V3t.x *. one_c +. c)\n (xy *. one_c -. u.V3t.z *. s)\n (xz *. one_c +. u.V3t.y *. s)\n 0.\n (xy *. one_c +. u.V3t.z *. s)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.076933,"delta":0.00011700000000000599,"body":["return",{"cursor":{"line":1651,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07701,"delta":7.699999999999374e-05,"body":["tell","source"," (u.V3t.y *. u.V3t.y *. one_c +. c)\n (yz *. one_c -. u.V3t.x *. s)\n 0.\n (xz *. one_c -. u.V3t.y *. s)\n (yz *. one_c +. u.V3t.x *. s)\n (u.V3t.z *. u.V3t.z *. one_c +. c)\n 0.\n 0. 0. 0. 1.\n\n let rot3_zyx r =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.077096,"delta":8.600000000000274e-05,"body":["return",{"cursor":{"line":1661,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07719799999999999,"delta":0.00010199999999999099,"body":["tell","source"," let cz = cos r.V3t.z in let sz = sin r.V3t.z in\n let cy = cos r.V3t.y in let sy = sin r.V3t.y in\n let cx = cos r.V3t.x in let sx = sin r.V3t.x in\n v (cy *. cz) (sy *. sx *. cz -. cx *. sz) (sy *. cx *. cz +. sx *. sz) 0.\n (cy *. sz) (sy *. sx *. sz +. cx *. cz) (sy *. cx *. sz -. sx *. cz) 0.\n (-. sy) (cy *. sx) (cy *. cx) 0.\n 0. 0. 0. 1.\n\n let scale3 s =\n v s.V3t.x 0. 0. 0.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.07734000000000001,"delta":0.0001420000000000171,"body":["return",{"cursor":{"line":1671,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.07742099999999999,"delta":8.099999999998386e-05,"body":["tell","source"," 0. s.V3t.y 0. 0.\n 0. 0. s.V3t.z 0.\n 0. 0. 0. 1.\n\n let rigid3 ~move:d ~rot:(u, theta) =\n { (rot3_axis u theta) with e03 = d.V3t.x; e13 = d.V3t.y; e23 = d.V3t.z }\n\n let rigid3q ~move:d ~rot:q =\n { (of_quat q) with e03 = d.V3t.x; e13 = d.V3t.y; e23 = d.V3t.z }\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.077519,"delta":9.800000000001474e-05,"body":["return",{"cursor":{"line":1681,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.077616,"delta":9.699999999999986e-05,"body":["tell","source"," let _srigid d m s =\n v (m.e00 *. s.V3t.x) (m.e01 *. s.V3t.y) (m.e02 *. s.V3t.z) d.V3t.x\n (m.e10 *. s.V3t.x) (m.e11 *. s.V3t.y) (m.e12 *. s.V3t.z) d.V3t.y\n (m.e20 *. s.V3t.x) (m.e21 *. s.V3t.y) (m.e22 *. s.V3t.z) d.V3t.z\n 0. 0. 0. 1.\n\n let srigid3 ~move:d ~rot:(u, a) ~scale:s = _srigid d (rot3_axis u a) s\n let srigid3q ~move:d ~rot:q ~scale:s = _srigid d (of_quat q) s\n\n let ortho ~left ~right ~bot ~top ~near ~far =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.077765,"delta":0.00014899999999999636,"body":["return",{"cursor":{"line":1691,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.08071500000000001,"delta":0.002950000000000008,"body":["tell","source"," let drl = 1. /. (right -. left) in\n let dtb = 1. /. (top -. bot) in\n let dfn = 1. /. (far -. near) in v\n (2. *. drl) 0. 0. (-. (right +. left) *. drl)\n 0. (2. *. dtb) 0. (-. (top +. bot) *. dtb)\n 0. 0. (-. 2. *. dfn) (-. (far +. near) *. dfn)\n 0. 0. 0. 1.0\n\n let persp ~left ~right ~bot ~top ~near ~far =\n let drl = 1. /. (right -. left) in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.08086,"delta":0.00014499999999999236,"body":["return",{"cursor":{"line":1701,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.08103299999999999,"delta":0.0001729999999999926,"body":["tell","source"," let dtb = 1. /. (top -. bot) in\n let dfn = 1. /. (far -. near) in\n let n2 = 2. *. near in v\n (n2 *. drl) 0. ((right +. left) *. drl) 0.\n 0. (n2 *. dtb) ((top +. bot) *. dtb) 0.\n 0. 0. (-. (far +. near) *. dfn) (-. (n2 *. far) *. dfn)\n 0. 0. (-. 1.) 0.\n\n(*\n let persp_fov ~fovy ~aspect ~near ~far =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.08126899999999999,"delta":0.0002360000000000001,"body":["return",{"cursor":{"line":1711,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.081412,"delta":0.00014300000000000423,"body":["tell","source"," let f = 1. /. tan (fovy *. 0.5) in\n let dnf = 1. /. (near -. far) in v\n (f /. aspect) 0. 0. 0.\n 0. f 0. 0.\n 0. 0. ((far +. near) *. dnf) ((2. *. far *. near) *. dnf)\n 0. 0. (-. 1.) 0.\n*)\n\n (* 4D space transforms *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.081467,"delta":5.4999999999999494e-05,"body":["return",{"cursor":{"line":1721,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.08157500000000001,"delta":0.00010800000000001087,"body":["tell","source"," let scale4 s =\n v s.x 0. 0. 0.\n 0. s.y 0. 0.\n 0. 0. s.z 0.\n 0. 0. 0. s.w\n\n (* Traversal *)\n\n let map f a =\n v (f a.e00) (f a.e01) (f a.e02) (f a.e03)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.081717,"delta":0.00014199999999998936,"body":["return",{"cursor":{"line":1731,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.081846,"delta":0.0001290000000000041,"body":["tell","source"," (f a.e10) (f a.e11) (f a.e12) (f a.e13)\n (f a.e20) (f a.e21) (f a.e22) (f a.e23)\n (f a.e30) (f a.e31) (f a.e32) (f a.e33)\n\n let mapi f a =\n v (f 0 0 a.e00) (f 0 1 a.e01) (f 0 2 a.e02) (f 0 3 a.e03)\n (f 1 0 a.e10) (f 1 1 a.e11) (f 1 2 a.e12) (f 1 3 a.e13)\n (f 2 0 a.e20) (f 2 1 a.e21) (f 2 2 a.e22) (f 2 3 a.e23)\n (f 3 0 a.e30) (f 3 1 a.e31) (f 3 2 a.e32) (f 3 3 a.e33)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.08210199999999999,"delta":0.00025599999999999234,"body":["return",{"cursor":{"line":1741,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.08223999999999999,"delta":0.00013799999999999923,"body":["tell","source"," let fold f acc a =\n f (f (f (f (f (f (f (f (f (f (f (f (f (f (f (f acc a.e00) a.e10)\n a.e20) a.e30) a.e01) a.e11) a.e21) a.e31) a.e02) a.e12) a.e22) a.e32)\n a.e03) a.e13) a.e23) a.e33\n\n let foldi f acc a =\n f (f (f (f (f (f (f (f (f (f (f (f (f (f (f (f acc 0 0 a.e00) 1 0 a.e10)\n 2 0 a.e20) 3 0 a.e30) 0 1 a.e01) 1 1 a.e11) 2 1 a.e21) 3 1 a.e31) 0 2 a.e02)\n 1 2 a.e12) 2 2 a.e22) 3 2 a.e32) 0 3 a.e03) 1 3 a.e13) 2 3 a.e23) 3 3 a.e33\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.08252300000000001,"delta":0.00028300000000001935,"body":["return",{"cursor":{"line":1751,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.082644,"delta":0.00012099999999998223,"body":["tell","source"," let iter f a =\n f a.e00; f a.e10; f a.e20; f a.e30;\n f a.e01; f a.e11; f a.e21; f a.e31;\n f a.e02; f a.e12; f a.e22; f a.e32;\n f a.e03; f a.e13; f a.e23; f a.e33\n\n let iteri f a =\n f 0 0 a.e00; f 1 0 a.e10; f 2 0 a.e20; f 3 0 a.e30;\n f 0 1 a.e01; f 1 1 a.e11; f 2 1 a.e21; f 3 1 a.e31;\n f 0 2 a.e02; f 1 2 a.e12; f 2 2 a.e22; f 3 2 a.e32;\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.082883,"delta":0.0002390000000000031,"body":["return",{"cursor":{"line":1761,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.082993,"delta":0.00010999999999999899,"body":["tell","source"," f 0 3 a.e03; f 1 3 a.e13; f 2 3 a.e23; f 3 3 a.e33\n\n (* Predicates and comparisons *)\n\n let for_all p a =\n p a.e00 && p a.e10 && p a.e20 && p a.e30 &&\n p a.e01 && p a.e11 && p a.e21 && p a.e31 &&\n p a.e02 && p a.e12 && p a.e22 && p a.e32 &&\n p a.e03 && p a.e13 && p a.e23 && p a.e33\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.08315400000000001,"delta":0.00016100000000000836,"body":["return",{"cursor":{"line":1771,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.08715200000000001,"delta":0.0039980000000000016,"body":["tell","source"," let exists p a =\n p a.e00 || p a.e10 || p a.e20 || p a.e30 ||\n p a.e01 || p a.e11 || p a.e21 || p a.e31 ||\n p a.e02 || p a.e12 || p a.e22 || p a.e32 ||\n p a.e03 || p a.e13 || p a.e23 || p a.e33\n\n let equal = (=)\n let equal_f eq a b =\n eq a.e00 b.e00 && eq a.e10 b.e10 && eq a.e20 b.e20 && eq a.e30 b.e30 &&\n eq a.e01 b.e01 && eq a.e11 b.e11 && eq a.e21 b.e21 && eq a.e31 b.e31 &&\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.08738799999999999,"delta":0.00023599999999998622,"body":["return",{"cursor":{"line":1781,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.08754100000000001,"delta":0.00015300000000001424,"body":["tell","source"," eq a.e02 b.e02 && eq a.e12 b.e12 && eq a.e22 b.e22 && eq a.e32 b.e32 &&\n eq a.e03 b.e03 && eq a.e13 b.e13 && eq a.e23 b.e23 && eq a.e33 b.e33\n\n let compare = Pervasives.compare\n let compare_f cmp a b =\n let c = cmp a.e00 b.e00 in if c <> 0 then c else\n let c = cmp a.e10 b.e10 in if c <> 0 then c else\n let c = cmp a.e20 b.e20 in if c <> 0 then c else\n let c = cmp a.e30 b.e30 in if c <> 0 then c else\n let c = cmp a.e01 b.e01 in if c <> 0 then c else\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.087714,"delta":0.0001729999999999926,"body":["return",{"cursor":{"line":1791,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.087856,"delta":0.00014200000000000323,"body":["tell","source"," let c = cmp a.e11 b.e11 in if c <> 0 then c else\n let c = cmp a.e21 b.e21 in if c <> 0 then c else\n let c = cmp a.e31 b.e31 in if c <> 0 then c else\n let c = cmp a.e02 b.e02 in if c <> 0 then c else\n let c = cmp a.e12 b.e12 in if c <> 0 then c else\n let c = cmp a.e22 b.e22 in if c <> 0 then c else\n let c = cmp a.e32 b.e32 in if c <> 0 then c else\n let c = cmp a.e03 b.e03 in if c <> 0 then c else\n let c = cmp a.e13 b.e13 in if c <> 0 then c else\n let c = cmp a.e23 b.e23 in if c <> 0 then c else\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.088104,"delta":0.0002479999999999982,"body":["return",{"cursor":{"line":1801,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.08821899999999999,"delta":0.00011499999999999011,"body":["tell","source"," let c = cmp a.e33 b.e33 in c\n\n (* Printers *)\n\n let pp_f pp_e ppf a =\n let max : int -> int -> int -> int -> int = fun a b c d ->\n let max1 = if a > b then a else b in\n let max2 = if c > d then c else d in\n if max1 > max2 then max1 else max2\n in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.088381,"delta":0.00016200000000000936,"body":["return",{"cursor":{"line":1811,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.088547,"delta":0.00016599999999999948,"body":["tell","source"," let b = Buffer.create 30 in\n let bppf = Format.formatter_of_buffer b in\n let e00, e00l = pp_buf b bppf \"%a\" pp_e a.e00 in\n let e10, e10l = pp_buf b bppf \"%a\" pp_e a.e10 in\n let e20, e20l = pp_buf b bppf \"%a\" pp_e a.e20 in\n let e30, e30l = pp_buf b bppf \"%a\" pp_e a.e30 in\n let max0 = max e00l e10l e20l e30l in\n let e01, e01l = pp_buf b bppf \"%a\" pp_e a.e01 in\n let e11, e11l = pp_buf b bppf \"%a\" pp_e a.e11 in\n let e21, e21l = pp_buf b bppf \"%a\" pp_e a.e21 in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.08873299999999999,"delta":0.00018599999999999173,"body":["return",{"cursor":{"line":1821,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.088876,"delta":0.00014300000000000423,"body":["tell","source"," let e31, e31l = pp_buf b bppf \"%a\" pp_e a.e31 in\n let max1 = max e01l e11l e21l e31l in\n let e02, e02l = pp_buf b bppf \"%a\" pp_e a.e02 in\n let e12, e12l = pp_buf b bppf \"%a\" pp_e a.e12 in\n let e22, e22l = pp_buf b bppf \"%a\" pp_e a.e22 in\n let e32, e32l = pp_buf b bppf \"%a\" pp_e a.e32 in\n let max2 = max e02l e12l e22l e32l in\n let e03, e03l = pp_buf b bppf \"%a\" pp_e a.e03 in\n let e13, e13l = pp_buf b bppf \"%a\" pp_e a.e13 in\n let e23, e23l = pp_buf b bppf \"%a\" pp_e a.e23 in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.08906700000000001,"delta":0.0001910000000000106,"body":["return",{"cursor":{"line":1831,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.089201,"delta":0.00013399999999999523,"body":["tell","source"," let e33, e33l = pp_buf b bppf \"%a\" pp_e a.e33 in\n let max3 = max e03l e13l e23l e33l in\n pp ppf\n \"@[<v>@[<1>|%a%s@ %a%s@ %a%s@ %a%s|@]@,\\\n @[<1>|%a%s@ %a%s@ %a%s@ %a%s|@]@,\\\n @[<1>|%a%s@ %a%s@ %a%s@ %a%s|@]@,\\\n @[<1>|%a%s@ %a%s@ %a%s@ %a%s|@]@]\"\n pp_pad (max0 - e00l) e00 pp_pad (max1 - e01l) e01\n pp_pad (max2 - e02l) e02 pp_pad (max3 - e03l) e03 (**)\n pp_pad (max0 - e10l) e10 pp_pad (max1 - e11l) e11\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.089337,"delta":0.00013599999999999723,"body":["return",{"cursor":{"line":1841,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.08945500000000001,"delta":0.00011800000000000699,"body":["tell","source"," pp_pad (max2 - e12l) e12 pp_pad (max3 - e13l) e13 (**)\n pp_pad (max0 - e20l) e20 pp_pad (max1 - e21l) e21\n pp_pad (max2 - e22l) e22 pp_pad (max3 - e23l) e23 (**)\n pp_pad (max0 - e30l) e30 pp_pad (max1 - e31l) e31\n pp_pad (max2 - e32l) e32 pp_pad (max3 - e33l) e33\n\n let pp_e_default ppf = pp ppf \"%g\"\n let pp ppf a = pp_f pp_e_default ppf a\nend\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.091764,"delta":0.0023089999999999916,"body":["return",{"cursor":{"line":1851,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09186,"delta":9.599999999999886e-05,"body":["tell","source","(* Sizes *)\n\ntype size1 = float\ntype size2 = v2\ntype size3 = v3\n\nmodule type Size = sig\n type t\n val dim : int\n val zero : t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09194999999999999,"delta":8.999999999999286e-05,"body":["return",{"cursor":{"line":1861,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09200699999999999,"delta":5.7000000000001494e-05,"body":["tell","source"," val unit : t\nend\n\nmodule Size1 = struct\n type t = float\n let dim = 1\n let v w = w\n let w w = w\n let zero = 0.\n let unit = 1.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.092089,"delta":8.200000000001262e-05,"body":["return",{"cursor":{"line":1871,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09216400000000001,"delta":7.500000000000562e-05,"body":["tell","source","end\n\nmodule Size2 = struct\n type t = size2\n let dim = 2\n let v = V2.v\n let w = V2.x\n let h = V2.y\n let zero = V2.zero\n let unit = V2.v 1. 1.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.092254,"delta":8.999999999999286e-05,"body":["return",{"cursor":{"line":1881,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09234500000000001,"delta":9.100000000000774e-05,"body":["tell","source"," let aspect s = s.V2t.x /. s.V2t.y\n let of_w w ~aspect = V2.v w (aspect /. w)\n let of_h h ~aspect = V2.v (aspect *. h) h\nend\n\nmodule Size3 = struct\n type t = size3\n let dim = 3\n let v = V3.v\n let w = V3.x\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.092432,"delta":8.699999999998986e-05,"body":["return",{"cursor":{"line":1891,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.092514,"delta":8.199999999999874e-05,"body":["tell","source"," let h = V3.y\n let d = V3.z\n let zero = V3.zero\n let unit = V3.v 1. 1. 1.\nend\n\n(* Axis aligned boxes *)\n\nmodule type Box = sig\n type t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09257000000000001,"delta":5.600000000001437e-05,"body":["return",{"cursor":{"line":1901,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.092652,"delta":8.199999999998486e-05,"body":["tell","source"," val dim : int\n type v\n type p\n type size\n type m\n\n (* Constructors, accessors and constants *)\n\n val v : p -> size -> t\n val v_mid : p -> size -> t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09270500000000001,"delta":5.300000000001137e-05,"body":["return",{"cursor":{"line":1911,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09278600000000001,"delta":8.099999999999774e-05,"body":["tell","source"," val empty : t\n val o : t -> p\n val size : t -> size\n val zero : t\n val unit : t\n val of_pts : p -> p -> t\n\n (* Functions *)\n\n val min : t -> p\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09284299999999999,"delta":5.6999999999987616e-05,"body":["return",{"cursor":{"line":1921,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09292600000000001,"delta":8.300000000001362e-05,"body":["tell","source"," val max : t -> p\n val mid : t -> p\n val area : t -> float\n val inter : t -> t -> t\n val union : t -> t -> t\n val inset : v -> t -> t\n val round : t -> t\n val move : v -> t -> t\n val ltr : m -> t -> t\n val map_f : (float -> float) -> t -> t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09302299999999999,"delta":9.699999999998599e-05,"body":["return",{"cursor":{"line":1931,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.093125,"delta":0.00010200000000000486,"body":["tell","source","\n (* Predicates and comparisons *)\n\n val is_empty : t -> bool\n val is_pt : t -> bool\n val isects : t -> t -> bool\n val subset : t -> t -> bool\n val mem : p -> t -> bool\n val equal : t -> t -> bool\n val equal_f : (float -> float -> bool) -> t -> t -> bool\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.093289,"delta":0.00016399999999999748,"body":["return",{"cursor":{"line":1941,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.093408,"delta":0.00011900000000000799,"body":["tell","source"," val compare : t -> t -> int\n val compare_f : (float -> float -> int) -> t -> t -> int\n\n (* Printers *)\n\n val pp : Format.formatter -> t -> unit\n val pp_f : (Format.formatter -> float -> unit) -> Format.formatter ->\n t -> unit\nend\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.093503,"delta":9.499999999999786e-05,"body":["return",{"cursor":{"line":1951,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.093582,"delta":7.899999999999574e-05,"body":["tell","source","module Box1 = struct\n type t = E | R of float * float\n let dim = 1\n type v = float\n type p = float\n type size = size1\n type m = float\n\n let err_e () = invalid_arg err_empty_box\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09368600000000001,"delta":0.00010400000000000686,"body":["return",{"cursor":{"line":1961,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09378400000000001,"delta":9.800000000000086e-05,"body":["tell","source"," (* Constructors, accessors and constants *)\n\n let v o s = R (o, s)\n let v_mid m s = R (m -. 0.5 *. s, s)\n let empty = E\n let o = function E -> err_e () | R (o, _) -> o\n let ox = function E -> err_e () | R (o, _) -> o\n let size = function E -> err_e () | R (_, size) -> size\n let w = function E -> err_e () | R (_, size) -> size\n let zero = v 0. Size1.zero\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09392199999999999,"delta":0.00013799999999998536,"body":["return",{"cursor":{"line":1971,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09401300000000001,"delta":9.100000000002162e-05,"body":["tell","source"," let unit = v 0. Size1.unit\n let of_pts p p' = if p < p' then v p (p' -. p) else v p' (p -. p')\n\n (* Functions *)\n\n let min = o\n let minx = o\n let max = function E -> err_e () | R (o, s) -> o +. s\n let maxx = max\n let mid = function E -> err_e () | R (o, s) -> o +. 0.5 *. s\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.094141,"delta":0.00012799999999998923,"body":["return",{"cursor":{"line":1981,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.094234,"delta":9.299999999999586e-05,"body":["tell","source"," let midx = mid\n let left = minx\n let right = maxx\n let area = function E -> 0. | R (_, s) -> s\n let inter b b' = match b, b' with\n | E, _ | _, E -> E\n | R (o, s), R (o', s') ->\n let l = o in let r = l +. s in\n let l' = o' in let r' = l' +. s' in\n if (r < l') || (r' < l) then E else\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.094348,"delta":0.00011400000000000299,"body":["return",{"cursor":{"line":1991,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09443299999999999,"delta":8.499999999998786e-05,"body":["tell","source"," let o'' = if l > l' then l else l' in\n let s'' = (if r < r' then r else r') -. o'' in\n v o'' s''\n\n let union b b' = match b, b' with\n | E, b | b, E -> b\n | R (o, s), R (o', s') ->\n let o'' = if o < o' then o else o' in\n let s'' =\n let r = o +. s in let r' = o' +. s' in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09607500000000001,"delta":0.0016420000000000184,"body":["return",{"cursor":{"line":2001,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09617199999999999,"delta":9.699999999998599e-05,"body":["tell","source"," (if r > r' then r else r') -. o''\n in\n v o'' s''\n\n let inset d = function\n | E -> E\n | R (o, s) ->\n let o' = o +. d in\n let s' = s -. 2. *. d in\n if s' < 0. then E else v o' s'\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09629599999999999,"delta":0.0001239999999999991,"body":["return",{"cursor":{"line":2011,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.096377,"delta":8.100000000001162e-05,"body":["tell","source","\n let round = function\n | E -> E\n | R (o, s) ->\n let o' = floor o in\n let s' = if (s = 0. && o' <> o) then 1. else ceil s in\n v o' s'\n\n let move d = function E -> E | R (o, s) -> v (o +. d) s\n let ltr m = function E -> E | R (o, s) ->\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.096496,"delta":0.00011899999999999411,"body":["return",{"cursor":{"line":2021,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.096591,"delta":9.499999999999786e-05,"body":["tell","source"," let c0 = m *. o in\n let c1 = m *. (o +. s) in\n if c0 < c1 then v c0 (c1 -. c0) else v c1 (c0 -. c1)\n\n let tr m = function E -> E | R (o, s) ->\n let c0 = m.M2t.e00 *. o +. m.M2t.e01 in\n let c1 = m.M2t.e00 *. (o +. s) +. m.M2t.e01 in\n if c0 < c1 then v c0 (c1 -. c0) else v c1 (c0 -. c1)\n\n let map_f f = function E -> E | R (o, s) -> v (f o) (f s)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09672600000000001,"delta":0.0001350000000000101,"body":["return",{"cursor":{"line":2031,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09680800000000001,"delta":8.199999999999874e-05,"body":["tell","source","\n (* Predicates and comparisons *)\n\n let is_empty = function E -> true | R _ -> false\n let is_pt = function E -> false | R (_, s) -> s = 0.\n\n let isects b b' = match b, b' with\n | E, _ | _, E -> false\n | R (o, s), R (o', s') ->\n let l = o in let r = l +. s in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09690099999999999,"delta":9.299999999998199e-05,"body":["return",{"cursor":{"line":2041,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09697799999999999,"delta":7.700000000000762e-05,"body":["tell","source"," let l' = o' in let r' = l' +. s' in\n not ((r < l') || (r' < l))\n\n let subset b b' = match b, b' with\n | b, E -> false\n | E, b -> true\n | R (o, s), R (o', s') -> (o' <= o) && (s <= s')\n\n let mem p = function\n | E -> false\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.097071,"delta":9.300000000000974e-05,"body":["return",{"cursor":{"line":2051,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.097151,"delta":7.999999999999674e-05,"body":["tell","source"," | R (o, s) -> (o <= p) && (p <= o +. s)\n\n let equal b b' = b = b'\n let equal_f eq b b' = match b, b' with\n | E, E -> true\n | E, _ | _, E -> false\n | R (o, s), R (o', s') -> eq o o' && eq s s'\n\n let compare b b' = Pervasives.compare b b'\n let compare_f cmp b b' = match b, b' with\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.097258,"delta":0.00010699999999999599,"body":["return",{"cursor":{"line":2061,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09733,"delta":7.200000000000262e-05,"body":["tell","source"," | E, E -> 0\n | E, _ -> -1\n | _, E -> 1\n | R (o, s), R (o', s') ->\n let c = cmp o o' in if c <> 0 then c else\n let c = cmp s s' in c\n\n (* Printers *)\n\n let _print pp_f ppf b = match b with\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.097411,"delta":8.099999999999774e-05,"body":["return",{"cursor":{"line":2071,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.097501,"delta":9.000000000000674e-05,"body":["tell","source"," | E -> pp ppf \"@[<1>(box1@ empty)@]\"\n | R (o, s) ->\n pp ppf \"@[<1>(box2 %a@ %a)@]\" pp_f o pp_f s\n\n let pp ppf b = _print (fun ppf f -> Format.fprintf ppf \"%g\" f) ppf b\n let pp_f pp_f ppf b = _print pp_f ppf b\nend\n\nmodule Box2 = struct\n open V2t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.097592,"delta":9.099999999999386e-05,"body":["return",{"cursor":{"line":2081,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.097668,"delta":7.600000000000662e-05,"body":["tell","source"," type t = E | R of p2 * size2\n let dim = 2\n type v = v2\n type p = p2\n type size = size2\n type m = m2\n\n let err_e () = invalid_arg err_empty_box\n\n (* Constructors, accessors and constants *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09775600000000001,"delta":8.800000000000474e-05,"body":["return",{"cursor":{"line":2091,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.097843,"delta":8.699999999998986e-05,"body":["tell","source","\n let v o s = R (o, s)\n let v_mid m s =\n let o = P2.v (P2.x m -. 0.5 *. Size2.w s) (P2.y m -. 0.5 *. Size2.h s) in\n R (o, s)\n\n let empty = E\n let o = function E -> err_e () | R (o, _) -> o\n let ox = function E -> err_e () | R (o, _) -> o.x\n let oy = function E -> err_e () | R (o, _) -> o.y\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.09796400000000001,"delta":0.00012100000000000999,"body":["return",{"cursor":{"line":2101,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.09806000000000001,"delta":9.599999999999886e-05,"body":["tell","source"," let size = function E -> err_e () | R (_, size) -> size\n let w = function E -> err_e () | R (_, size) -> size.x\n let h = function E -> err_e () | R (_, size) -> size.y\n let zero = v P2.o Size2.zero\n let unit = v P2.o Size2.unit\n let of_pts p p' =\n let ox, w = if p.x < p'.x then p.x, p'.x -. p.x else p'.x, p.x -. p'.x in\n let oy, h = if p.y < p'.y then p.y, p'.y -. p.y else p'.y, p.y -. p'.y in\n v (P2.v ox oy) (Size2.v w h)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.099635,"delta":0.001574999999999993,"body":["return",{"cursor":{"line":2111,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.099748,"delta":0.00011300000000000199,"body":["tell","source"," (* Functions *)\n\n let min = o\n let minx = ox\n let miny = oy\n let max = function E -> err_e () | R (o, s) -> V2.add o s\n let maxx = function E -> err_e () | R (o, s) -> o.x +. s.x\n let maxy = function E -> err_e () | R (o, s) -> o.y +. s.y\n let mid = function\n | E -> err_e () | R (o, s) -> P2.v (o.x +. 0.5 *. s.x) (o.y +. 0.5 *. s.y)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.0999,"delta":0.00015199999999999936,"body":["return",{"cursor":{"line":2121,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.099993,"delta":9.299999999999586e-05,"body":["tell","source","\n let midx = function\n | E -> err_e () | R (o, s) -> o.x +. 0.5 *. s.x\n\n let midy = function\n | E -> err_e () | R (o, s) -> o.y +. 0.5 *. s.y\n\n let bl_pt = min\n let bm_pt = function E -> err_e () | R (o, s) -> P2.v (o.x +. 0.5 *. s.x) o.y\n let br_pt = function E -> err_e () | R (o, s) -> P2.v (o.x +. s.x) o.y\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.100132,"delta":0.00013900000000000023,"body":["return",{"cursor":{"line":2131,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10025300000000001,"delta":0.00012100000000000999,"body":["tell","source","\n let ml_pt = function E -> err_e () | R (o, s) -> P2.v o.x (o.y +. 0.5 *. s.y)\n let mm_pt = mid\n let mr_pt = function E -> err_e () | R (o, s) -> P2.v (o.x +. s.x)\n (o.y +. 0.5 *. s.y)\n let tl_pt = function E -> err_e () | R (o, s) -> P2.v o.x (o.y +. s.y)\n let tm_pt = function E -> err_e () | R (o, s) -> P2.v (o.x +. 0.5 *. s.x)\n (o.y +. s.y)\n let tr_pt = max\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.100394,"delta":0.00014099999999998836,"body":["return",{"cursor":{"line":2141,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10048800000000001,"delta":9.400000000001074e-05,"body":["tell","source"," let area = function E -> 0. | R (_, s) -> s.x *. s.y\n let inter b b' = match b, b' with\n | E, _ | _, E -> E\n | R (o, s), R (o', s') ->\n let l = o.x in let r = l +. s.x in\n let l' = o'.x in let r' = l' +. s'.x in\n if (r < l') || (r' < l) then E else\n let b = o.y in let t = b +. s.y in\n let b' = o'.y in let t' = b' +. s'.y in\n if (t < b') || (t' < b) then E else\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.100626,"delta":0.00013799999999998536,"body":["return",{"cursor":{"line":2151,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.100714,"delta":8.800000000000474e-05,"body":["tell","source"," let ox = if l > l' then l else l' in\n let oy = if b > b' then b else b' in\n let w = (if r < r' then r else r') -. ox in\n let h = (if t < t' then t else t') -. oy in\n v (P2.v ox oy) (Size2.v w h)\n\n let union b b' = match b, b' with\n | E, b | b, E -> b\n | R (o, s), R (o', s') ->\n let ox = if o.x < o'.x then o.x else o'.x in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.100843,"delta":0.0001290000000000041,"body":["return",{"cursor":{"line":2161,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.100925,"delta":8.199999999999874e-05,"body":["tell","source"," let oy = if o.y < o'.y then o.y else o'.y in\n let w =\n let r = o.x +. s.x in let r' = o'.x +. s'.x in\n (if r > r' then r else r') -. ox\n in\n let h =\n let t = o.y +. s.y in let t' = o'.y +. s'.y in\n (if t > t' then t else t') -. oy\n in\n v (P2.v ox oy) (Size2.v w h)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.101031,"delta":0.00010599999999999499,"body":["return",{"cursor":{"line":2171,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.101104,"delta":7.300000000000362e-05,"body":["tell","source","\n let inset d = function\n | E -> E\n | R (o, s) ->\n let o' = V2.add o d in\n let w = s.x -. 2. *. d.x in\n let h = s.y -. 2. *. d.y in\n if w < 0. || h < 0. then E else\n v o' (Size2.v w h)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.101186,"delta":8.199999999999874e-05,"body":["return",{"cursor":{"line":2181,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10127,"delta":8.400000000000074e-05,"body":["tell","source"," let round = function\n | E -> E\n | R (o, s) ->\n let ox = floor o.x in\n let oy = floor o.y in\n let w = if (s.x = 0. && ox <> o.x) then 1. else ceil s.x in\n let h = if (s.y = 0. && oy <> o.y) then 1. else ceil s.y in\n v (P2.v ox oy) (Size2.v w h)\n\n let move d = function E -> E | R (o, s) -> v (V2.add o d) s\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10139100000000001,"delta":0.00012100000000000999,"body":["return",{"cursor":{"line":2191,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10148499999999999,"delta":9.399999999998299e-05,"body":["tell","source","\n let tr_rect o s tr =\n let r = o.x +. s.x in\n let t = o.y +. s.y in\n let c0 = tr o in\n let c1 = tr (P2.v r o.y) in\n let c2 = tr (P2.v o.x t) in\n let c3 = tr (P2.v r t) in\n let xmin1, xmax1 = if c0.x < c1.x then c0.x, c1.x else c1.x, c0.x in\n let xmin2, xmax2 = if c2.x < c3.x then c2.x, c3.x else c3.x, c2.x in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.103106,"delta":0.0016210000000000113,"body":["return",{"cursor":{"line":2201,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.103252,"delta":0.00014599999999999336,"body":["tell","source"," let ox = if xmin1 < xmin2 then xmin1 else xmin2 in\n let w = (if xmax1 > xmax2 then xmax1 else xmax2) -. ox in\n let ymin1, ymax1 = if c0.y < c1.y then c0.y, c1.y else c1.y, c0.y in\n let ymin2, ymax2 = if c2.y < c3.y then c2.y, c3.y else c3.y, c2.y in\n let oy = if ymin1 < ymin2 then ymin1 else ymin2 in\n let h = (if ymax1 > ymax2 then ymax1 else ymax2) -. oy in\n v (P2.v ox oy) (Size2.v w h)\n\n let ltr m = function E -> E | R (o, s) -> tr_rect o s (V2.ltr m)\n let tr m = function E -> E | R (o, s) -> tr_rect o s (P2.tr m)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.103439,"delta":0.0001870000000000066,"body":["return",{"cursor":{"line":2211,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10352700000000001,"delta":8.800000000000474e-05,"body":["tell","source"," let map_f f = function E -> E | R (o, s) -> v (V2.map f o) (V2.map f s)\n\n (* Predicates and comparisons *)\n\n let is_empty = function E -> true | R _ -> false\n let is_pt = function E -> false | R (_, s) -> s.x = 0. && s.y = 0.\n let is_seg = function\n | E -> false\n | R (_, s) -> (s.x = 0. && s.y <> 0.) || (s.x <> 0. && s.y = 0.)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.103666,"delta":0.00013899999999998636,"body":["return",{"cursor":{"line":2221,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.103774,"delta":0.00010800000000001087,"body":["tell","source"," let isects b b' = match b, b' with\n | E, _ | _, E -> false\n | R (o, s), R (o', s') ->\n let l = o.x in let r = l +. s.x in\n let l' = o'.x in let r' = l' +. s'.x in\n if (r < l') || (r' < l) then false else\n let b = o.y in let t = b +. s.y in\n let b' = o'.y in let t' = b' +. s'.y in\n if (t < b') || (t' < b) then false else\n true\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.103908,"delta":0.00013399999999999523,"body":["return",{"cursor":{"line":2231,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10399599999999999,"delta":8.799999999999086e-05,"body":["tell","source","\n let subset b b' = match b, b' with\n | b, E -> false\n | E, b -> true\n | R (o, s), R (o', s') ->\n (o'.x <= o.x) && (o'.y <= o.y) && (s.x <= s'.x) && (s.y <= s'.y)\n\n let mem p = function\n | E -> false\n | R (o, s) ->\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10411699999999999,"delta":0.00012099999999999611,"body":["return",{"cursor":{"line":2241,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10420700000000001,"delta":9.000000000002062e-05,"body":["tell","source"," (o.x <= p.x) && (p.x <= o.x +. s.x) &&\n (o.y <= p.y) && (p.y <= o.y +. s.y)\n\n let equal b b' = b = b'\n let equal_f eq b b' = match b, b' with\n | E, E -> true\n | E, _ | _, E -> false\n | R (o, s), R (o', s') -> V2.equal_f eq o o' && V2.equal_f eq s s'\n\n let compare b b' = Pervasives.compare b b'\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10434299999999999,"delta":0.00013599999999998336,"body":["return",{"cursor":{"line":2251,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.104424,"delta":8.100000000001162e-05,"body":["tell","source"," let compare_f cmp b b' = match b, b' with\n | E, E -> 0\n | E, _ -> -1\n | _, E -> 1\n | R (o, s), R (o', s') ->\n let c = V2.compare_f cmp o o' in if c <> 0 then c else\n let c = V2.compare_f cmp s s' in c\n\n (* Printers *)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.104513,"delta":8.899999999999186e-05,"body":["return",{"cursor":{"line":2261,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.104592,"delta":7.900000000000962e-05,"body":["tell","source"," let _print pp_v2 ppf b = match b with\n | E -> pp ppf \"@[<1>(box2@ empty)@]\"\n | R (o, s) ->\n pp ppf \"@[<1>(box2 %a@ %a)@]\" pp_v2 o pp_v2 s\n\n let pp ppf b = _print V2.pp ppf b\n let pp_f pp_f ppf b = _print (V2.pp_f pp_f) ppf b\nend\n\nmodule Box3 = struct\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.104689,"delta":9.699999999999986e-05,"body":["return",{"cursor":{"line":2271,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10476099999999999,"delta":7.199999999998874e-05,"body":["tell","source"," open V3t\n type t = E | R of p3 * size3\n let dim = 3\n type v = v3\n type p = p3\n type size = size3\n type m = m3\n let err_e () = invalid_arg err_empty_box\n\n (* Constructors, accessors and constants *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.104833,"delta":7.200000000000262e-05,"body":["return",{"cursor":{"line":2281,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.104906,"delta":7.300000000000362e-05,"body":["tell","source","\n let v o s = R (o, s)\n let v_mid m s =\n let o = P3.v (P3.x m -. 0.5 *. Size3.w s)\n (P3.y m -. 0.5 *. Size3.h s)\n (P3.z m -. 0.5 *. Size3.d s)\n in\n R (o, s)\n\n let empty = E\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.104988,"delta":8.199999999999874e-05,"body":["return",{"cursor":{"line":2291,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.105085,"delta":9.699999999999986e-05,"body":["tell","source"," let o = function E -> err_e () | R (o, _) -> o\n let ox = function E -> err_e () | R (o, _) -> o.x\n let oy = function E -> err_e () | R (o, _) -> o.y\n let oz = function E -> err_e () | R (o, _) -> o.z\n let size = function E -> err_e () | R (_, size) -> size\n let w = function E -> err_e () | R (_, size) -> size.x\n let h = function E -> err_e () | R (_, size) -> size.y\n let d = function E -> err_e () | R (_, size) -> size.z\n let zero = v P3.o Size3.zero\n let unit = v P3.o Size3.unit\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.106516,"delta":0.0014310000000000017,"body":["return",{"cursor":{"line":2301,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.106634,"delta":0.00011800000000000699,"body":["tell","source"," let of_pts p p' =\n let ox, w = if p.x < p'.x then p.x, p'.x -. p.x else p'.x, p.x -. p'.x in\n let oy, h = if p.y < p'.y then p.y, p'.y -. p.y else p'.y, p.y -. p'.y in\n let oz, d = if p.z < p'.z then p.z, p'.z -. p.z else p'.z, p.z -. p'.z in\n v (P3.v ox oy oz) (Size3.v w h d)\n\n (* Functions *)\n\n let min = o\n let minx = ox\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.106783,"delta":0.00014899999999999636,"body":["return",{"cursor":{"line":2311,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.106917,"delta":0.00013399999999999523,"body":["tell","source"," let miny = oy\n let minz = oz\n let max = function E -> err_e () | R (o, s) -> V3.add o s\n let maxx = function E -> err_e () | R (o, s) -> o.x +. s.x\n let maxy = function E -> err_e () | R (o, s) -> o.y +. s.y\n let maxz = function E -> err_e () | R (o, s) -> o.z +. s.z\n let mid = function\n | E -> err_e () | R (o, s) ->\n P3.v (o.x +. 0.5 *. s.x) (o.y +. 0.5 *. s.y) (o.z +. 0.5 *. s.z)\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.107078,"delta":0.00016100000000000836,"body":["return",{"cursor":{"line":2321,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.107166,"delta":8.799999999999086e-05,"body":["tell","source"," let midx = function\n | E -> err_e () | R (o, s) -> o.x +. 0.5 *. s.x\n\n let midy = function\n | E -> err_e () | R (o, s) -> o.y +. 0.5 *. s.y\n\n let midz = function\n | E -> err_e () | R (o, s) -> o.z +. 0.5 *. s.z\n\n let fbl_pt = min\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10727300000000001,"delta":0.00010700000000000986,"body":["return",{"cursor":{"line":2331,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10738900000000001,"delta":0.00011600000000000499,"body":["tell","source"," let fbr_pt = function E -> err_e () | R (o, s) -> P3.v (o.x +. s.x) o.y o.z\n let ftl_pt = function E -> err_e () | R (o, s) -> P3.v o.x (o.y +. s.y) o.z\n let ftr_pt = function E -> err_e () | R (o, s) ->\n P3.v (o.x +. s.x) (o.y +. s.y) o.z\n\n let nbl_pt = function E -> err_e () | R (o, s) -> P3.v o.x o.y (o.z +. s.z)\n let nbr_pt = function E -> err_e () | R (o, s) ->\n P3.v (o.x +. s.x) o.y (o.z +. s.z)\n let ntl_pt = function E -> err_e () | R (o, s) ->\n P3.v o.x (o.y +. s.y) (o.z +. s.z)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10759500000000001,"delta":0.00020599999999999785,"body":["return",{"cursor":{"line":2341,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.107684,"delta":8.899999999999186e-05,"body":["tell","source"," let ntr_pt = max\n\n let area = function\n | E -> 0. | R (_, s) -> 2. *. (s.x *. s.y +. s.y *. s.z +. s.z *. s.x)\n\n let volume = function E -> 0. | R (_, s) -> s.x *. s.y *. s.z\n let inter b b' = match b, b' with\n | E, _ | _, E -> E\n | R (o, s), R (o', s') ->\n let l = o.x in let r = l +. s.x in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10780400000000001,"delta":0.00012000000000000899,"body":["return",{"cursor":{"line":2351,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10791400000000001,"delta":0.00010999999999999899,"body":["tell","source"," let l' = o'.x in let r' = l' +. s'.x in\n if (r < l') || (r' < l) then E else\n let b = o.y in let t = b +. s.y in\n let b' = o'.y in let t' = b' +. s'.y in\n if (t < b') || (t' < b) then E else\n let n = o.z in let f = n +. s.z in\n let n' = o'.z in let f' = n' +. s'.z in\n if (f < n') || (f' < n) then E else\n let ox = if l > l' then l else l' in\n let oy = if b > b' then b else b' in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10807,"delta":0.00015599999999998948,"body":["return",{"cursor":{"line":2361,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10816899999999999,"delta":9.899999999998799e-05,"body":["tell","source"," let oz = if n > n' then n else n' in\n let w = (if r < r' then r else r') -. ox in\n let h = (if t < t' then t else t') -. oy in\n let d = (if f < f' then f else f') -. oz in\n v (P3.v ox oy oz) (Size3.v w h d)\n\n let union b b' = match b, b' with\n | E, b | b, E -> b\n | R (o, s), R (o', s') ->\n let ox = if o.x < o'.x then o.x else o'.x in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10932800000000001,"delta":0.0011590000000000211,"body":["return",{"cursor":{"line":2371,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.109422,"delta":9.399999999999686e-05,"body":["tell","source"," let oy = if o.y < o'.y then o.y else o'.y in\n let oz = if o.z < o'.z then o.z else o'.z in\n let w =\n let r = o.x +. s.x in let r' = o'.x +. s'.x in\n (if r > r' then r else r') -. ox\n in\n let h =\n let t = o.y +. s.y in let t' = o'.y +. s'.y in\n (if t > t' then t else t') -. oy\n in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.10954699999999999,"delta":0.00012499999999998623,"body":["return",{"cursor":{"line":2381,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.10963700000000001,"delta":9.000000000002062e-05,"body":["tell","source"," let d =\n let f = o.z +. s.z in let f' = o'.z +. s'.z in\n (if f > f' then f else f') -. oz\n in\n v (P3.v ox oy oz) (Size3.v w h d)\n\n let inset d = function\n | E -> E\n | R (o, s) ->\n let o' = V3.add o d in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.109755,"delta":0.00011799999999999311,"body":["return",{"cursor":{"line":2391,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.109847,"delta":9.199999999999486e-05,"body":["tell","source"," let w = s.x -. 2. *. d.x in\n let h = s.y -. 2. *. d.y in\n let d = s.z -. 2. *. d.z in\n if w < 0. || h < 0. || d < 0. then E else\n v o' (Size3.v w h d)\n\n let round = function\n | E -> E\n | R (o, s) ->\n let ox = floor o.x in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.109962,"delta":0.00011500000000000399,"body":["return",{"cursor":{"line":2401,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.110064,"delta":0.00010199999999999099,"body":["tell","source"," let oy = floor o.y in\n let oz = floor o.z in\n let w = if (s.x = 0. && ox <> o.x) then 1. else ceil s.x in\n let h = if (s.y = 0. && oy <> o.y) then 1. else ceil s.y in\n let d = if (s.z = 0. && oz <> o.z) then 1. else ceil s.z in\n v (P3.v ox oy oz) (Size3.v w h d)\n\n let move d = function E -> E | R (o, s) -> v (V3.add o d) s\n\n let tr_box o s tr = (* that's a little bit ugly. *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.110203,"delta":0.00013900000000000023,"body":["return",{"cursor":{"line":2411,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.110296,"delta":9.300000000000974e-05,"body":["tell","source"," let r = o.x +. s.x in let t = o.y +. s.y in let f = o.z +. s.z in\n let c0 = tr o in\n let c1 = tr (P3.v o.x o.y f) in\n let c2 = tr (P3.v o.x t o.z) in\n let c3 = tr (P3.v o.x t f) in\n let c4 = tr (P3.v r o.y o.z) in\n let c5 = tr (P3.v r o.y f) in\n let c6 = tr (P3.v r t o.z) in\n let c7 = tr (P3.v r t f) in\n let xmin1, xmax1 = if c0.x < c1.x then c0.x, c1.x else c1.x, c0.x in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.11044799999999999,"delta":0.00015199999999998548,"body":["return",{"cursor":{"line":2421,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.110563,"delta":0.00011500000000000399,"body":["tell","source"," let xmin2, xmax2 = if c2.x < c3.x then c2.x, c3.x else c3.x, c2.x in\n let xmin3, xmax3 = if c4.x < c5.x then c4.x, c5.x else c4.x, c5.x in\n let xmin4, xmax4 = if c6.x < c7.x then c6.x, c7.x else c6.x, c7.x in\n let xmin11 = if xmin1 < xmin2 then xmin1 else xmin2 in\n let xmin12 = if xmin3 < xmin4 then xmin3 else xmin4 in\n let xmax11 = if xmax1 > xmax2 then xmax1 else xmax2 in\n let xmax12 = if xmax3 > xmax4 then xmax3 else xmax4 in\n let ox = if xmin11 < xmin12 then xmin11 else xmin12 in\n let w = (if xmax11 > xmax12 then xmax11 else xmax12) -. ox in\n let ymin1, ymax1 = if c0.y < c1.y then c0.y, c1.y else c1.y, c0.y in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.11073999999999999,"delta":0.0001769999999999966,"body":["return",{"cursor":{"line":2431,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.110854,"delta":0.00011400000000000299,"body":["tell","source"," let ymin2, ymax2 = if c2.y < c3.y then c2.y, c3.y else c3.y, c2.y in\n let ymin3, ymax3 = if c4.y < c5.y then c4.y, c5.y else c4.y, c5.y in\n let ymin4, ymax4 = if c6.y < c7.y then c6.y, c7.y else c6.y, c7.y in\n let ymin11 = if ymin1 < ymin2 then ymin1 else ymin2 in\n let ymin12 = if ymin3 < ymin4 then ymin3 else ymin4 in\n let ymax11 = if ymax1 > ymax2 then ymax1 else ymax2 in\n let ymax12 = if ymax3 > ymax4 then ymax3 else ymax4 in\n let oy = if ymin11 < ymin12 then ymin11 else ymin12 in\n let h = (if ymax11 > ymax12 then ymax11 else ymax12) -. oy in\n let zmin1, zmax1 = if c0.z < c1.z then c0.z, c1.z else c1.z, c0.z in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.111019,"delta":0.00016500000000001236,"body":["return",{"cursor":{"line":2441,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.111128,"delta":0.00010899999999999799,"body":["tell","source"," let zmin2, zmax2 = if c2.z < c3.z then c2.z, c3.z else c3.z, c2.z in\n let zmin3, zmax3 = if c4.z < c5.z then c4.z, c5.z else c4.z, c5.z in\n let zmin4, zmax4 = if c6.z < c7.z then c6.z, c7.z else c6.z, c7.z in\n let zmin11 = if zmin1 < zmin2 then zmin1 else zmin2 in\n let zmin12 = if zmin3 < zmin4 then zmin3 else zmin4 in\n let zmax11 = if zmax1 > zmax2 then zmax1 else zmax2 in\n let zmax12 = if zmax3 > zmax4 then zmax3 else zmax4 in\n let oz = if zmin11 < zmin12 then zmin11 else zmin12 in\n let d = (if zmax11 > zmax12 then zmax11 else zmax12) -. oz in\n v (P3.v ox oy oz) (Size3.v w h d)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.114166,"delta":0.003037999999999999,"body":["return",{"cursor":{"line":2451,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.114309,"delta":0.00014299999999999036,"body":["tell","source","\n let ltr m = function E -> E | R (o, s) -> tr_box o s (V3.ltr m)\n let tr m = function E -> E | R (o, s) -> tr_box o s (P3.tr m)\n let map_f f = function E -> E | R (o, s) -> v (V3.map f o) (V3.map f s)\n\n (* Predicates and comparisons *)\n\n let is_empty = function E -> true | R _ -> false\n let is_pt = function E -> false | R (_, s) -> s.x = 0. && s.y = 0. && s.z = 0.\n let is_plane = function\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.114483,"delta":0.00017400000000000748,"body":["return",{"cursor":{"line":2461,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.114566,"delta":8.299999999999974e-05,"body":["tell","source"," | E -> false\n | R (_, s) ->\n (s.x = 0. && s.y <> 0. && s.z <> 0.) ||\n (s.x <> 0. && s.y = 0. && s.z <> 0.) ||\n (s.x <> 0. && s.y <> 0. && s.z = 0.)\n\n let is_seg = function\n | E -> false\n | R (_, s) ->\n (s.x = 0. && s.y = 0. && s.z <> 0.) ||\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.11468600000000001,"delta":0.00012000000000000899,"body":["return",{"cursor":{"line":2471,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.11479999999999999,"delta":0.00011399999999997523,"body":["tell","source"," (s.x = 0. && s.y <> 0. && s.z = 0.) ||\n (s.x <> 0. && s.y = 0. && s.z = 0.)\n\n let isects b b' = match b, b' with\n | E, _ | _, E -> false\n | R (o, s), R (o', s') ->\n let l = o.x in let r = l +. s.x in\n let l' = o'.x in let r' = l' +. s'.x in\n if (r < l') || (r' < l) then false else\n let b = o.y in let t = b +. s.y in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.114945,"delta":0.0001450000000000201,"body":["return",{"cursor":{"line":2481,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.115032,"delta":8.699999999998986e-05,"body":["tell","source"," let b' = o'.y in let t' = b' +. s'.y in\n if (t < b') || (t' < b) then false else\n let n = o.z in let f = n +. s.z in\n let n' = o'.z in let f' = n' +. s'.z in\n if (f < n') || (f' < n) then false else\n true\n\n let subset b b' = match b, b' with\n | b, E -> false\n | E, b -> true\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.11513899999999999,"delta":0.00010699999999999599,"body":["return",{"cursor":{"line":2491,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.115228,"delta":8.900000000000574e-05,"body":["tell","source"," | R (o, s), R (o', s') ->\n (o'.x <= o.x) && (o'.y <= o.y) && (o'.z <= o.z) &&\n (s.x <= s'.x) && (s.y <= s'.y) && (s.z <= s'.z)\n\n let mem p = function\n | E -> false\n | R (o, s) ->\n (o.x <= p.x) && (p.x <= o.x +. s.x) &&\n (o.y <= p.y) && (p.y <= o.y +. s.y) &&\n (o.z <= p.z) && (p.z <= o.z +. s.z)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.115357,"delta":0.0001290000000000041,"body":["return",{"cursor":{"line":2501,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.115436,"delta":7.899999999999574e-05,"body":["tell","source","\n let equal b b' = b = b'\n let equal_f eq b b' = match b, b' with\n | E, E -> true\n | E, _ | _, E -> false\n | R (o, s), R (o', s') -> V3.equal_f eq o o' && V3.equal_f eq s s'\n\n let compare b b' = Pervasives.compare b b'\n let compare_f cmp b b' = match b, b' with\n | E, E -> 0\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.11554,"delta":0.00010400000000000686,"body":["return",{"cursor":{"line":2511,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.115618,"delta":7.799999999999474e-05,"body":["tell","source"," | E, _ -> -1\n | _, E -> 1\n | R (o, s), R (o', s') ->\n let c = V3.compare_f cmp o o' in if c <> 0 then c else\n let c = V3.compare_f cmp s s' in c\n\n (* Printers *)\n\n let _print pp_v3 ppf b = match b with\n | E -> pp ppf \"@[<1>(box3@ empty)@]\"\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.115708,"delta":9.000000000000674e-05,"body":["return",{"cursor":{"line":2521,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.115782,"delta":7.399999999999074e-05,"body":["tell","source"," | R (o, s) ->\n pp ppf \"@[<1>(box3 %a@ %a)@]\" pp_v3 o pp_v3 s\n\n let pp ppf b = _print V3.pp ppf b\n let pp_f pp_f ppf b = _print (V3.pp_f pp_f) ppf b\nend\n\ntype box1 = Box1.t\ntype box2 = Box2.t\ntype box3 = Box3.t\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.11587599999999999,"delta":9.399999999999686e-05,"body":["return",{"cursor":{"line":2531,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.11594000000000002,"delta":6.400000000002237e-05,"body":["tell","source","\n(* Colors *)\n\ntype color = V4.t\n\nmodule Color = struct\n\n (* Constructors, accessors and constants *)\n\n type t = color\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.115996,"delta":5.5999999999986616e-05,"body":["return",{"cursor":{"line":2541,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.116068,"delta":7.200000000000262e-05,"body":["tell","source"," type stops = (float * t) list\n\n let v = V4.v\n let r = V4.x\n let g = V4.y\n let b = V4.z\n let a = V4.w\n let void = v 0. 0. 0. 0.\n let black = v 0. 0. 0. 1.\n let white = v 1. 1. 1. 1.\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.11875999999999999,"delta":0.002691999999999986,"body":["return",{"cursor":{"line":2551,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.11887500000000001,"delta":0.00011500000000001787,"body":["tell","source"," let red = v 1. 0. 0. 1.\n let green = v 0. 1. 0. 1.\n let blue = v 0. 0. 1. 1.\n\n (* Functions *)\n\n let blend c c' =\n let a = c.V4t.w in\n let a' = c'.V4t.w in\n let mul = (1. -. a) *. a' in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.118971,"delta":9.599999999998499e-05,"body":["return",{"cursor":{"line":2561,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.119054,"delta":8.299999999999974e-05,"body":["tell","source"," let a'' = a +. mul in\n if a'' < gg_eps then void else\n v ((a *. c.V4t.x +. mul *. c'.V4t.x) /. a'')\n ((a *. c.V4t.y +. mul *. c'.V4t.y) /. a'')\n ((a *. c.V4t.z +. mul *. c'.V4t.z) /. a'')\n a''\n\n let clamp c =\n let clamp = ref false in\n let r =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.119166,"delta":0.00011200000000000099,"body":["return",{"cursor":{"line":2571,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.119268,"delta":0.00010200000000000486,"body":["tell","source"," if c.V4t.x < 0. then (clamp := true; 0.) else\n if c.V4t.x > 1. then (clamp := true; 1.) else c.V4t.x\n in\n let g =\n if c.V4t.y < 0. then (clamp := true; 0.) else\n if c.V4t.y > 1. then (clamp := true; 1.) else c.V4t.y\n in\n let b =\n if c.V4t.z < 0. then (clamp := true; 0.) else\n if c.V4t.z > 1. then (clamp := true; 1.) else c.V4t.z\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.119392,"delta":0.0001239999999999991,"body":["return",{"cursor":{"line":2581,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.119472,"delta":7.999999999999674e-05,"body":["tell","source"," in\n let a =\n if c.V4t.w < 0. then (clamp := true; 0.) else\n if c.V4t.w > 1. then (clamp := true; 1.) else c.V4t.w\n in\n if !clamp then v r g b a else c\n\n let with_a c a = { c with V4t.w = a }\n\n (* Color conversions *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.119577,"delta":0.00010500000000000786,"body":["return",{"cursor":{"line":2591,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.119657,"delta":7.999999999999674e-05,"body":["tell","source","\n (* sRGB\n N.B. sRGB equations from IEC 61966-2-1:1999, those of the w3c document\n are wrong. *)\n\n type srgb = v4\n let c0 = 0.04045\n let c1 = 1. /. 12.92\n let c2 = 0.055\n let c3 = 1. /. 1.055\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.11971200000000001,"delta":5.500000000001337e-05,"body":["return",{"cursor":{"line":2601,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.11981900000000001,"delta":0.00010699999999999599,"body":["tell","source"," let c4 = 2.4\n let of_srgb c = (* N.B. code duplication with gray. *)\n let r = V4t.(if c.x <= c0 then c1 *. c.x else (c3 *. (c.x +. c2)) ** c4) in\n let g = V4t.(if c.y <= c0 then c1 *. c.y else (c3 *. (c.y +. c2)) ** c4) in\n let b = V4t.(if c.z <= c0 then c1 *. c.z else (c3 *. (c.z +. c2)) ** c4) in\n v r g b c.V4t.w\n\n let v_srgb ?(a = 1.) r' g' b' = (* N.B. code duplication with of_srgba. *)\n let r = V4t.(if r' <= c0 then c1 *. r' else (c3 *. (r' +. c2)) ** c4) in\n let g = V4t.(if g' <= c0 then c1 *. g' else (c3 *. (g' +. c2)) ** c4) in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.120009,"delta":0.00018999999999999573,"body":["return",{"cursor":{"line":2611,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.120096,"delta":8.699999999998986e-05,"body":["tell","source"," let b = V4t.(if b' <= c0 then c1 *. b' else (c3 *. (b' +. c2)) ** c4) in\n v r g b a\n\n let v_srgbi ?a r g b =\n v_srgb ?a (float r /. 255.) (float g /. 255.) (float b /. 255.)\n\n let gray ?(a = 1.) l' = (* N.B. code duplication with of_srgb. *)\n let l = V4t.(if l' <= c0 then c1 *. l' else (c3 *. (l' +. c2)) ** c4) in\n v l l l a\n\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.120209,"delta":0.00011300000000000199,"body":["return",{"cursor":{"line":2621,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.120296,"delta":8.700000000000374e-05,"body":["tell","source"," let c0 = 0.0031308\n let c1 = 12.92\n let c2 = 1.055\n let c3 = 1. /. 2.4\n let c4 = 0.055\n let to_srgb c =\n let r = V4t.(if c.x <= c0 then c1 *. c.x else c2 *. (c.x ** c3) -. c4) in\n let g = V4t.(if c.y <= c0 then c1 *. c.y else c2 *. (c.y ** c3) -. c4) in\n let b = V4t.(if c.z <= c0 then c1 *. c.z else c2 *. (c.z ** c3) -. c4) in\n v r g b c.V4t.w\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.120417,"delta":0.00012099999999999611,"body":["return",{"cursor":{"line":2631,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.12048700000000001,"delta":7.00000000000145e-05,"body":["tell","source","\n (* CIE Luv *)\n\n type luv = v4\n let eps = (6. /. 29.) ** 3.\n let eps_inv = 1. /. eps\n let c0 = 1. /. 3.\n let u'n = 0.1978398\n let v'n = 0.4683363\n let _to_luv ~lch c =\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.12055199999999999,"delta":6.499999999998174e-05,"body":["return",{"cursor":{"line":2641,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.12065700000000001,"delta":0.00010500000000002174,"body":["tell","source"," let x = V4t.(0.4124564 *. c.x +.0.3575761 *. c.y +. 0.1804375 *. c.z) in\n let y = V4t.(0.2126729 *. c.x +.0.7151522 *. c.y +. 0.0721750 *. c.z) in\n let z = V4t.(0.0193339 *. c.x +.0.1191920 *. c.y +. 0.9503041 *. c.z) in\n let xyz = x +. 15. *. y +. 3. *. z in\n let u' = 4. *. x /. xyz and v' = 9. *. y /. xyz in\n (* yn = 1.0 *)\n let l = if y > eps then 116. *. (y ** c0) -. 16. else 8. *. eps_inv *. y in\n let l13 = 13. *. l in\n let u = l13 *. (u' -. u'n) and v = l13 *. (v' -. v'n) in\n if not lch then V4.v l u v c.V4t.w else\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.123513,"delta":0.0028559999999999836,"body":["return",{"cursor":{"line":2651,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.123624,"delta":0.00011099999999999999,"body":["tell","source"," let h =\n let h = (atan2 v u) in\n if h < 0. then h +. Float.two_pi else h\n in\n V4.v l (sqrt (u *. u +. v *. v)) h c.V4t.w\n\n let _of_luv ~lch c =\n let l = c.V4t.x in\n let u = if lch then c.V4t.y *. (cos c.V4t.z) else c.V4t.y in\n let v = if lch then c.V4t.y *. (sin c.V4t.z) else c.V4t.z in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.123786,"delta":0.00016199999999999548,"body":["return",{"cursor":{"line":2661,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.123902,"delta":0.00011600000000000499,"body":["tell","source"," let l13 = 13. *. l in\n if l13 < gg_eps then V4.v 0. 0. 0. c.V4t.w else\n let u' = u /. l13 +. u'n and v' = v /. l13 +. v'n in\n let y = if l <= 8. then l *. eps /. 8. else ((l +. 16.) /. 116.) ** 3. in\n let x = y *. 9. *. u' /. (4. *. v')\n and z = y *. (12. -. 3. *. u' -. 20. *. v') /. (4. *. v') in\n V4.v\n ( 3.2404548 *. x -. 1.5371389 *. y -. 0.4985315 *. z)\n (-0.9692664 *. x +. 1.8760109 *. y +. 0.0415561 *. z)\n ( 0.0556434 *. x -. 0.2040259 *. y +. 1.0572252 *. z)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.124058,"delta":0.00015600000000000336,"body":["return",{"cursor":{"line":2671,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.124138,"delta":7.999999999999674e-05,"body":["tell","source"," c.V4t.w\n\n let of_luv c = _of_luv ~lch:false c\n let to_luv c = _to_luv ~lch:false c\n\n (* CIE L*C*h_uv *)\n\n type lch_uv = v4\n let of_lch_uv c = _of_luv ~lch:true c\n let to_lch_uv c = _to_luv ~lch:true c\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.12421499999999999,"delta":7.699999999999374e-05,"body":["return",{"cursor":{"line":2681,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.12429,"delta":7.500000000000562e-05,"body":["tell","source","\n (* CIE L*a*b* *)\n\n type lab = v4\n\n (* The matrix below is XrYrZrD50_of_RGB = scale * XYZD50_of_RGB.\n Compute the XYZD50_of_RGB matrix ourselves:\n D65 = CCT 6504\n D50 = as usual (ICC specified)\n Bradford matrix\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.124332,"delta":4.200000000000037e-05,"body":["return",{"cursor":{"line":2691,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.12442700000000001,"delta":9.500000000001174e-05,"body":["tell","source"," 5 fractional digits in the matrix\n scale = M3.scale (V3.div (V3.v 1. 1. 1.) d50)\n Then we match the results from LittleCMS better. *)\n let c0 = 1. /. 3.\n let c1 = 841. /. 108.\n let c2 = 4. /. 29.\n let _to_lab ?(lch = false) c =\n let xr = V4t.(0.4522795 *. c.x +.0.3993744 *. c.y +. 0.1483460 *. c.z) in\n let yr = V4t.(0.2225105 *. c.x +.0.7168863 *. c.y +. 0.0606032 *. c.z) in\n let zr = V4t.(0.0168820 *. c.x +.0.1176865 *. c.y +. 0.8654315 *. c.z) in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.124538,"delta":0.00011099999999998611,"body":["return",{"cursor":{"line":2701,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.12463099999999999,"delta":9.299999999999586e-05,"body":["tell","source"," let fx = if xr > eps then xr ** c0 else (c1 *. xr +. c2) in\n let fy = if yr > eps then yr ** c0 else (c1 *. yr +. c2) in\n let fz = if zr > eps then zr ** c0 else (c1 *. zr +. c2) in\n let l = 116. *. fy -. 16. in\n let a = 500. *. (fx -. fy) in\n let b = 200. *. (fy -. fz) in\n if not lch then V4.v l a b c.V4t.w else\n let h =\n let h = atan2 b a in\n if h < 0. then h +. Float.two_pi else h\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.124756,"delta":0.000125000000000014,"body":["return",{"cursor":{"line":2711,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.124836,"delta":7.999999999999674e-05,"body":["tell","source"," in\n V4.v l (sqrt (a *. a +. b *. b)) h c.V4t.w\n\n (* Matrix below is the inverse of the one above *)\n let eps' = 6. /. 29.\n let c0 = 108. /. 841.\n let c1 = 4. /. 29.\n let _of_lab ?(lch = false) c =\n let l = c.V4t.x in\n let a = if lch then c.V4t.y *. (cos c.V4t.z) else c.V4t.y in\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.124945,"delta":0.00010899999999999799,"body":["return",{"cursor":{"line":2721,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.125047,"delta":0.00010199999999999099,"body":["tell","source"," let b = if lch then c.V4t.y *. (sin c.V4t.z) else c.V4t.z in\n let fy = (l +. 16.) /. 116. in\n let fx = a /. 500. +. fy in\n let fz = fy -. b /. 200. in\n let fx' = if fx > eps' then fx *. fx *. fx else c0 *. (fx -. c1) in\n let fy' = if fy > eps' then fy *. fy *. fy else c0 *. (fy -. c1) in\n let fz' = if fz > eps' then fz *. fz *. fz else c0 *. (fz -. c1) in\n V4.v\n ( 3.0215932 *.fx' -. 1.6168777*.fy' -. 0.4047152 *. fz')\n (-0.9437222 *.fx' +. 1.9161365*.fy' +. 0.0275856 *. fz')\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.125185,"delta":0.00013799999999999923,"body":["return",{"cursor":{"line":2731,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.12526099999999998,"delta":7.599999999999274e-05,"body":["tell","source"," ( 0.0693906 *.fx' -. 0.2290271*.fy' +. 1.1596365 *. fz')\n c.V4t.w\n\n let of_lab c = _of_lab ~lch:false c\n let to_lab c = _to_lab ~lch:false c\n\n (* CIE L*C*h_ab *)\n\n type lch_ab = v4\n let of_lch_ab c = _of_lab ~lch:true c\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.125336,"delta":7.50000000000195e-05,"body":["return",{"cursor":{"line":2741,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.125417,"delta":8.099999999999774e-05,"body":["tell","source"," let to_lch_ab c = _to_lab ~lch:true c\n\n (* Color spaces *)\n\n type space = [\n | `XYZ | `Lab | `Luv | `YCbr | `Yxy | `RGB | `Gray | `HSV | `HLS\n | `CMYK | `CMY | `CLR2 | `CLR3 | `CLR4 | `CLR5 | `CLR6 | `CLR7\n | `CLR8 | `CLR9 | `CLRA | `CLRB | `CLRC | `CLRD | `CLRE | `CLRF ]\n\n let space_dim = function\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.125507,"delta":9.000000000000674e-05,"body":["return",{"cursor":{"line":2751,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.125593,"delta":8.600000000000274e-05,"body":["tell","source"," | `Gray -> 1\n | `CLR2 -> 2\n | `CLR3 | `XYZ | `Lab | `Luv | `YCbr | `Yxy | `RGB | `HSV | `HLS | `CMY -> 3\n | `CLR4 | `CMYK -> 4\n | `CLR5 -> 5 | `CLR6 -> 6 | `CLR7 -> 7 | `CLR8 -> 8 | `CLR9 -> 9\n | `CLRA -> 10 | `CLRB -> 11 | `CLRC -> 12 | `CLRD -> 13 | `CLRE -> 14\n | `CLRF -> 15\n\n let space_str = function\n | `XYZ -> \"XYZ\" | `Lab -> \"Lab\" | `Luv -> \"Lub\" | `YCbr -> \"YCbr\"\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.128367,"delta":0.0027739999999999987,"body":["return",{"cursor":{"line":2761,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.12851100000000001,"delta":0.00014400000000000523,"body":["tell","source"," | `Yxy -> \"Yxy\" | `RGB -> \"RGB\" | `Gray -> \"Gray\" | `HSV -> \"HSV\"\n | `HLS -> \"HLS\" | `CMYK -> \"CMYK\" | `CMY -> \"CMY\" | `CLR2 -> \"2CLR\"\n | `CLR3 -> \"3CLR\" | `CLR4 -> \"4CLR\" | `CLR5 -> \"5CLR\" | `CLR6 -> \"6CLR\"\n | `CLR7 -> \"7CLR\" | `CLR8 -> \"8CLR\" | `CLR9 -> \"9CLR\" | `CLRA -> \"ACLR\"\n | `CLRB -> \"BCLR\" | `CLRC -> \"CCLR\" | `CLRD -> \"DCLR\" | `CLRE -> \"ECLR\"\n | `CLRF -> \"FCLR\"\n\n let pp_space ppf s = pp ppf \"%s\" (space_str s)\n\n (* Color profiles *)\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.128652,"delta":0.00014099999999997448,"body":["return",{"cursor":{"line":2771,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.128786,"delta":0.000134000000000023,"body":["tell","source","\n type profile = { space : space; icc : string }\n\n let profile_of_icc icc = try\n let space =\n if String.length icc < 20 then failwith \"\" else\n match String.sub icc 16 4 with\n | \"XYZ \" -> `XYZ | \"Lab \" -> `Lab | \"Luv \" -> `Luv | \"YCbr\" -> `YCbr\n | \"Yxy \" -> `Yxy | \"RGB \" -> `RGB | \"GRAY\" -> `Gray | \"HSV \" -> `HSV\n | \"HLS \" -> `HLS | \"CMYK\" -> `CMYK | \"CMY \" -> `CMY | \"2CLR\" -> `CLR2\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.128914,"delta":0.00012799999999998923,"body":["return",{"cursor":{"line":2781,"col":0},"marker":true}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.12902,"delta":0.00010599999999999499,"body":["tell","source"," | \"3CLR\" -> `CLR3 | \"4CLR\" -> `CLR4 | \"5CLR\" -> `CLR5 | \"6CLR\" -> `CLR6\n | \"7CLR\" -> `CLR7 | \"8CLR\" -> `CLR8 | \"9CLR\" -> `CLR9 | \"ACLR\" -> `CLRA\n | \"BCLR\" -> `CLRB | \"CCLR\" -> `CLRC | \"DCLR\" -> `CLRD | \"ECLR\" -> `CLRE\n | \"FCLR\" -> `CLRF\n | _ -> failwith \"\"\n in\n Some { space; icc }\n with Failure _ -> None\n\n let profile_to_icc p = p.icc\n"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.129154,"delta":0.00013399999999999523,"body":["return",{"cursor":{"line":2791,"col":0},"marker":true}]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment