Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tri_tri_intersection_test_3d can produce inf/NaN values for identical triangles #208

Open
iforce2d opened this issue Oct 8, 2021 · 0 comments

Comments

@iforce2d
Copy link

iforce2d commented Oct 8, 2021

If Vehicle::CreateDegenGeom is executed on geometry that includes a previously generated degenGeom, two identical triangles can be given to tri_tri_intersection_test_3d. This can result in the returned 'source' or 'target' value becoming inf or NaN, which causes all kinds of surprises later on.

Steps to reproduce:

  1. New file
  2. Add a pod geom (probably anything with actual geometry would work)
  3. Mark the pod to be included in "Set 0"
  4. Open VSPAERO, choose "Panel Method" and select "Set 0" for the geometry set.
  5. Run the solver. The generated degenGeom will also belong to "Set 0" :/
  6. Now select "Vortex Lattice Method" and run the solver again.

Ultimately this will segfault in triangle.c:makevertexmap() but to catch it at the initial problem point add something like this immediately after the call to tri_tri_intersection_test_3d in TMesh.cpp:2589 and breakpoint on the printf:

for (int t = 0; t < 3; t++) {
    if ( isinf(e0.v[t]) || isinf(e1.v[t]) || isnan(e0.v[t]) || isnan(e1.v[t]) ) {
        printf("gotcha\n");
    }
}

Example break values:
Image of breakpoint

Interestingly if left as "Panel Method" the solver can be run over and over without any problems... maybe the old mesh just needs to be removed here even when the method is not Panel?

Image of code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant