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

后端 未结 1 837
长情又很酷
长情又很酷 2020-12-22 06:45

I have a set of points which comprise a (in theory) co-planar curve. My problem is that the plane is arbitrary and can move between each time I collect the data (these point

相关标签:
1条回答
  • 2020-12-22 07:28
    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 /= |V|
      

      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:

    • Understanding 4x4 homogenous transform matrices

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

    0 讨论(0)
提交回复
热议问题