# Compute the angle between two points on a plane, given the normal vector of the plane

I have a 3d polyhedron for which I know the normal angle of each face.

I want to compute the bearing between two points on the same face, given their Cartesian coordinates.

My hunch was to use SVD to rotate to points into their natural axes,and extract the Euler angles in each dimension from the rotation matrix, which I have done. But I'm not really sure how (or if) to go from there.

EDIT: The bearing with respect to the plane. That is, if the the polyhedron was a cube who's edges were parallel to the axes, then the problem reduces to the 2D bearing, as discussed here becuase the two points would have equal values in one dimension. Essentially, I want to solve that problem when my plane is not the xy plane, but I know its normal.

EDIT2: If my surface were a sphere of known radius, I could compute the latitude and longitude from the Cartesian coordinates and then calculate the azimuth from one point to the other. I want a value analogous to the azimuth for a polyhedral surface, given that the points are on the same face.

• The bearing with respect to $(0,0,0)$? You just need the law of cosines for that if you know their three-space coordinates. Apr 3 '17 at 23:15
• It appears that you want the bearing of the line connecting two points on the face of the polyhedron as projected onto a plane in which compass points NSEW are defined rather than the "angle" between the two points as stated in your question title. Is that correct? Apr 3 '17 at 23:51
• Yes. I think that's right. If I lived on a polyhedral world and my compass always pointed to the North pole, what direction should I sail to get from one Cartesian waypoint to another (on the same face)? If the polyhedron were regular, pretending was a sphere would probably be adequate but it is not. Apr 4 '17 at 0:10

The "bearing" between two points $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$ depends upon the point $(x_0,y_0,z_0)$ from which one is taking the bearing.
If $\vec{u}=\langle x_1-x_0,y_1-y_0,z_1-z_0\rangle$ and $\vec{v}=\langle x_2-x_0,y_2-y_0,z_2-z_0\rangle$ then one only needs the law of cosines to find the angle $\theta$ between vectors $\vec{u}$ and $\vec{v}$.
$$\cos\theta=\frac{\vec{u}\cdot\vec{v}}{\Vert\vec{u}\Vert\cdot\Vert\vec{v}\Vert}$$