# How to fix non-coplannar polygons?

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

• 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. Aug 22, 2017 at 5:11
• 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. Aug 22, 2017 at 5:13
• 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 Aug 22, 2017 at 5:37
• 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 Aug 22, 2017 at 5:50