OK, after much flailing and gnashing of teeth, and assistance from
@Gondos, I figured out how to get the loaded mesh vertices and triangles in through Orbiter vs. parsing the mesh file directly. The user just needs to provide a list of the meshgroups that constitute the wetted hull parts that should participate in the force calculation. I also did a lot of simplification and code cleanup, and I can pretty much drop the Lua module into any config directory and get that mesh floating.
The spurious torque that I was experiencing is much improved. The issue I had with incorrect triangles being created that caused large torques was fixed by how I now load the vertices and triangles. But there is still some torque that happens when certain surfaces enter the water. It has something to do with the forces calculated for the special cases of the partially submerged triangles, but I am less certain that it is a bug now. I am somewhat suspicious that it may be an artifact of how my meshes are triangulated. The simple box that I use has six meshgroups, one for each side. There are four vertices and two triangles defining the square side with a diagonal. And the diagonal is canted at the same angle on each face. My sphere is triangulated in a similar way, like in this image:
Imagine a globe where it is subdivided into rectangles of latitude and longitude, and triangles are created by cutting them at a diagonal. As with the box, all of the diagonals are canted in the the same way, and aren't normal to the center of the sphere. So if there was any imbalance in the forces calculated and their center of pressure, it would apply a torque, and all the triangles on the waterline would apply a similar torque in the same direction.
I'd be curious to try my Zorb model with a mesh with equilateral triangles where the normals all pass through the center of the sphere like this:
Something I could do would be to reverse the diagonals on opposite sides of my box and see if the spurious torques cancel. Off to the text editor and Orbiter...