shapes: fix SimplePore side-sign at lower pore mouth (bug-sweep #13)#5387
Draft
RudolfWeeber wants to merge 1 commit into
Draft
shapes: fix SimplePore side-sign at lower pore mouth (bug-sweep #13)#5387RudolfWeeber wants to merge 1 commit into
RudolfWeeber wants to merge 1 commit into
Conversation
SimplePore::calculate_dist determined the inside/outside side in the smoothing (torus) corner using the signed z in `Utils::sqr(z - c_z)`, while dist_half_pore and every other use of z in the side logic (the `std::abs(z) > m_half_length` and `std::abs(z) >= c_z` guards) use |z|. The function documents mirror symmetry in z about the center, so at the negative-z mouth this forced side=+1 (outside) even for a point inside the solid wall material, flipping the sign of the returned distance. The constraint force then points the wrong way and particles can penetrate the lower mouth — asymmetric, silently wrong physics. The sibling Cylinder::calculate_dist uses |z| in its analogous test. Fix: use `Utils::sqr(std::abs(z) - c_z)` so the side determination is mirror-symmetric, matching the rest of the function. This is a no-op for z >= 0, so the previously-tested +z mouth is unchanged. Add SimplePore_test.cpp asserting mirror symmetry of the signed distance between the +z and -z mouths inside the smoothing fillet, and that a point inside the solid reports a negative distance at both mouths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SimplePore::calculate_dist determined the inside/outside side in the
smoothing (torus) corner using the signed z in
Utils::sqr(z - c_z), while dist_half_pore and every other use of z inthe side logic (the
std::abs(z) > m_half_lengthandstd::abs(z) >= c_zguards) use |z|. The function documents mirror symmetry in z about the
center, so at the negative-z mouth this forced side=+1 (outside) even for a
point inside the solid wall material, flipping the sign of the returned
distance. The constraint force then points the wrong way and particles can
penetrate the lower mouth — asymmetric, silently wrong physics. The sibling
Cylinder::calculate_dist uses |z| in its analogous test.
Fix: use
Utils::sqr(std::abs(z) - c_z)so the side determination ismirror-symmetric, matching the rest of the function. This is a no-op for
z >= 0, so the previously-tested +z mouth is unchanged.
Add SimplePore_test.cpp asserting mirror symmetry of the signed distance
between the +z and -z mouths inside the smoothing fillet, and that a point
inside the solid reports a negative distance at both mouths.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
🤖 Generated with Claude Code