Mapping UV coordinates to a plane in 3D space

588 Views Asked by At

Suppose I have a quadrilateral ABCD in 3D space

A----------B \ \ \ \ \ \ C----------D

And two-dimensional coordinates (x,y), how can I "map" these coordinates onto ABCD to get 3D coordinates of the point on the quadrilateral.

For example, assuming that AC = 2, CD = 4,

  • (0,0) => A because A is the top-left
  • (4,2) => D because D is the bottom-right
  • (2,1) => The center of the quadrilateral on all axes

This question on Stack Overflow is more or less the exact opposite of what I want to do.

1

There are 1 best solutions below

0
On BEST ANSWER

You need the 3-D coordinates of the point that corresponds to $A$ and unit vectors $\vec u$ and $\vec v$ that point in the directions of the edges $\overline{AB}$ and $\overline{AC}$, respectively, i.e., $$\vec u = {B-A\over \|B-A\|} \\ \vec v = {C-A\over\|C-A\|}.$$ The mapping you seek is then $(x,y)\mapsto A+x\vec u+y\vec v$. This is one of the simplest examples of a parametric surface patch. It’s often more convenient to set $\vec u=B-A$ and $\vec v=C-A$ so that the patch coordinates all lie in the interval $[0,1]$.