Facet mirror function creates non-planer facets

I’ve noticed it before, but sometimes the facet mirror function will create non-planer facets. See example below. While rotations seem to be fine. Using 2.9.16_beta for MacOS
Example.zip (189.0 KB)

I also tried a -1 scale in the mirror direction, it worked but the normals get invert too. When you go to flip them is when you generate the same non-planer facets as shown above. It seems like they are only some of the ones that got created from a build intersection. If you also flip the normals on then-mirrored facets one on the left you’ll get the same non-planer facets.

Rebuilt Example.zip (193.4 KB)

So far the only solution is to rebuild those intersections on the mirrored facets. Even after rebuilding those intersections on the mirrored side, I still get a single non-planer facet after collapsing facets with vertices closer than 1E-6 only. Setting to 1E-7 will not do this. This facet was a 180 degree rotation of a rebuilt facet from an intersection. I do a lot of collapsing vertices so I can use the very useful Smart Facet Selection function.
Screenshot 2023-12-12 at 6.51.15 PM

This begs the question…how non-planer is non-planer. At this level maybe I’ll only generate a negligible amount of leaks. I closed off that volume and ran a simulation. After 3 Ghits I got 16 leaks (0.00000053%).

I understand collapsing down vertices with too big of a setting can generate bigger leaks, but all facet operations like mirror, rotation, scaling, intersection, flipping normals and etc should be done with enough precision to not go over your threshold for non-planer facet reporting.

After rebuilding the intersection around the last non-planer area finally gives all planer facets. So at least the intersection function has more precision than the mirror, normal flip and rotation functions. Maybe doing several functions in a row stacked up the errors.

All Planer Example.zip (193.3 KB)

This adds a lot more work than doing a simple mirror, I hope you can fix it soon :slight_smile:
Cheers,
Alan

Hello Alan,

I’m Tymoteusz Mroczkowski, a technical student currently working on Molflow+.

The issue you are experiencing is caused by the way Molflow checks the planarity of facets. The planarity check involves calculating two vectors defining a plane, starting from the first vertex of the facet and skipping collinear vertices. For a 3 or 4-vertex facet, there are no issues. However, if there are more vertices, depending on the starting vertex, the initial vectors may be too short or too similar to accurately compute the plane to which all following vertices are compared. The issue occurs during mirroring because the normal direction of the facet is determined by the order of vertices (clockwise or counter-clockwise). When facets are mirrored, their normals are inverted. Consequently, after mirroring, all modified facets have their vertex order reversed. This reversal results in the initial vectors defining the plane being different from the original facet.


The easiest solution is to select non-planar facets (an option in the Selection menu) and then shift their indices (an option in the Facet menu, or Ctrl+H) until they become planar. In all situations I tested, shifting exactly twice fixed the issue, but that number may vary.

Best,
Tymoteusz

I assume the normal is used in determining if a particle hits a surface, so a having a more inaccurate normal could cause leaks even though the vertices don’t change. Is this correct?

Best,
Alan

Hello Alan,

You have to separate two different phenomena:

  • An inaccurate normal that results in a non-planar facet results in a chance of leak. The more unplanar, the higher the chance, as you have experienced.
  • An inaccurate normal that doesn’t result in a non-planar facet does not cause leaks, but slightly misaligns the reflected directional distribution. By default, the reflection is diffuse (peaked at the computed normal), so the effect is negligible.

The exact planarity error is shown in Facet Details, and to answer your previous question, facets with a planarity > 1E-5 are marked purple. The planarity error is defined as:

Ax+By+Cz+D=err, where A,B,C,D are the facet plane coefficients, and err is the largest deviation among all of the facet’s (x,y,z) vertices. (Hint: the normal vector is N=(A,B,C))

Two remarks:

  1. As you probably see, both the vertex collapse tolerance and the planarity error are in cm and thus not scale invariant. If your “unplanar” facet results in only 16/3E9 leak ratio, which is negligible, then maybe your geometry is larger than the “usual” vacuum component.
  2. You can solve the problem by either shifting the vertices as Tymoteusz proposed (elegant solution), or just lazily…
  • Selection → Select non-planar
  • Facet → Triangulate
    which, ugly as it is, always works, as triangles are by definition planar.