In the following the terms ‘cube’ and ‘plane’ are taken from the case when n=3.
‘Hyper-cube’ for [0, 1]^{n} and ‘hyper plane’ for an n−1 dimensional linear space would be more accurate.

The limitation that all components of the argument to c be positive is awkward. I think it is tricky but efficient to eliminate this restriction. This program eliminates this restriction.

H = {x | a∙x < 1} and C = [0, 1]^{n} = {(x_{1}, … x_{n}) | ∀j(0 < j ≤ n → 0 ≤ x_{j} ≤ 1)} and we seek the content and center of gravity of H∩C.
Linear function f(x) = a∙x is maximized on some vertex P of the cube.
It is clear that a coordinate of P is 1 iff the corresponding component of a is positive, and otherwise 0.
Here and in the code the sum of the positive components is p and of the negative components q.
If p < 1 at P then the f(x) < 1 at all vertices and H∩C = C and the calculation is trivial.
f(x) is minimized at the vertex Q which is opposite P.
f(P) = p and f(Q) = q and thus f(c) = (p+q)/2 where c is the cube center and thus midway between P and Q.
Note q ≤ 0 ≤ p and if p+q > 2 then the clip plane is closer to P and otherwise to Q.
To minimize the number of vertices we visit we change coordinates and adopt as origin the closer of P and Q to the clip plane.
The task is to find a new function g whose range is the same space which is 0 at the new origin and is some nonzero multiple of f, and such that f(x) = g(x) whenever f(x) = 1.
For each i, x'_{i} = x'_{i} if a[i]>0 and x'_{i} = 1 - x'_{i} otherwise.

I think I must have a name e_{j} for the points where the clip plane intercepts the coordinate axis j.
e_{j} = 1/a_{j}.

If a[1] < 0 and a[j] > 0 for j > 1 then we adopt the vertex at (1, 0, …, 0) as the new origin and use primes on the variables for the new coordinate system.
The new f' will be 0 at the new origin and 1 on the clip plane which is unmoved in this alias story.
x'_{1} = 1 − x_{1} and x'_{j} = x_{j} for j > 1.
e'_{1} = 1 − e_{1} and e'_{j} = e_{j} − a_{1}/a_{j} for j > 1.
Finally a'_{j} = 1/e'_{j}.
Perhaps we need not name e or e' in the code.

a'_{1} = 1/e'_{1} = 1/(1 - 1/a_{1})
= a_{1}/(a_{1} − 1)

a'_{j} = 1/(1/a_{j} − a_{1}/a_{j})
= a_{j}/(1 − a_{1})

There remains the following problems:

- Components near zero lead to cancelation errors.
- New origin should be the vertex nearest to clip plane.
- Recursion of
`cn`may be unnecessary.

We must now decide on notation. Is the argument to f a set of coordinates, or a point in the space?