0
$\begingroup$

I have a 3-D object described by surface facets. It is saved as OFF file. However, some of the vertices in a surface facet (polygon) are not exactly coplannar. Is there any good idea to fix these non-coplannar polygons to let them become coplannar? I would like to keep the polygons without being split. I wish this kind of fixing is done by just vertices moving.

My idea is

1) for every polygon, find the base plane of the polygon that most vertices fall into the plane, for example, the distance of vertex to the plane is less than machine precision (but how to find this base plane?);

2) for these vertices that are not fall into the base plane of the polygon, find the intersection of vertex's associated polygons' base planes and take it as the new location of this vertex.

Is there any problem? Do you have any better idea?

Thanks,

Tang Laoya

$\endgroup$
4
  • $\begingroup$ How many vertices? 3 vertices will form a plane (if not on a line), so if you have 4 vertices in your polygons any 3 can be the base. $\endgroup$
    – Andrei
    Aug 22, 2017 at 5:11
  • $\begingroup$ Don't know what OFF means, but sounds like somebody screwed up their polygons. I would split the offending polygon to smaller pieces, at least that's how I did it when writing 3D-graphics code. A triangle is always coplanar. I don't know of a method for finding the best way to split. Splitting off the wrong triangle may create an extra sharp angle that may not look good in all orientations. $\endgroup$ Aug 22, 2017 at 5:13
  • $\begingroup$ Oh sorry, I forgot to say, I would like to keep the polygons without being split. I wish this kind of fixing is done by just vertices moving. The OFF is a kind of solid object data format. Thanks $\endgroup$
    – Tang Laoya
    Aug 22, 2017 at 5:37
  • $\begingroup$ Some polygons could have hundreds of vertices. All vertices of one polygon should be in one plane, so the base plane should be the same, but in fact, they are not in a plane exactly (distance of vertices to base plane is larger than deps, double precision of machine precision). Now I have to move these vertices slightly to let all vertices of polygons are coplannar. Thanks $\endgroup$
    – Tang Laoya
    Aug 22, 2017 at 5:50

1 Answer 1

1
$\begingroup$

As you write in a comment that faces tend to have very many vertices, I suppose you could determine the best plane per face simply by linear regression. Then for each vertex, determine its improved position by solving the equations of its incident planes.

For vertices incident with less than three faces, you may want to introduce suitable additional constraint (such as: move the point only along the normal of the unique face, or the plane spanned by the normals of the two faces). For vertices incident with more than three faces, you are however doomed - perhaps not so much if you ignore any conditions imposed by triangular faces.

In general, you should be aware that there may not be any "pretty" solution. After all, less than six non-planar faces allow you to construct a torus, but after making them planar they cannot form a torus any more.

$\endgroup$
2
  • $\begingroup$ Thanks for your kindly reply. Could you please give some details on how to 'determine the best plane per face simply by linear regression'? I have read this article: ilikebigbits.com/blog/2015/3/2/plane-from-points but it seems that more vertices are out of the base plane. Maybe I should move all vertices onto this plane? $\endgroup$
    – Tang Laoya
    Aug 22, 2017 at 6:31
  • $\begingroup$ @TangLaoya Yes, that looks ok. Indeed, this will not maximize the number of points that are exactly on the plane found, but rather attempt to minimize the squared distances of points from the plane. This should typically have most points very close to the plane if possible, and because of rounding it is unlikely anyway that even points that are coplanar, are exactly coplanar. Nevertheless, you could: 1) perform linear regression. 2) determine outliers 3) perform linear regression again without these. $\endgroup$ Aug 22, 2017 at 9:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .