How to find the angle between two hyper planes?
2 views (last 30 days)
Show older comments
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]
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]
0 Comments
Accepted Answer
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]
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]
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,:))
N2 = null(P2 - P2(1,:))
(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 is the angle (in radians). We could also get it from
acos(N1'*N2)
which is just a dot product anyway.
0 Comments
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!