Re: Rotated square in space



I'm coming in late here but I see there was a question about
computing coordinates of points of a square in R^3 knowing their
images under projection to a plane from a single (unknown) light source:

In article <3glfh2Fd4s8dU1@xxxxxxxxxxxxxx>,
Claudio Grondi <claudio.grondi@xxxxxxxxxx> wrote:

>So your question was about transformation of
>points of a square on a quadrangle which
>results from 3D perspective transformation,
>right?
>
>This is another kind of question as your original
>one:
>> I have this projection:
>> p1 0,5 p2 5,0 p3 15,5 p4 10,15
>> and now I want p1,p2,p3,p4 in 3d world coordinates.

I took the perspective (ahem) that the light source O = (x,y,z)
and the points P_1 = (0,5,0), etc., can be connected by lines
which contain the actual vertices Q_i = P_i + t_i ( O - P_i) which
are located some fraction t_i of the way between O and P_i .
Any choice of O and the t_i will give the right projection, but
the OP wants the Q_i to lie on a square. This requires
(1) consecutive vectors v_i = Q_{i+1} - Q_i must be perpendicular
(2) the normals v1 x v2 and v3 x v4 to the triangles Q1 Q2 Q3 and
Q3 Q4 Q1 must be equal
(3) consecutive sides must be of equal length: v1^2 = v2^2

Conversely if (1) is met then Q1 Q2 Q3 and Q3 Q4 Q1 are right triangles,
and if (2) is met then their normals are in particular parallel, meaning
the right triangles are parallel, meaning (since they share vertices) they
are coplanar. So then using (1) again we know the Q_i form a planar
rectangle; (3) makes it square.

So it is easy to generate a set of polynomial equations which precisely
describes the constraints on the unknowns x,y,z, t1,t2,t3,t4. Here it
is done in Maple:

p1:=[0,5]: p2:=[5,0]: p3:=[15,5]: p4:=[10,15]:
for i to 4 do (P||i) := [op(p||i), 0]: od:
for i to 4 do (Q||i) := P||i + (t||i)*([x,y,z]-P||i):od:
for i to 4 do v||i := expand( Q||(i mod 4 + 1) - Q||i ): od:
for i to 4 do va:=v||i:vb:=v||(i mod 4 + 1): ip||i:=add(va[j]*vb[j],j=1..3):od:
for i to 3 do ap||i :=
v1[i mod 3 +1]*v2[i-2 mod 3 + 1] - v3[i mod 3 +1]*v4[i-2 mod 3 + 1] : od:
ap0:=add(v1[i]^2,i=1..3)-add(v2[i]^2,i=1..3);

Actually there is a nondegeneracy condition we should add: the equations
admit the solution t1=t2=t3=t4=1 , i.e. the "square" is at O . We can
use the algebraic geometers' trick to make the t_i unequal to 1 by
adding additional constraints involving additional variables u_i :
insist that (1 - t_i) u_i = 1 and then t_i cannot be zero.
Likewise we don't want the "solution" with z = 0. Again in Maple:

for i to 4 do bp||i:=(1-t||i)*u||i - 1 : od: bp0:= z*w - 1 :

For the given points, the full set of constraints is then

(1-t1)*u1-1, (1-t2)*u2-1, (1-t3)*u3-1, (1-t4)*u4-1, z*w-1,
(-x*t1-5*t2+x*t2+5)*(5*t2-x*t2-15*t3+x*t3+10)+(5*t1-y*t1+y*t2-5)*(-y*t2-5*t3+y
*t3+5)+(-z*t1+z*t2)*(-z*t2+z*t3), (5*t2-x*t2-15*t3+x*t3+10)*(15*t3-x*t3-10*t4+
x*t4-5)+(-y*t2-5*t3+y*t3+5)*(5*t3-y*t3-15*t4+y*t4+10)+(-z*t2+z*t3)*(-z*t3+z*t4
), (15*t3-x*t3-10*t4+x*t4-5)*(10*t4-x*t4+x*t1-10)+(5*t3-y*t3-15*t4+y*t4+10)*(
15*t4-y*t4-5*t1+y*t1-10)+(-z*t3+z*t4)*(-z*t4+z*t1), (10*t4-x*t4+x*t1-10)*(-x*
t1-5*t2+x*t2+5)+(15*t4-y*t4-5*t1+y*t1-10)*(5*t1-y*t1+y*t2-5)+(-z*t4+z*t1)*(-z*
t1+z*t2), (5*t1-y*t1+y*t2-5)*(-z*t2+z*t3)-(5*t3-y*t3-15*t4+y*t4+10)*(-z*t4+z*
t1), (-z*t1+z*t2)*(5*t2-x*t2-15*t3+x*t3+10)-(-z*t3+z*t4)*(10*t4-x*t4+x*t1-10),
(-x*t1-5*t2+x*t2+5)*(-y*t2-5*t3+y*t3+5)-(15*t3-x*t3-10*t4+x*t4-5)*(15*t4-y*t4-\
5*t1+y*t1-10), (-x*t1-5*t2+x*t2+5)^2+(5*t1-y*t1+y*t2-5)^2+(-z*t1+z*t2)^2-(5*t2
-x*t2-15*t3+x*t3+10)^2-(-y*t2-5*t3+y*t3+5)^2-(-z*t2+z*t3)^2

