Correcting plane parameters with the fixed azimuth angles

I am trying to reconstruct specific 3d objects such as cubes, pyramids and so on. For this, i am using point cloud data and then fitting planar surfaces for the segmented point patches. Planes are obtained by doing Least sqaure adjustments. Then my objective is to intersect neighbouring planes and then to get intersection lines (line segments). Then from those lines, i wish to make a something like wireframe model.

But, when i get all the normal vectors (n1, ..n4 in this object) and then if i project them onto XY plane and calculated the azimuths of each plane, then they are not exactly changing by 90 degree but 92, 87…..

So, as i am looking for an accurate pyramid model, i think i should first adjust these planes in a way to having their azimuths exactly in 90 degree differences with adjacent plane. After that, i think i should intersect them, which will improve the accurate shape of the pyramid.

Now, i want to know, how should i update my plane parameters in a way to reside their azimuth differences exactly in 90 degrees with other planes. In this case, should i change both (a, b, c) and d. where the plane equation is ax+by+cz+d=0.

Could you please give me equations and way to do this. thank you.

-

Here's an idea. It is heuristic, rather than rigorous, but I expect it will work OK.

The only problem case is the pyramid, because you have four planes that will have to meet at a single point. So, let's focus on the pyramid case. Using your current fitting code, you can calculate four planes $P_1$, $P_2$, $P_3$, $P_4$. The problem is that these planes don't meet at a single point. The idea is to calculate an "average" apex point $A$, and modify the planes so that they pass through $A$.

So, let $A_1 = P_2 \cap P_3 \cap P_4$ be the intersection of the three planes $P_2$, $P_3$, $P_4$, let $A_2 = P_1 \cap P_3 \cap P_4$, $A_3 = P_1 \cap P_2 \cap P_4$, and $A_4 = P_1 \cap P_2 \cap P_3$. Then let $A = (A_1 + A_2 + A_3 + A_4)/4$ be the "average" apex.

Now adjust each plane to make it pass through the point $A$. So, take plane $P_1$, for example. Let $B$ and $C$ be the end-points of the bottom edge of this plane. You recompute $P_1$ to be the plane that passes through the three points $A$, $B$, $C$. Do the same sort of thing with the other three planes.

As I said, this is less than rigorous. A rigorous approach would be to write a fitting function that fits four planes simultaneously, subject to the constraint that they have some (unknown) single point in common. This can be done, but its much harder than the simple adjustment process I described.

-
yes, I got your explanation and thank you very much for that. But, to find the average apex, first i should have the intersected lines. But, first, i want to adjust the planes in a way to get their XY projected normal vector in a more regualr mannar (i.e. 90 degree difference). for that, i can find a starting plane by finding the plane having many points or smallest rmse. if you dont mind, would it be possible to explain a way to update these planes. (accordig to my undestanding for the suggest way, i need to know the lines, but practically i am not computing them till they adjust) – gnp Sep 16 '13 at 11:10
any possibility to rotate a plane till its azimuth reach 90 degree difference with the adjacent one while preserving its "d" in the same value? – gnp Sep 16 '13 at 11:18
I don't see why you need the lines to get the $A_i$. You just compute each $A_i$ by intersecting three planes. – bubba Sep 16 '13 at 11:23
sorry for confusing you. to be honest, i am having some other types of objects like prism having a horizontal ridge with inclind ridges. for these objects, i am trying touse some other mechanism. first i want to adjust the horizontality of that ridge, then inclind rdiges. but by setting the horizontality and then let in to pass the inclined plane through the end of that ridge does not change the azimuth differences. if i get a 2d scene, then the ridges given by inlclined plane will lead to a traingle whose base angle are equal. – gnp Sep 16 '13 at 11:38
but, due to the incorrect ridge lines i can not get it as it is. as my main idea i to apply different regularity rules, in the end product azimuth, angles should have regular values. so to do this, i think i should fix this rotational errors of planes. as the whole process is automated one, i cant rely many things as i am implementing this in c++. if this is not clear, shall i post a new post – gnp Sep 16 '13 at 11:42