My program is getting the wrong answer and I want verification of the calculation. This derivation is based on analytic geometry whereas this is Euclidean.

A semi-cube is ½ of [0, 1]n divided thus: The plane Σxj = n/2 bisects the cube [0, 1]n.
Q = {x | 1≤j≤n → xj>0}.
H = {x | Σxj < n/2}.
B = Q∩H. B is a simplex and its centroid is the centroid of its n+1 vertices.
If z is a vector and S is a set then S + z = {s+z | s ∈ S}.

For n=3 I want the centroid of the semi-cube on the origin side of the plane. That semi-cube is
Q ∩ ∼((Q+(0,0,1))∪(Q+(0,1,0))∪(Q+(1,0,0))) ∩ H. Moment-1 about the origin of the semi-cube is its centroid times its volume which is ½. B is a simplex and its centroid is the centroid of its vertices = ¼(3/2, 3/2, 3/2) = (⅜, ⅜, ⅜). (A) B’s volume is (3/2)3/6 = 9/16. (A)
Moment-1 of B is (27/128, 27/128, 27/128).

(Q+(0,0,1)) ∩ H is a simplex, similar to B, with vertices at (0, 0, 1), (0, 0, 3/2), (0, ½, 1), (½, 0, 1). Its centroid is at (⅛, ⅛, 9/8). The centroids of the three congruent simplexes are (⅛, ⅛, 9/8), (⅛, 9/8, ⅛), (9/8, ⅛, ⅛). Their mutual centroid is (11/24, 11/24, 11/24). Each volume is 1/48 and their total volume is 1/16.
Their collective moment-1 is (11/384, 11/384, 11/384).

The moment-1 of the semi-cube is the difference = (35/192, 35/192, 35/192). The semi-cube’s volume is ½ and thus
The semi-cube’s centroid is (35/96, 35/96, 35/96).

The floating cube’s centroid is (½, ½, ½) and is at the water line.

```root(j)*(sl - (m OF s)/c OF s)

summit   |      WL   bottom
0        c      sl     1
--------------
vol     centroid             moment-1
B      0.5625   .375               0.2109375
3b     0.0625  0.4583333333333333  0.028645833333333332
SC     0.5     0.3645833333333333  0.18229166666666666```
(sqrt (* 3 (s (- 35/96 1/2)))) => 0.23454854685828547 (distance of SC centroid above water)
Consider the body diagonal from (0, 0, …) to (1, 1, …).