Repository navigation
BUG: Clamp cosines before acos in Compute Twin Boundaries - #1972
Closed
imikejackson wants to merge 1 commit into
Closed
imikejackson wants to merge 1 commit into
imikejackson wants to merge 1 commit into
Conversation
- ComputeTwinBoundaries passed the cosine between the misorientation axis and the crystal-frame face normal, and the cosine between the axis and <111>, to acos() without clamping. A parallel pair can round to 1 + 1 ulp, acos() returns NaN, and the comparison with the tolerance fails, so a coherent Sigma 3 twin was reported as no twin. - Both cosines are now clamped to [-1, 1] before acos(), in the incoherence path and in the twin-only path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
4 of 7 tasks
Contributor
Author
|
Closed in favor of #1973, which merges this branch (with its history) together with the other EBSD fixes that need the next EbsdLib release (BlueQuartzSoftware/EbsdLib#86). The branch is kept. 🤖 Generated with Claude Code |
This was referenced Nov 13, 2026
imikejackson
added a commit
to imikejackson/simplnx
that referenced
this pull request
Nov 14, 2026
…Software#1972) Originally simplnx BlueQuartzSoftware#1972 (branch fix/twin-boundaries-acos-clamp), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
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.
Summary
Compute Twin Boundaries called
acos()on two cosines without clamping them (ComputeTwinBoundaries.cpp):GeometryMath::CosThetaBetweenVectors()(FindTwinBoundaryIncoherence()), andIsTwinBoundary()andFindTwinBoundaryIncoherence()).For a parallel pair, rounding can give 1 + 1 ulp.
acos()then returns NaN, every comparison with the tolerance is false, and a coherent Σ3 twin boundary is reported as no twin (flag 0, no incoherence), with no error or warning.Change: both cosines are clamped to [-1, 1] with
std::clampbeforeacos(). A value inside [-1, 1] is unchanged, so valid output does not change; the existing exemplar tests pass unchanged. No new error codes.EbsdLib #80 adds the same clamp inside EbsdLib; this call site computes its own cosines, so it needs its own clamp.
Existing branches and open pull requests: no branch on
originorforkother than this one has commits that touchComputeTwinBoundaries.cppor its test, and no open pull request changes them.Test Plan
OrientationAnalysis::ComputeTwinBoundariesFilter: Exact Sigma 3 Twin With Parallel Normalfails ondevelop(0cd2009) and passes with this change. It builds 4000 faces between an identity Feature and its Σ3 twin (60° about [111]), each with a face normal that is a positive multiple of [111]. By hand calculation every face is a coherent twin with incoherence 0. Ondevelop, 20 of the 4000 faces (for example faces 43, 170, 184, 253) are reported as not twin.ctest -R "OrientationAnalysis::ComputeTwinBoundariesFilter".bluequartz-skills:cpp-best-practices,bluequartz-skills:simplnx-best-practices,filter-implementation,implement-filter-tests,dual-build-protocol,clang-format,github-workflow.docs/Coding_Knowledge_Base.mdwas followed instead.Related Issue
Related to #1875 (item
ComputeTwinBoundariesFilter#4) and BlueQuartzSoftware/EbsdLib#80.🤖 Generated with Claude Code