How to create 2d plot of arbitrary, coplanar 3d curve

醉酒当歌 提交于 2019-11-29 17:29:55
  1. find 3 points A,B,C in your data

    They must not be on single line and should be as far from each other as possible to improve accuracy.

  2. construct U,V basis vectors

    U = B-A
    V = C-A
    

    normalize

    U /= |U|
    V /= |U|
    

    make U,V perpendicular

    W = cross(U,V) // this will be near zero if A,B,C are on single line
    U = cross(V,W)
    
  3. convert your data to U,V plane

    simply for any point P=(x,y,z) in your data compute:

    x' = dot(U,P)
    y' = dot(V,P)
    

    in case you need also the reverse conversion:

    P = x'*U + y'*V
    

    In case you want/have an origin point A the conversions would be:

    x' = dot(U,P-A)
    y' = dot(V,P-A)
    P = A + x'*U + y'*V
    

    That will map A to (0,0) in your 2D coordinates.

In case you do not know your vector math look here:

at the bottom you will find the equation for vector operations. Hope that helps ...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!