These polynomials generate an ideal I in the polynomial ring
Q[x,y,z,w,t1,t2,t3,t4,u1,u2,u3,u4] ; we would like the simplest possible
description of the intersection of this ideal with the subring
Q[x,y,z,t1,t2,t3,t4] (since we don't really care about w or the u_i,
except for their existence!). I had Magma do this for me:

Q<t1,t2,t3,t4,u1,u2,u3,u4,w,x,y,z>:=PolynomialRing(RationalField(),12);
I:=ideal<Q| ... generators above ... >;
J:=EliminationIdeal(I,{t1,t2,t3,t4,x,y,z});
Groebner(J);

The answer is that the ideal is equally well generated by just a few
simple polynomials:
t1 - 5/3*t4 + 2/3,
t2 - 2*t4 + 1,
t3 - 4/3*t4 + 1/3,
x - 1/3*y + 5/3,
y^2 + 26*y + 9/10*z^2 - 155

So these are the constraints on our variables. Obviously we can choose
t4 and y as we wish (as long as y is between -31 and 5 ) and
compute x, z, t1, t2, t3 from them. (The fact that z appears only
to an even exponent is to be expected because of the mirror symmetry
with respect to the plane z=0 .) With, say, t4 = 2/3 and y = 2
we get a square with side-length (10/3) sqrt(2) whose vertices are at

(-4/9, 11/3, 4/9*110^(1/2)), ( 3, 2/3, 1/3*110^(1/2)),
(55/9, 10/3, 5/9*110^(1/2)), (8/3, 19/3, 2/3*110^(1/2)) ;

here the light source is at (-1, 2, 110^(1/2) ).

Having the full algebraic solution in hand I see there is probably
some way to use in advance some of the geometric degrees of freedom
to reduce the size of the set of constraints. One could also pre-process
the data to put two vertices at (say) (0,0) and (1,0); perhaps it
would be possible to work this all out symbolically, then, giving
t1, t2, t3, x, and z^2 in terms of t4, y, and the four coordinates
of the other two points in the quadrilateral projection.

dave
.



Relevant Pages

  • Re: RSA Challenges
    ... These days Jbilou will used the ground, and if Marilyn mostly ... the projection will cover instead of the basic ... square. ... Until Rashid alters the trainees better, ...
    (sci.crypt)
  • Re: Infinite 3d lattice
    ... Consider then the projection of the problem in the yz plane. ... point initially lying exactly in the middle of the square (where A,B,C,D are ... I don't have access to symbolic algebra programs such as Maple. ... towards the center of the cube ABCDEFGH, ...
    (sci.math)
  • Re: More about --- Formulae for Latin squares of size 2^n
    ... Galois Field to the prime base q; for mod 2 polynomials, ... "To get primitives of non-Mersenne prime degree n, ... > standard 4x4 square. ... > permutation is orthogonal to is also orthogonal to 23 others. ...
    (sci.crypt)
  • Re: Factoring problem solution
    ... NFS works this way: you have two polynomials, ... Now pick the prime factorization of both Fand Gand reduce the ... exponents in these factorizations modulo 2. ... square (this is not strictly true, but using a trick due to Adleman this ...
    (sci.math)
  • Re: Factoring problem solution
    ... NFS works this way: you have two polynomials, ... Now pick the prime factorization of both Fand Gand reduce the ... exponents in these factorizations modulo 2. ... square (this is not strictly true, but using a trick due to Adleman this ...
    (sci.crypt)