1

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!

Fred E
  • 131
  • 5
  • Look up [Multiple Linear Regression](http://www.stat.yale.edu/Courses/1997-98/101/linmult.htm). [Here is a search](https://www.bing.com/search?q=python+multiple+linear+regression&form=EDGTCT&qs=PF&cvid=9e71352d05724fbf99ae9f469d1969c5&cc=US&setlang=en-US) for doing it in Python. – Rory Daulton Jun 14 '17 at 20:19
  • You really should accept @Spektre answer – Reblochon Masque Apr 10 '19 at 02:38

1 Answers1

3
  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 ...

Spektre
  • 49,595
  • 11
  • 110
  • 380
  • This will not "find the plane which is closest to the one which these points are co-planar on", it will find the plane through those three points. If all the points are actually coplanar those are the same planes, but not if the data has some noise. – Rory Daulton Jun 15 '17 at 08:25
  • @RoryDaulton I know but just for rendering the set is this enough ... In case one would like to avoid noise problems one can either average more such planes or fit the plane with optimization ... – Spektre Jun 15 '17 at 08:31