Jump to content
• Advertisement

# Least square fitting a plane question

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

If you intended to correct an error in the post then please contact us.

## 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 this post

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

#### Share this post

##### 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 this post

##### 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 this post

##### 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 this post

##### 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 this post

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

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5
• Advertisement

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633759
• Total Posts
3013715
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!