Calculating rectangle 3D coordinate with coordinate its shadow?

走远了吗. 提交于 2019-11-27 16:24:29

figure fig.1 points a,c diagonal rectangle(yellow) points A,C diagonal tetragon(shadow) (red)

fig.2 a,b,c,d rectangle points(yellow) A,B,C,D shadow(tetragon) (red)

Ivan.s


Solve:
Coordinate system:
The origin of the coordinate system is coincident with diagonals intersection point. Axe Z normal to the tetragon. Axe X crosses point A
a,b,c,d;- ;- rectangular with coordinates
a(x1,y1,z1); b(x2,y2,z2); c(x3,y3,z3); a(x4,y4,z4);
A,B,C,D-shadow. Corner points A(q1,p1,0); B(q2,p2,0); C(q3,p3,0); D(q4,p4,0);
k perspective.
In that system of coordinate y1=y3=0.
Fig1.
From similarity transformation triangles is:

x1=1-z1/kq1;
x3=1-z3/k
q3
From statement of problem was that diagonal cross is in the origin of the coordinate thus:
z3=-z1 и x3=-x1
Substituting in expression above and equating to each other was :
x1=2*q1*q3/(q3-q1);
z1=(q1+q3)/(q1-q3)*k.

To simplify other calculation imagine that second rectangle diagonal (bd) lie in coordinate system in that Y coordinate of diagonal points is equal zero. In this coordinate system coordinate points b and d was the same as point a and c but we must change z1 to z2, z3 to z4, x1 to  x2, x3 to x4,q1 to  q2, q3 to q4.
To translate from imagine system to real system use rotation coordinate formula (Z axe is the same, z coordinate is equals)
Fig.2

x=x'*cos(a); y=y'*sin(a);
The result was:
x2=-x4=2*q2*q4/(q4-q2);
y2=-y4=x2*tan(a);
z2=-z4=(q2+q4)/(q2-q4)k; tan(a)=(p2-p4)/(q2-q4)

abcd was parallelogram. Diagonal cross point divide diagonal to half. We need to one more expression to make rectangular. Use angle equal 90 degrees. Make scalar multiplication vector of two side in abcd. In coordinate it was:
(a-b)

(d-a)=y4y2+(x1-x4)(x1-x2)+(z1-z4)*(z1-z2)=0;
f=(q1*q2-q3q4)(q1*q4-q2*q3)
g=-tan2(a)*q42q22(q1-q3)2+(-q1q2(q3+q4)+q3q4(q1+q2))*(q1q2(q4-q3)+q3q4(q1-q2))
We receive equation to k(perspective): f*k2-g=0, solve it

k=sqrt(g/f).


Collect all formula we get all coordinates of point abcd.
From coordinate of corner is simple to calculate side of rectangular.

Calculating quaternion, rotation matrix, angles see calculate quaternion by coordinate 2 points of object in two positions
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!