# How to find the angle between two hyper planes?

4 views (last 30 days)
M on 8 Feb 2023
Edited: John D'Errico on 8 Feb 2023
How to find the angle between two hyper planes?
for example the following two planes?
Plane 1
P1=[396326796.725069 -205153846.153846 0 0 0 0;
-205153846.153846 396326796.725069 -205153846.153846 0 0 0;
0 -205153846.153846 396326796.725069 -205153846.153846 0 0;
0 0 -205153846.153846 396326796.725069 -205153846.153846 0;
0 0 0 -205153846.153846 396326796.725069 -205153846.153846;
0 0 0 0 -205153846.153846 198163398.362534]
P2 = 6×6
1.0e+08 * 3.9633 -2.0515 0 0 0 0 -2.0515 3.9633 -2.0515 0 0 0 0 -2.0515 3.9633 -2.0515 0 0 0 0 -2.0515 3.9633 -2.0515 0 0 0 0 -2.0515 3.9633 -2.0515 0 0 0 0 -2.0515 1.9816
Plane 2
P2= [221899011.383328 -20515384.6153846 0 0 0 0;
-20515384.6153846 221899011.383328 -205153846.153846 0 0 0;
0 -205153846.153846 406537472.921789 -205153846.153846 0 0;
0 0 -205153846.153846 406537472.921789 -205153846.153846 0;
0 0 0 -205153846.153846 406537472.921789 -205153846.153846;
0 0 0 0 -205153846.153846 203268736.460895]
P2 = 6×6
1.0e+08 * 2.2190 -0.2052 0 0 0 0 -0.2052 2.2190 -2.0515 0 0 0 0 -2.0515 4.0654 -2.0515 0 0 0 0 -2.0515 4.0654 -2.0515 0 0 0 0 -2.0515 4.0654 -2.0515 0 0 0 0 -2.0515 2.0327

John D'Errico on 8 Feb 2023
Edited: John D'Errico on 8 Feb 2023
Will you please learn to use arrays? You have moved from 2-3 to now 6 dimensions in your questions. When you are one day trying to solve problems in 100 dimensions, will you then have hundreds of numbered and named variables? LEARN TO USE MATLAB!
P1=[396326796.725069 -205153846.153846 0 0 0 0;
-205153846.153846 396326796.725069 -205153846.153846 0 0 0;
0 -205153846.153846 396326796.725069 -205153846.153846 0 0;
0 0 -205153846.153846 396326796.725069 -205153846.153846 0;
0 0 0 -205153846.153846 396326796.725069 -205153846.153846;
0 0 0 0 -205153846.153846 198163398.362534]
P1 = 6×6
1.0e+08 * 3.9633 -2.0515 0 0 0 0 -2.0515 3.9633 -2.0515 0 0 0 0 -2.0515 3.9633 -2.0515 0 0 0 0 -2.0515 3.9633 -2.0515 0 0 0 0 -2.0515 3.9633 -2.0515 0 0 0 0 -2.0515 1.9816
P2= [221899011.383328 -20515384.6153846 0 0 0 0;
-20515384.6153846 221899011.383328 -205153846.153846 0 0 0;
0 -205153846.153846 406537472.921789 -205153846.153846 0 0;
0 0 -205153846.153846 406537472.921789 -205153846.153846 0;
0 0 0 -205153846.153846 406537472.921789 -205153846.153846;
0 0 0 0 -205153846.153846 203268736.460895]
P2 = 6×6
1.0e+08 * 2.2190 -0.2052 0 0 0 0 -0.2052 2.2190 -2.0515 0 0 0 0 -2.0515 4.0654 -2.0515 0 0 0 0 -2.0515 4.0654 -2.0515 0 0 0 0 -2.0515 4.0654 -2.0515 0 0 0 0 -2.0515 2.0327
So you have two planes in 6-dimensions. Defined by 6 points.
However, I see that in the second plane, you have copied the first row into the second row. So the second plane is actually degenerate. As such, the problem you wrote is impossible to solve.
If that were not the case, you would use linear algebra. If you fix the second plane, I'll show you how to solve it. The solution is actually easy enough. You can find it here, as long as you know the normal vectors to the planes. And how do you find the normal vector? (Hint: what does null do for you?)
EDIT:
With the fixed second set of points, we now have non-degenerate planes. I'll check that anyway. A plane is defined by the vector normal to the plane, and by ONE point in the plane. These vectors are normal to the plane. I found them by subtracting off one of the points (the first one) from all of the other rows.
N1 = null(P1 - P1(1,:))
N1 = 6×1
0.1383 0.2673 0.3780 0.4629 0.5163 0.5345
N2 = null(P2 - P2(1,:))
N2 = 6×1
0.0374 0.4040 0.4332 0.4545 0.4675 0.4718
(If the planes were degenerate at this point, then the nullspace of the set would have more than 1 column. So we know the planes are not degenerate. I could also have used rank to verify that fact, testing that the rank was only 5.)
How do we now find the angle between the planes? Simple. In the link I gave, it suggests the angle theta is given by the relation:
cos(theta) = dot(N1/norm(N1),N2/norm(N2)
Since null already returns unit 2-norm normalized vectors, we need not divide by the norms.
theta = acos(dot(N1,N2))
theta = 0.1961
theta is the angle (in radians). We could also get it from
acos(N1'*N2)
ans = 0.1961
which is just a dot product anyway.