Perpendicular Vector of a plane with a lot of points

Discussion in 'MATLAB' started by Carlos Junior, Jun 23, 2011.

  1. Hi,
    Please, if anyone could help me I would be very grateful...

    I have more than three 3-D points in a plane distribution and I need to know the perpendicular vector of this plane ... In my case, I have 36 points at the 3-D space... They are at the same plane... How could I know the perpendicular vector to this plane using all the points and not only three points ?

    Very Thanks.

    Carlos Junior, Jun 23, 2011
    1. Advertisements

  2. - - - - - - - - -
    The answer to your question depends on how much validity is to be attributed to your statement "They are at the same plane". If this statement is literally and exactly true, then there is absolutely no point in using any more than three of the points to find an orthogonal direction. Any three which are non-colinear will do.

    On the other hand if the points lie only approximately in a plane, then there is suddenly an urgent need to use all of the points to get the best possible answer.

    For the exactly planar case, let P, Q, and R be any three (non-colinear) points. Then cross(Q-P,R-P) is a vector which is orthogonal to the plane of the points. End of story.

    For the approximately planar case, you can make use of the 'mean' and 'svd' functions, but I will hold off until I hear that you are interested in this possibility.

    Roger Stafford
    Roger Stafford, Jun 23, 2011
    1. Advertisements

  3. ------------------------

    Hi Roger,
    Thank you by the answer ... Indeed, I need the second situation you have cited:
    " For the approximately planar case, you can make use of the 'mean' and 'svd' functions" ...

    I have an ideal situation using the 3D Studio Max and MatLab to test the theory ... But, the project is also done at the real world where the points are not exactly at the same plane! Thus, what I need is to know how to find a perpendicular vector to the "approximately planar case" ...

    Very thanks,

    Carlos Junior, Jun 23, 2011
  4. - - - - - - - - -
    Let A be an n by 3 matrix where each row is one of the n points (that are approximately planar.)

    A0 = bsxfun(@minus,A,mean(A,1)); % Subtract "mean" point
    [~,~,V] = svd(A0,0);
    p = V:),3); % Choose the eigenvector with the smallest singular value

    Then 'p' is a unit vector orthogonal to the least squares best-fitting plane to the n points. This best plane passes through the point mean(A,1).

    Roger Stafford
    Roger Stafford, Jun 23, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.