7
$\begingroup$

I am writing a program where I would like to allow the user to draw 4 connecting lines, such as:

image of arbitrary quadrilateral

And convert this shape into a 3D plane. Is this possible? Is there an existing algorithm to do so? If not, any idea of the steps I should be taking?

Things we can assume: the camera is at $0,0,0$, facing $[0,0,-1]$. The plane we create will be centered at $0$ on the $z$-axis.

Ideally I'd like the result to be in the form of a set of rotate, scale, translate vectors for a rectangle centered at $[0,0,0]$ of size $[1,1]$.

Please let me know if you need any more information. I don't really know where to start on this...

(I'm not sure if this question would be more suitable for stackoverflow or gamedev. If so, please feel free to move it. However the question is mainly math related so I'm going to try here first.)

  • 0
    How exactly should the quadrilateral describe a $3D$ plane? I assume the shape in $3D$ is supposed to be a rectangle, but is it supposed to be a square, as well? I don't think there is a unique projection that would render a rectangle to the quadrilateral above. Given the aspect ratio of the rectangle, then there is a unique (up to scaling) transformation that yields the given quadrilateral.2011-09-08
  • 0
    What is your end goal? If you want the user's (2D) shape to be interpreted as a plane in 3-space, I think you're going to have to make some additional assumptions. As it stands, the sketch you provided could be a rectangle angled away from the camera, or a trapezoid parallel to the plane of the camera. More specifically I suppose, what role does the rectangle at at (0,0,0) play?2011-09-08
  • 0
    Yes, the drawn shape is assumed to be a rectangle. What I'd like ideally is to find a transformation that will transform the square at [0,0,0] to give the projected outline drawn by the user. Does that help?2011-09-08
  • 0
    I think it is a computer vision problem. The user drawn outline is the perspective projection of the 3D rectangle. But if the camera is centered at (0,0,0), how can the 3D rectangle be too? You need to determine the image plane of the camera first. The user drawn outline is on the image plane. Usually the image plane can be choose as $z=-1$.2011-09-09
  • 0
    Ah sorry Shiya - yes, of course the transformation will involve a translate away from the camera. You're right though when you say "The user drawn outline is the perspective projection of the 3D rectangle". This is the problem I'm attempting to solve. Please feel free to ignore the other specifications if you know how to solve this problem!2011-09-09
  • 0
    A key search word is **`"Homogenous coordinates"`**, check them up. More [here](http://en.wikipedia.org/wiki/Homogeneous_coordinates) or [here](http://math.aalto.fi/~ahniemi/hss2012/Notes02.pdf).2012-09-13

2 Answers 2