Skip to content

Fixes InOutOctree samping on surface boundary - #1909

Merged
kennyweiss merged 16 commits into
developfrom
bugfix/kweiss/inoutoctree-on-surface
Jul 15, 2026
Merged

Fixes InOutOctree samping on surface boundary#1909
kennyweiss merged 16 commits into
developfrom
bugfix/kweiss/inoutoctree-on-surface

Conversation

@kennyweiss

@kennyweiss kennyweiss commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

  • This PR is a bugfix with some minor refactoring
  • It fixes the InOutOctree for samples on (or very close to) the surface boundary, which was previously inconsistent about whether such points are considered inside or outside the surface.
    • By convention, we consider these points to be inside the contained volume, and this is consistent with our winding number treatment
    • In addition to fixing the tests, I added some regression tests for this, and compared the results to those of the winding number for 2D points on the unit square and 3D points on the unit cube
    • This also make our sample-based shaping results for inout-based sampling and winding-based sampling more consistent on the "heroic roses" dataset, so I updated the REGEX check on our regression test
  • I also added a runtime switch to output debug/visualization files of the generated octrees, and wired those through the containment_driver and shaping_driver examples
  • Misc: I slightly refactored the containment_driver and InOutOctree to replace SFINAE w/ if constexpr, and to use a variant for the 2D and 3D octrees, since we can only have one of these within the containment driver application
  • Resolves Improve handling of points on surface for InOutOctree #611
  • Companion PR to axom_data repository: Update containment regression baselines after bugfix for points on/near surface axom_data#39

@kennyweiss kennyweiss added this to the FY26 August release milestone Jul 9, 2026
@kennyweiss kennyweiss self-assigned this Jul 9, 2026
@kennyweiss kennyweiss added bug Something isn't working Quest Issues related to Axom's 'quest' component maintenance Issues related to code maintenance labels Jul 9, 2026
Comment on lines +1310 to +1321

// First, handle the case where the query point lies on (or within the vertex welding tolerance of)
// one of the block's segments. Such points are 'within' the surface by convention,
// but the ray-orientation test below is degenerate for them.
for(int i = 0; i < numSegments; ++i)
{
if(primal::squared_distance(queryPt, m_meshWrapper.cellPositions(segmentSet[i])) <=
m_vertexWeldThresholdSquared)
{
return true;
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the 2D bugfix

Comment on lines +1170 to +1180
// First, handle the case where the query point lies on (or within the vertex welding tolerance of)
// one of the block's triangles. Such points are 'within' the surface by convention,
// but the ray-orientation test below is degenerate for them.
for(int i = 0; i < numTris; ++i)
{
if(primal::squared_distance(queryPt, m_meshWrapper.cellPositions(triSet[i])) <=
m_vertexWeldThresholdSquared)
{
return true;
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the 3D bugfix

Comment thread src/axom/quest/examples/containment_driver.cpp
Comment thread src/axom/quest/InOutOctree.hpp
Comment thread src/axom/quest/tests/quest_inout_octree.cpp Outdated
Comment thread src/axom/quest/tests/quest_inout_octree.cpp Outdated
Comment thread src/axom/quest/tests/quest_inout_octree.cpp Outdated
Comment thread src/axom/quest/tests/quest_inout_octree.cpp Outdated
Comment thread src/axom/quest/tests/quest_inout_quadtree.cpp Outdated
Comment thread src/axom/quest/tests/quest_inout_quadtree.cpp Outdated
@kennyweiss
kennyweiss force-pushed the bugfix/kweiss/inoutoctree-on-surface branch from 5383879 to b329970 Compare July 9, 2026 20:04
By convention, such points should be categorized as "Inside".
By conention, such points should be categorized as "Inside".
... and exposes this as an option in the quest containment and shaping examples.

This was previously exposed through a compile-time ifdef.
…tOctree

After our bugfix, the volume for the "black" material
increased from 36,595 to 36,662.53, which better matches
the computed volume from the winding-based approach (36,653.78).
The difference between the two is now 8.74 (~0.024%).
The 2D and 3D functions were sufficiently different that I kept them separate, so this is mostly cosmetic
…cific InOutOctree::withinGrayBlock*D implementation

This was vestigial from the earlier SFINAE formulation.
Also addresses PR suggestions about comments in new tests.
This ensures that we are using the same on-surface check in the octree and its comparison tests.
This file was last updated before our move to C++17, so I took this opportunity to update the file a bit.
There are no functional changes in this commit.
@kennyweiss
kennyweiss force-pushed the bugfix/kweiss/inoutoctree-on-surface branch from 5e08126 to 42b62b1 Compare July 15, 2026 18:37
@kennyweiss
kennyweiss merged commit 144a0ee into develop Jul 15, 2026
15 checks passed
@kennyweiss
kennyweiss deleted the bugfix/kweiss/inoutoctree-on-surface branch July 15, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working maintenance Issues related to code maintenance Quest Issues related to Axom's 'quest' component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve handling of points on surface for InOutOctree

3 participants