Skip to content

fix(Raytracing): better handle edge cases#1296

Open
BotellaA wants to merge 4 commits into
nextfrom
deat/medial-balls-line
Open

fix(Raytracing): better handle edge cases#1296
BotellaA wants to merge 4 commits into
nextfrom
deat/medial-balls-line

Conversation

@BotellaA

Copy link
Copy Markdown
Member

No description provided.

@BotellaA BotellaA requested a review from MelchiorSchuh June 26, 2026 08:21
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v20.1.8) reports: 10 concern(s)
  • include/geode/mesh/helpers/ray_tracing.hpp:58:27: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'EdgeDistance' of convertible types are easily swapped by mistake

       58 |             EdgeDistance( index_t edge_in,
          |                           ^~~~~~~~~~~~~~~~
       59 |                 double distance_in,
          |                 ~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode/OpenGeode/include/geode/mesh/helpers/ray_tracing.hpp:58:35: note: the first parameter in the range is 'edge_in'
       58 |             EdgeDistance( index_t edge_in,
          |                                   ^~~~~~~
    /__w/OpenGeode/OpenGeode/include/geode/mesh/helpers/ray_tracing.hpp:59:24: note: the last parameter in the range is 'distance_in'
       59 |                 double distance_in,
          |                        ^~~~~~~~~~~
    /__w/OpenGeode/OpenGeode/include/geode/mesh/helpers/ray_tracing.hpp:58:27: note: 
       58 |             EdgeDistance( index_t edge_in,
          |                           ^
    /__w/OpenGeode/OpenGeode/include/geode/mesh/helpers/ray_tracing.hpp:59:17: note: 'index_t' and 'double' may be implicitly converted: 'index_t' (as 'unsigned int') -> 'double', 'double' -> 'index_t' (as 'unsigned int')
       59 |                 double distance_in,
          |                 ^
  • include/geode/mesh/helpers/ray_tracing.hpp:116:30: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'PolygonDistance' of convertible types are easily swapped by mistake

      116 |             PolygonDistance( index_t polygon_in,
          |                              ^~~~~~~~~~~~~~~~~~~
      117 |                 double distance_in,
          |                 ~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode/OpenGeode/include/geode/mesh/helpers/ray_tracing.hpp:116:38: note: the first parameter in the range is 'polygon_in'
      116 |             PolygonDistance( index_t polygon_in,
          |                                      ^~~~~~~~~~
    /__w/OpenGeode/OpenGeode/include/geode/mesh/helpers/ray_tracing.hpp:117:24: note: the last parameter in the range is 'distance_in'
      117 |                 double distance_in,
          |                        ^~~~~~~~~~~
    /__w/OpenGeode/OpenGeode/include/geode/mesh/helpers/ray_tracing.hpp:116:30: note: 
      116 |             PolygonDistance( index_t polygon_in,
          |                              ^
    /__w/OpenGeode/OpenGeode/include/geode/mesh/helpers/ray_tracing.hpp:117:17: note: 'index_t' and 'double' may be implicitly converted: 'index_t' (as 'unsigned int') -> 'double', 'double' -> 'index_t' (as 'unsigned int')
      117 |                 double distance_in,
          |                 ^
  • src/geode/mesh/helpers/ray_tracing.cpp:494:14: warning: [readability-function-cognitive-complexity]

    function 'compute' has cognitive complexity of 20 (threshold 10)

      494 |         bool compute( index_t polygon_id )
          |              ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:498:13: note: +1, including nesting penalty of 0, nesting level increased to 1
      498 |             for( const auto edge :
          |             ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:508:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      508 |                 if( result.first == POSITION::outside )
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:512:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      512 |                 if( auto intersection =
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:518:21: note: +3, including nesting penalty of 2, nesting level increased to 3
      518 |                     if( Vector3D{ origin_, intersection_result }.dot(
          |                     ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:528:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      528 |                 for( const auto edge2 : LRange{ 3 } )
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:534:21: note: +3, including nesting penalty of 2, nesting level increased to 3
      534 |                     if( ray_edge_distance > GLOBAL_EPSILON )
          |                     ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:540:21: note: +3, including nesting penalty of 2, nesting level increased to 3
      540 |                     if( origin_target.dot( segment_.direction() ) < 0 )
          |                     ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:549:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      549 |                 if( triangle_distance > GLOBAL_EPSILON )
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/helpers/ray_tracing.cpp:555:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      555 |                 if( origin_target.dot( segment_.direction() ) < 0 )
          |                 ^
  • tests/mesh/test-ray-tracing.cpp:51:42: warning: [cppcoreguidelines-avoid-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       51 |         builder->create_polygon( { 3, 4, 5 } );
          |                                          ^
  • tests/mesh/test-ray-tracing.cpp:63:13: warning: [bugprone-unchecked-optional-access]

    unchecked access to optional value

       63 |             result->polygon == 0, "Ray inside wrong polygon" );
          |             ^
  • tests/mesh/test-ray-tracing.cpp:65:13: warning: [bugprone-unchecked-optional-access]

    unchecked access to optional value

       65 |             result->distance == 1, "Ray inside wrong distance" );
          |             ^
  • tests/mesh/test-ray-tracing.cpp:91:13: warning: [bugprone-unchecked-optional-access]

    unchecked access to optional value

       91 |             result->polygon == 1, "Ray edge wrong polygon" );
          |             ^
  • tests/mesh/test-ray-tracing.cpp:93:13: warning: [bugprone-unchecked-optional-access]

    unchecked access to optional value

       93 |             result->distance == 1, "Ray edge wrong distance" );
          |             ^
  • tests/mesh/test-ray-tracing.cpp:118:13: warning: [bugprone-unchecked-optional-access]

    unchecked access to optional value

      118 |             result->polygon == 0, "Ray edge wrong polygon" );
          |             ^
  • tests/mesh/test-ray-tracing.cpp:120:13: warning: [bugprone-unchecked-optional-access]

    unchecked access to optional value

      120 |             result->distance == 1, "Ray edge wrong distance" );
          |             ^

Have any feedback or feature suggestions? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants