I have a 3d space containing two planes that may have any non-orthogonal relative orientation. In addition I have a line the intersects both planes. I am trying to compute an index of the "oblique-ness" of the intersecting line.

So far I have done as follows:

  1. find the surface normals of each plane.

  2. calculate the vector average of the normals, after inverting one

  3. calculate the angle between this average normal and the intersecting line

If the planes are parallel and the intersecting line is parallel to the surface normal, then the index equals 0.

If the planes are parallel and the line intersects at angle $\theta$, then the index equals $\theta$.

If the planes are not parallel and the line is parallel to one plane's normal and intersects the other plane with angle $\theta$, then the index is $\frac{\theta}{2}$.

Based on these trivial cases and my intuition, I think this index is telling me what I want to know. But my background is not in mathematics and I want to solicit opinions on what might be the best way to do this.

My matlab code is below. Thank you for any help.

EDIT: Response to John: My planes are roughly oriented towards each other, so I will always have to negate one of the normals. I utilized your suggestion as a more generalized operation. In addition, if I compute the angles and average them, then if the planes are parallel and the line is not parallel to a normal, the index yields 0. But in this case there is obliqueness I want to measure. As to what I'm getting at, If the planes were always parallel, then I would just use the angle between the intersecting line and the normal. I am trying to extend that to situations when the planes are not parallel. I suppose another index might be the length of the line segment between the planes, normalized by the average distance between the planes.

P_norm = P_norm./norm(P_norm); % normal of plane P
W_norm = W_norm./norm(W_norm); % normal of plane W
WP =  (W-P)./norm(W-P); % vector formed by the points on the plane where the line intersects
PW =  (P-W)./norm(P-W); % reverse of that vector

avg = -1*P_norm + W_norm;
if norm(avg) ~= 0
  avg = avg./norm(avg);

if dot(avg,WP) < 0
  index = atan2(norm(cross(avg,PW)), dot(avg,PW));
  index = atan2(norm(cross(avg,WP)), dot(avg,WP));

1 Answer 1


This seems pretty reasonable. It's not clear whether you're talking about oriented or unoriented planes, though. If I were doing this, I'd find the two normals, and then negate one if necessary to make the dot product positive, i.e., at line 3 I'd write

if (dot(P_norm, W_norm) < 0)
   P_norm = -P_norm

so that the result depended only on the planes, and not on their orientation.

I think that averaging the normals is probably not a great idea. I'd instead compute the two angles and average those things...but I don't know what you're really aiming at.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .