need a script to see if faces are planar.


I need a tool to control if faces (poly) of a model are planar.
I'll try to explain with a model with a single poly:

- run the script,
- enter a value : "T" and click "GO"
- the script test the distance between each vertex of the poly and a plane which is the "average" of all the planes
defined by the triangles of the poly.(I'm bad bad in math : hope someone understand...)
- if a vertex's distance is more than T, then the script apply id "4" -> red
- if all vertices distance is zero, then id is "0" -> green
- id = 2 if max distance =(T/3)
- id = 3 if max distance =(T/3)*2

Hope someone find this usefull enough :-)

image.png111.76 KB