投影的空间线 [英] Projections' Angle of Line in Space

查看:160
本文介绍了投影的空间线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

起始行(黄色)和轴位于 [xc,yc,zc]



行在 [xp,yp,zc]



a b c 是线条在空间中的角度。



我需要的是线条投影(黑色线条)在xy,yz和xz平面上创建的角度。


  • A_y_to_z :在xz平面上从y轴到z轴的投影线角度。
  • c $ c>:在zx平面上从z到x轴的角度。
  • A_x_to_y :xy平面上从x轴到y轴的角度





Matlab上编写代码 $ b

解决方案

您可以通过以下方式计算投影角度:


  1. 获取线的方向, d =(xp - xc,yp - yc,zp - zc)


  2. 正常化 d

  3. 使用平面的普通计算点积 dot(d,n)= dx * nx + dy * ny + dz * nz
  4. 通过 a = acos(dot (d,n))


  5. 最后通过取 b = 90 - 一个(假设单位为度 - NB最常用数学库f使用弧度)



  6. 特例:if dot(d,n)< 0 ,那么角度 a 将大于90度。在这种情况下,如果你只想要尖锐的角度,做 b = a - 90 而不是 90 - a



    例如要计算到xy平面的角度,请使用 n =(0,0,1),即z轴,该平面是该平面的法线。


    Start of line (yellow) and axes are at [xc,yc,zc]

    End of line is at [xp,yp,zc].

    a,b, c are the angles which line makes in space.

    What I need are the angles which line's projections (black line) create on xy,yz and xz planes.

    • A_y_to_z: Projected line's angle from y axis to z axis on xz plane.
    • A_z_to_x: Angle from z to x axis on zx plane.
    • A_x_to_y: Angle from x to y axis on xy plane.

    Writing code on Matlab

    解决方案

    You can calculate the projection angle to any plane by:

    1. Obtaining the direction of the line, d = (xp - xc, yp - yc, zp - zc)

    2. Normalizing d

    3. Calculating the dot-product with the normal of the plane, dot(d, n) = d.x * n.x + d.y * n.y + d.z * n.z

    4. Calculating the angle to the normal by a = acos(dot(d, n))

    5. Finally obtaining the angle to the plane by taking b = 90 - a (assuming units in degrees - NB most math library functions use radians)

    Special case: if dot(d, n) < 0, then the angle a will be greater than 90 degrees. In this case if you only want the acute angle, do b = a - 90 instead of 90 - a.

    e.g. To calculate the angle to the xy plane, use n = (0, 0, 1), i.e. the z-axis, which is the normal to that plane.

    这篇关于投影的空间线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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