title: Need help writing conversion methods between 2D and 3D (Point3DToPoint and PointAndZToPoint3D)
body: <p>I'm new to WPF 3D, so I may just be missing something obvious, but how do I convert from 3D to 2D and (for a given z location) from 2D to 3D?</p>
  
  <p>Specifically, I need two conversion methods:</p>
  
  <ul>
  <li><p><strong>Point3DToPoint</strong> - If I have an (x, y, z) coordinate in the 3D world, how do I determine the (x, y) coordinate on the projected 2D surface. Method signature: <code>public Point Point3DToPoint(Point3D point3D)</code></p></li>
  <li><p><strong>PointAndZToPoint3D</strong> - If I have an (x, y) coordinate on the projected 2D surface <em>and</em> a z location in the 3D world, how do I determine the (x, y, z) coordinate in the 3D world? Method signature: <code>public Point3D PointAndZToPoint3D(Point point, double z)</code></p></li>
  </ul>
  
  <p>I'd like the <strong>2D coordinate</strong> to be the location measured from the upper-left corner of <code>Viewport3D</code> and the <strong>3D coordinate</strong> to be the location relative to the origin (0, 0, 0) of the 3D world.</p>
  
  <p>Note 1: I found this <a href="https://stackoverflow.com/questions/724219/how-to-convert-a-3d-point-into-2d-perspective-projection">related question</a>, but it only addresses conversion from 3D to 2D (not the reverse), and I'm not sure if the answers are up-to-date.</p>
  
  <p>Note 2: I'm currently using .NET 3.5, but if there are improvements in .NET 4.0 that would help me, please let me know.</p>