Description
Hello,
I have notice something strange in the definition of "generate_planes" and "project_onto_planes". If I have well understood, you define three transfer matrices in "generate_planes" that are used to project coordinates in "project_onto_planes" before to keep only the first two coordinates of your projection.
Problem:
B=2
N_rays=11
coordinates= torch.randn(B,N_rays,3)
planes = generate_planes()
out = project_onto_planes(planes, coordinates)
If we set P=coordinates[0][0], since out[:3,0,:] is the projection, it is supposed to return:
[P[0], P[1]]
[P[1], P[2]]
[P[2], P[0]]
However, I got:
[P[0], P[1]]
[P[0], P[2]]
[P[2], P[0]]
If you prefer, I have: [(X,Y), (X,Z), (Z,X)]
Reason:
If I am right, I have found the reason. You defined planes by the following matrices:
[[1, 0, 0],[0, 1, 0],[0, 0, 1]]
[[1, 0, 0],[0, 0, 1],[0, 1, 0]]
[[0, 0, 1],[1, 0, 0],[0, 1, 0]]
Let us call the matrices M1, M2 and M3. Their inverts are:
[[1, 0, 0],
M1^{-1} = [0, 1, 0],
[0, 0, 1]]
[[1, 0, 0],
M2^{-1} = [0, 0, 1],
[0, 1, 0]]
[[0, 1, 0],
M3^{-1} = [0, 0, 1],
[1, 0, 0]]
If I have a point P=(X,Y,Z), I got:
P @ M1^{-1} = (X,Y,Z)
P @ M2^{-1} = (X,Z,Y)
P @ M3^{-1} = (Z,X,Y)
Then, if I keep only the two coordinates, I have: [(X,Y), (X,Z), (Z,X)]
Possible solution:
Update "generate_planes" to:
torch.tensor([[[1, 0, 0],[0, 1, 0],[0, 0, 1]],
[[0, 1, 0],[0, 0, 1],[1, 0, 0]],
[[0, 0, 1],[1, 0, 0],[0, 1, 0]]
], dtype=torch.float32)
Do not hesitate to tell me if I am misunderstanding something.