See This for a prose description of facet bcc.

Assume n = 4 and reduced bcc systems and zero indexed arrays depicted as (a[0], a[1], a[2]).
A point in facet k has bcc for that facet. It also belongs to the zone and has a zone bcc. ex computes the zone bcc from the facet bcc. To think about the simple, yet messy logic in converting between facet bcc and zone bcc, lets find the zone bcc, z, given a facet bcc of f = (.2, .3, .4).
Assume that the ray entered on facet 1.

z = (.2, .0, .3, .4, .1)

These routines are defined in a context where then dimensionality of a zone is named n. For here we have:

let n = 4;; free parameter

let ex a k = let lv = 1. -. (Array.fold_left (+.) 0. a) in
  Array.init (n+1)
   (fun j -> if j < k then (if j < n-1 then a.(j) else lv)
     else if j=k then 0. else if j < n then a.(j-1) else lv);;

let f = ex [| 0.2; 0.3; 0.4 |] in
  (f 0, f 1, f 3, f 4);; => (
    [| 0.; 0.2; 0.3; 0.4 |],
    [| 0.2; 0.; 0.3; 0.4 |],
    [| 0.2; 0.3; 0.4; 0. |],
    [| 0.2; 0.3; 0.4; 0.0999999999999999778 |])
The opposite transformation is cm.
exception Problem;;
let cm z k = if k = n then 
(if abs_float ((Array.fold_left (+.) 0. z) -. 1.) > 0.0000000001 then raise Problem;
    Array.sub z 0 (n-1))
else (if (abs_float z.(k) > 0.00000000001) then raise Problem;
   Array.init (n-1) (fun j -> if j < k then z.(j) else z.(j+1)));;
To test:
let t i = let f = ex [| 0.2; 0.3; 0.4 |] in let z = f i in cm z i in
[t 0; t 1; t 2; t 3];;