# Least square fitting a plane question

This topic is 2932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a set of 3d points in space. These points belong to a roof of a building. Using Jama Matrix package (a Java library), I have calculated a least square fitting plane for these points by solving A * X = B, which gives me X. Now I want to project all the points to this plane - how can I do that? With my limited knowledge, I know to define a plane I need normal and also a point on a plane before I can project any point to it. Can someone point me to right direction? Thanks!

##### Share on other sites
Take dot product between the normal of the plane and points computed from least square solver.

##### Share on other sites

Take dot product between the normal of the plane and points computed from least square solver.

So I take it that the X calculated by the solver is the normal of the plane? Should it be normalized before using it in dot product? The dot product of a point with the normal would give a scalar - how is it to be used? Thanks!

##### Share on other sites
I assume by "projection" you mean the closest point P on the plane ax+by+cz+d=0 to a point A?

The line between P and A has the direction vector [a, b, c]

Now solve for the intersection between a line and a plane.

http://paulbourke.net/geometry/planeline/ (Look at solution 2, solve for u, plug u into the line equation)

##### Share on other sites

I assume by "projection" you mean the closest point P on the plane ax+by+cz+d=0 to a point A?

The line between P and A has the direction vector [a, b, c]

Is the [a,b,c] obtained by the matrix solving of A * X = B?

##### Share on other sites

[quote name='jameszhao00' timestamp='1318313177' post='4871348']
I assume by "projection" you mean the closest point P on the plane ax+by+cz+d=0 to a point A?

The line between P and A has the direction vector [a, b, c]

Is the [a,b,c] obtained by the matrix solving of A * X = B?
[/quote]

How is the plane represented in your least square solution?

##### Share on other sites

How is the plane represented in your least square solution?

I don't have a plane - as I have mentioned in my original post, I have a set of points and a fitted plane has been matrix solved using A * X = B. That has given me a column vector X which is the representative of the plane's A, B and C coefficients. The main problems is how I can project the original points to this plane. Being not a mathematician, this is a very complex problem for me to solve - any help is appreciated.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 9
• 11
• 15
• 21
• 26