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