title: How can I calculate the 3D angle between two points?
body: <p>Let's say I have two vertices and I want to know the 3D angle between the two. By 3D angle, I mean the angle between the one vertex and another on each of the three dimensional planes, stored as </p>
  
  <pre><code>{ x, y, z }
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getAngleBetweenVertices(vert1, vert2){
    return {
      x: 0, // ?
      y: 0, // ?
      z: 0  // ?
    }
  }
  
  // Classes
  
  class Vertex {
    constructor(position){
      this.position = {
        x: 0,
        y: 0,
        z: 0,
        ...position
      };
    }
  }
  
  // Init
  
  let vert1 = new Vertex({ x: 1, y: 0, z: 1 });
  let vert2 = new Vertex({ x: 0, y: 1, z: 1 });
  let angle = getAngleBetweenVertices(vert1, vert2);
  console.log("angle ", angle);</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/9SGfq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9SGfq.png" alt="enter image description here"></a></p>
  
  <p>For example in the above image, I've traced over a line segment joining two vertices on a triangle. It should be possible to find the angle between the two vertex positions on the x, y, and z axis.</p>
  
  <p>How can I calculate the three dimensional angle between two vertices?</p>