I have an ordered pair of planes, meeting at a hinge at their intersection line. The planes and the line are oriented. I want a formula for the dihedral angle $\theta$, calculated as follows:

Orient everything so that the hinge is oriented along the positive $z$ axis. The two planes are now lines in the $xy$ plane. Measure the angle between them, starting at the first plane and rotating in the direction of the first plane's orientation until you hit the second plane.

There is the obvious formula $n_1\cdot n_2 = \cos \theta$, where $n_1$ and $n_2$ are the plane normals, but to determine the correct angle in $[0,2\pi]$ I then need to also look at $\sin \theta$. Is it possible to write down a single formula for $\theta$ in terms of the positions and orientations of the planes/line, differentiable whenever the angle lies in $(0,2\pi)$?

  • $\begingroup$ What exactly do you mean by "... Measure the angle between them, starting at the first plane and rotating in the direction of the first plane's orientation until you hit the second plane."? $\endgroup$
    – user11470
    Apr 24, 2012 at 20:15
  • $\begingroup$ @Bidit There is ambiguity in the angle between two lines in the plane. If I have two lines, colored white on one side and black on the other, I want the angle between the white side of the first line and the white side of the second line. I can draw a picture if it's still unclear. $\endgroup$
    – user7530
    Apr 24, 2012 at 20:18
  • $\begingroup$ Well then for that, you need to explicitly define which the "white" side is. By the use of the $\hat{\text{n}}$ $\endgroup$
    – user11470
    Apr 24, 2012 at 20:32

2 Answers 2


Here's a cross section of the situation, with two oriented planes. If you're rotating the red/green plane in the direction of its green side, does that mean clockwise or counterclockwise?

diagram with a red/green and a blue/orange plane

So I don't think you can use the orientation of the planes to fix an interpretation of the angle. However, you write that you have a preferred orientation of the line of intersection, and that sounds more promising.

Namely, you can decide to turn the first plane counterclockwise when looking in the preferred direction along the intersection line.

Somewhat tedious formula-churning implementation of this: Fix some point on the intersection line and consider the plane that is normal to it at that point. Equip that plane with an orthonormal coordinate system that creates a right-handed system together with the preferred direction of the intersection. The orthonormal coordinates create a parametric representation of the normal plane; compose that with the equations for the two original planes; that gives 2D equations within the normal plane for its intersection with the original plane. Now find the angle in the normal plane using standard 2D techniques (e.g as the difference of atan2 values).

Computationally slicker: You can find $|\cos\theta|$ by the dot product or normals in 3D without needing to project into a specific cross section; the only remaining information you need is whether to use $\theta_0$, $\pi-\theta_0$, $\theta_0-\pi$ or $-\theta_0$, where $\theta_0$ is the arccosine of the dot product. But you can actually distinguish between those four cases simply by the combination of (a) the sign of the dot product and (b) whether the cross product of the normals is parallel or antiparallel to the chosen direction of the intersection line. I'd probably make some embarassing mistake if I tried to work our exactly what the connection should be, but there are only 4! possible ways to do it anyway, so just figure it out with trial and error...

  • $\begingroup$ Yes, this seems promising. Do you have references to the standard 2D techniques? Is there a better formula than looking at $\cos\theta$, and then fixing the quadrant using $\sin\theta$? $\endgroup$
    – user7530
    Apr 24, 2012 at 21:33
  • $\begingroup$ See edit. ${}{}$ $\endgroup$ Apr 24, 2012 at 21:54

$a_1 x + b_1 y + c_1 z + d_1 = 0$ is the equation for the first plane. The normal to the plane is $(a_1,b_1,c_1)$. $a_2 x + b_2 y + c_2 z + d_2 = 0$ is the equation for the second plane. The normal to the second plane is $(a_2,b_2,c_2)$ Let $\alpha$ be the angle betweeen the two planes. Then, $\cos \alpha = |n_1 \cdot n_2| / \text{len}(n_1) \cdot \text{len}(n_2)$. The top has the absolute value of the cross product, and the bottom has the lengths of $n_1$ and $n_2$ normal vectors multiplied together. Take the $\arccos$ of both sides of the equation to remove the $cos$ on the left side.

Below is the link where I am getting my information from:


  • 4
    $\begingroup$ Your answer is pretty difficult to parse. Can you please familiarize yourself with MathJax, then edit your answer to make it more readable? $\endgroup$
    – Xander Henderson
    Sep 7, 2018 at 18:52
  • $\begingroup$ I did some minor editing to format your post using MathJax. Please revise my edit if I happened to change what you meant while doing so. $\endgroup$ Sep 7, 2018 at 21:49

You must log in to answer this question.

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