4
$\begingroup$

Given a set $A$ of points in $\Bbb R^3$ enclosed in a sphere of radius $R1$, we put a point-light outside that enclosing sphere at a distance $D > 0$ from the sphere's surface (so that we are sure all the points can be projected on a plane).

Those points will project a shadow on a sheet, effectively creating a set $B$ of points in $\Bbb R^2$.

What I want to achieve is telling if the set $B$ of points in $\Bbb R^2$ is a projetion of the $A$ of points in $\Bbb R^3$.

And if yes:

  • find the transformation matrix that applied to all points of $A$, get $B$.
  • position of the point light in $\Bbb R^3$ (well if you have the transformation matrix you already probably have it, I just specified it beause I want to make clear that light position is unkown).

Some error is acceptable (in example all points of A can be offsetted by a small radius).

Note. the set A can be rotated and translated (like a solid object), and since we have a point light, the effective shadow of points is subject to a projective transform.

$A$ and $B$ are known. It is allowed to append to all elements of A a fourth element "1". (Because If I resemble correctly transformation matrices are 4x4 and to operate on "points" and not "directions" we must have the fourth element be 1 instead of 0: in this case the matrix would be 4x2 then I guess, or a 4x4 matrix which sets to 0 the 3rd and 4th element of the output whatever you find more comfortable).

  • 0
    I added an example. Are you able to reproduce my solution for the unknown light source?2017-02-15

3 Answers 3

1

Rotate and translate the plane, the point sets $A$ and $B$, and the unknown light source $L$ so that the plane is the $xy$ plane. You could use the rotation matrix $$ R = \left( \begin{array}{lll} n_x n_z/\sqrt{n_x^2 + n_y^2} & n_y n_z / \sqrt{n_x^2 + n_y^2} & -\sqrt{n_x^2+n_y^2} \\ -n_y/\sqrt{n_x^2+n_y^2} & n_x / \sqrt{n_x^2+n_y^2} & 0 \\ n_x & n_y & n_z \end{array} \right) $$ (where $n$ is the unit normal of the plane) to rotate the plane so that it is parallel to the $xy$ plane. Then subtract the $z$ coordinate of the plane to move the plane to the $xy$ plane.

The equation for the projected point $B_i$ in terms of $A_i$ is $$ B_i = A_i + t(A_i - L) $$ where $t$ is a positive number that can be computed by using the fact that the $z$ coordinate of $B_i$ ($B_{iz}$) is 0: $$ t = A_{iz}/(L_z - A_{iz}). $$ The equation can be rewritten as $$ B_i(L_z - A_{iz}) = A_i(L_z - A_{iz}) + A_{iz}(A_i - L), $$ a linear equation in $L.$

Some algebra shows that $$ \left( \begin{array}{lll} A_{iz} & 0 & B_{ix}-A_{ix}\\ 0 & A_{iz} & B_{iy}-A_{iy} \end{array} \right) L = A_{iz} B^{xy}_i \tag{1} \label{ref1} $$ where $B^{xy}_i$ is $B_i$ with the zero $z$ coordinate dropped. So with two points, this would result in two $2\times 2$ linear systems: one system for $L_x$ and $L_z$ and one system for $L_y$ and $L_z.$ The solution to both of these systems must have the same $L_z$ value if set $B$ is a projection of set $A.$ For $N\gt 2$ points, there will be two $N\times 2$ linear systems. So you would need to solve each system with the first two equations and then check that the next equations are consistent with that solution (and again check that both $L_z$ values are the same).

If there is error in your $B_i$ values, then a least squares solution for the unknown light position $L$ would be better. This would be the solution of an overdetermined system $ML = b$ where $M$ has $2N$ rows and three columns and $M$ and $b$ are formed using \eqref{ref1}. An example problem would be determining the distance of the full moon at apogee and an inclination of 45 degrees from the horizon (so a position of $(2.8666\times 10^{8}, 0, 2.8666\times 10^8)$ meters) by measuring the positions of shadows of three mountaintops at positions $(5\textrm{km},0,3\textrm{km}),$ $(5\textrm{km},5\textrm{km},2\textrm{km})$, and $(0, 5\textrm{km}, 1.5\textrm{km})$ to an accuracy of within 1 millimeter. Solving the least squares system formed from these three points (with uniform random errors in the range -1 to 1 millimeter added to the $x$ and $y$ coordinates of the $B_i$), I am getting a distance of $4.059\times 10^8$ meters (versus the true distance of $4.054\times 10^8$ meters).

  • 0
    Thanks it seems to works :) If I have any problem I'll reopen another Bounty XD2017-02-16
2

It is impossible to tell in general whether a set of points in 2D was projected from a set of points in 3D.

First of all, such a projection is ALWAYS possible. Let S (representing the light source) be ANY point in 3D NOT on the plane of the given 2D point set. Then a line can be drawn from S to any point P in the set. ANY POINT on such a line can be viewed as being projected to P by the light source at S. So one can construct an arbitrary 3D set of points projecting to the 2D set by choosing any one point from each of the described lines through S. Note that the collection of possible 3D sets is vastly under-determined: Not only is there an infinite number of choices of points between S and each P, there are an infinite number of choices for S in the first place.

On the other hand: Each planar set is -a projection of itself-. More generally, in the above construction one could pick the projected points by intersecting all of the described lines with another plane between S and the given plane, so even the original set being projected need not be fully 3D.

  • 0
    Yes I'm aware there are infinite many 3D sources that can map to a 2D. I just want to "decide" if a given set of points is a projection over a plane of another set of points2017-02-13
1

not quite an answer, but this might get you going (too long/complicated for a comment!)

proj(T*A) on to x = B where

T = t1*t2

where t1 is a rotation matrix t2 is a dilation scalar that is a trig function of D and d (assume it's constant for every point - true if we assume the sphere is of small radius, and D is large compared to that. d = distance from sphere to wall)

and x is the plane representing the wall (TA - project(T*A onto x3), where x3 is the unit vector perpendicular to the wall)