title: Getting local 2D coordinates of vertices of a planar polygon in 3D space
body: <p>I have several planar polygons that are defined by their vertices in 3D space. These polygons are rotated randomly in 3 Dimensions.</p>
  
  <p>Now I would like to work with each of these polygons vertices in their own local 2D space. I don't really care where the center of this local space is. I just need the x &amp; y axis to be orthogonal to the polygons normal.</p>
  
  <p>So for example, if i had a polygon that is a rectangle of width &amp; height 1, the Vertices could look like:</p>
  
  <pre><code>v1 = [-0.558013, -0.0334937, -0.433013]
  v2 = [0.308013, 0.466506, -0.433013]
  v3 = [-0.308013, -0.466506, 0.433013]
  v4 = [0.558013, 0.0334937, 0.433013]
  </code></pre>
  
  <p>but I would like them to look like this:</p>
  
  <pre><code>v1 = [0, 0]
  v2 = [0, 1]
  v3 = [1, 1]
  v4 = [1, 0]
  </code></pre>
  
  <p>So my question is, how do I convert each vertices 3D coordinates to local 2D coordinates?</p>