计算矩形的坐标它的影子三维坐标? [英] Calculating rectangle 3D coordinate with coordinate its shadow?

查看:155
本文介绍了计算矩形的坐标它的影子三维坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时是一个问题是什么矩形三维旋转,并且是透视过渡(例如,在CSS)绘制为四边形。但是,我们希望得到通过旋转和透视拉伸为四边形变换矩形(宽度,长度,欧拉角,角度)。

Sometimes was a problem what is the rectangle 3D rotated and be perspective transition (for example in CSS) draw as the tetragon. But we want obtain the rectangle (width, length, Euler angle, perspective) transformed via rotate and perspective draw as the tetragon.

推荐答案


     

解决:     
坐标系:     
坐标系的原点是一致对角线交点。斧ž正常的四边形。斧X越过A点     
A,B,C,D; - ; - 坐标
矩形     (X 1 ,Y 1 ,Z 1 );     B(X 2 ,Y 2 ,Z 2 );     C(X 3 ,Y 3 ,Z 3 );     (X 4 ,Y 4 ,Z 4 );     
A,B,C,D-阴影。角点A(Q 1 ,P 1 ,0);     乙(Q 2 ,P 2 ,0); Ç(Q 3 ,P 3 ,0);     ð(Q 4 ,P 4 ,0);
    ķ观点。
    在坐标y 1 = Y 3 = 0的该系统。     
     Fig1。     出租车从相似变换的三角形是:
    
x 1 = 1-Z 1 / K * Q 1 ;     
x 3 = 1-Z 3 / K * Q 3    出租车从问题陈述是对角交叉中的坐标这样的由来:    
ž 3 = - z 1 иx 3 = - X 1    
代入前pression以上,并等同于对方是:
    x 1 = 2 * Q 1 * Q 3 /(Q 3 -q 1 );
    ž 1 =(Q 1 + Q 3 )/(Q 1 -q 3 )* K。


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/k*q1;
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.

为了简化计算等设想,第二个矩形对角线(BD)位于坐标系中是Y对角点坐标等于零。在这个坐标系中的坐标点B和D是相同点A和C,但我们必须改变ž 1 到z 2 ,Z 3 到z 4 ,X 1 到&NBSP,X 2 ,X 3 为x 4 ,Q 1 到 问 2 ,Q 3 至Q 4
要翻译的想象系统,实际的系统使用旋转坐标式(Z斧头是一样的,Z坐标等于)
   图2    
   
X = X'* COS(一); Y = Y'*罪(一);
其结果是:    
x 2 = - X 4 = 2 * Q 2 * Q 4 /(Q 4 -q 2 );     
2 = - 是 4 = X 2 *棕褐色(一);
    ž 2 = - z 4 =(Q 2 + Q 4 )/(Q 2 -q 4 )的 K;     棕褐色(A)=(P 2 -p 4 )/(Q 2 -q 4 )    

ABCD是平行四边形。对角交叉点鸿沟对角线的一半。我们需要多一个前pression使矩形。利用角度等于90度。使两侧的ABCD标量乘向量。在坐标是:    
(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))    
我们得到方程K(角度):F * K 2 -g = 0,解决
   
K =开方(G / F)。    

   
收集得到点ABCD的所有坐标全部公式。    出租车从角落里的坐标是容易计算的长方形的侧面。

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.

这篇关于计算矩形的坐标它的影子三维坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