Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

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

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 points are being collected from a camera). I was wondering if you guys could help me figure out how to:

  1. find the plane which is closest to the one which these points are co-planar on
  2. project the points on this plane in such a way that gives me a 2-d curve

I believe that I know how to do point 2, it is really mainly point 1 that i'm struggling with, but I wouldn't mind help on the second point as well.

Thanks a ton!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  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:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...