3dgeometryquaternions

How to convert from 2D points to 3D points on a plane?


I have some 3D points on a plane. The plane is defined by normal and constant. I need to work with the points in 2D and then convert them back to 3D. In order to convert the points to 2D I made a quaternion to rotate the plane to the xy-plane and I can transform the points with that (simply discarding the z-coord). After modifying the points in 2D I want to convert them back to 3D. I noticed that the same quaternion, if inverted, rotates the point back but I need to translate it too somehow, involving the plane's constant, but I don't know how to do that. Thanks!


Solution

  • I assume that your plane is given in Hessian normal form, i.e., a point x lies on the plane iff:

    dot(n, x) - c = 0
    

    with the unit normal n.

    When you apply a rotation that aligns the plane parallel to the xy-plane to these points, they will have a z-component equal to c. Hence, to convert back from 2D to 3D, you simply need to add a z-component of c and apply the inverse rotation. Make sure that the above definition applies in your case. Sometimes, the form dot(n, x) + c = 0 is used, which would produce a z-component of -c.

    Note that this procedure is functionally suitable but computationally heavy. An alternative is to define a 3D basis on the plane and convert between 3D and 2D with this basis. You can find an example in this answer.