You can't query the mesh data of a design in OpenSCAD. The footprint of the
affine approach is too small (it has no Boolean operations) to produce
problematic meshes. I would be a great progress to get at least hands on the
mesh data of STL imports (or other input formats), but nope. So to be
honest, I don't see much sense in implementing a meshtester or meshrepairing
in OpenSCAD. OK you could use some STL2SCAD converter, but no way to do
something useful with OpenSCAD in that field.
Better use a full blown (procedural) programming language like C/C++/C#, VB,
Python, Matlab ..., which lets you read/write and parse ASCII and binary STL
files. Your code will be fast, stack size will be no problem, you can write
structured programs with abstract data types and you have direct element
write access ...