Repository navigation
BUG: getFZQuat returns one FZ quaternion for every equivalent orientation - #64
Closed
imikejackson wants to merge 3 commits into
Closed
imikejackson wants to merge 3 commits into
imikejackson wants to merge 3 commits into
Conversation
imikejackson
marked this pull request as draft
November 3, 2026 15:37
imikejackson
marked this pull request as ready for review
November 3, 2026 19:01
joeykleingers
requested changes
Nov 3, 2026
…tion ConvertToFZ returned the input unchanged as soon as it was inside the fundamental zone, and otherwise the first symmetry image inside it. On the FZ boundary two symmetry-equivalent orientations are both inside, so equivalent inputs gave different FZ quaternions (for example the +/-45 degree rotations about [001] in cubic m-3m). - Inputs strictly inside the FZ (still inside after the Rodrigues length is scaled by 1 + 1e-6) are returned unchanged, as before. - Other inputs check every symmetry image inside the FZ and pick the largest (w, x, y, z) with a 1e-10 tolerance. The sign of 180 degree rotations is fixed so that q and -q give the same result. - Remove the always-true w() < 1.0E5 check. - InsideCyclicFZ accepts points within 1e-10 of the boundary, so roundoff no longer makes every image of a boundary point fail the check. - Add CubicBoundaryUnique and an all-Laue-class SymmetryOrbitUnique test. Fixes BlueQuartzSoftware#63
…ions getFZQuat returned the all-infinity quaternion for some inputs in the cyclic (2/m, 4/m, -3, 6/m) and 4/mmm Laue classes, because no symmetry image passed the FZ check. The checks come from EMsoftOO and have the same problem there. - InsideCyclicFZ uses the quaternion form |n| sin(t/2) <= tan(pi/2n) cos(t/2) + eps of the slab test. The Rodrigues form multiplied a roundoff axis component (about 3e-17) by a length of about 1e16, and for infinite lengths required the axis component to be exactly 0. - IsInsideFZ(QuatD) builds the cyclic test from the quaternion, because toRodrigues sets the length to infinity for w < 1e-8. - InsideDihedralFZ adds eps to the FourFold comparisons and the sqrt(3) early-out, like the other orders. - ConvertToFZ skips the interior fast path for cyclic FZs. The slab is unbounded, so near-180 degree images about different basal axes are all inside it with radial margin. - Extend SymmetryOrbitUnique with near-180, 90 and 120 degree inputs and require a finite result.
- Keep w non-negative after the half-turn sign fix. - Select the representative by the maximum of each component in turn (w, x, y, z) within tolerance, so the result does not depend on the order of the symmetry operators. Use a fixed stack buffer. - Restore the interior fast path for cyclic Laue classes. - Merge the identical doM branches in InsideCyclicFZ and name the interior margin. - Test that results have w >= 0 and the largest |w| in the orbit, and add inputs near 1e-10 from tie points. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
imikejackson
force-pushed
the
topic/fz_boundary_unique
branch
from
November 11, 2026 23:22
164bde3 to
31ccd2b
Compare
This was referenced Nov 13, 2026
Collaborator
Author
|
Closed in favor of #86, which merges this branch (with its history) together with the other open EbsdLib fixes for the next release, so simplnx can build against one EbsdLib branch. The branch is kept. 🤖 Generated with Claude Code |
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
getFZQuat(throughLaueOps::ConvertToFZ) now returns the same fundamental-zone (FZ) quaternion for every symmetry-equivalent orientation, including orientations on the FZ boundary.Fixes #63. Originally reported as BlueQuartzSoftware/DREAM3D#458.
Problem
ConvertToFZreturned the input unchanged if it was inside the FZ. Otherwise it returned the first symmetry image inside the FZ. On the FZ boundary, two equivalent orientations are both inside, so they gave different results. Example for cubic m-3m: the +45° and -45° rotations about [001] are equivalent, but their FZ quaternions were 0.765 apart.Changes
LaueOps::ConvertToFZ1 + 1e-6, it is strictly inside and is returned unchanged. This is the same result as before for interior points.(w, x, y, z), compared in that order with a1e-10tolerance. The result does not depend on which equivalent orientation was the input.qand-qare the same rotation whenwis 0. The sign is fixed (first non-zero of x, y, z is positive) before the comparison.normalizedQuat.w() < 1.0E5check. It was always true.FZ checks that rejected every symmetry image (second commit)
An independent check against MTEX (below) found inputs in the 2/m, 4/m, -3, 6/m and 4/mmm Laue classes where no symmetry image passed the FZ check, so
getFZQuatreturned the all-infinity quaternion.developfails on the same inputs. The checks come from EMsoftOO, which has the same defect.InsideCyclicFZ: uses the quaternion form of the slab test,|n| sin(θ/2) <= tan(π/2n) cos(θ/2) + eps. The Rodrigues form multiplied a roundoff axis component (about 3e-17) by a length of about 1e16 for near-180° rotations. For infinite lengths it required the axis component to be exactly0.0.IsInsideFZ(QuatD): builds the cyclic test directly from the quaternion, becausetoRodriguessets the length to infinity forw < 1e-8.InsideDihedralFZ: the FourFold (422) comparisons and thesqrt(3)early-out get the same+ epsas the other orders.ConvertToFZ: skips the interior fast path for cyclic FZs. The cyclic FZ is an unbounded slab, so near-180° images about different basal axes are all inside it with radial margin, and the margin test cannot detect the tie. Cyclic groups have at most 6 operators.tol = 1.0D+5clamp, of which the removedw() < 1.0E5check was a mistranslation, is not ported. It turns valid near-180° representatives into infinite ones and rejects them.Tests
ConvertToFundamentalZoneTest::CubicBoundaryUnique: the ±45° about [001] case. It fails ondevelop(distance 0.7653668647) and passes with this change.ConvertToFundamentalZoneTest::SymmetryOrbitUnique: for every Laue class, every symmetry operators, and bothqand-q, checks thatgetFZQuat(s * q)is finite, equalsgetFZQuat(q)up to sign, and is inside the FZ. The inputs are boundary orientations (45°, 60°, 90°, 120° and 180° about [001], [100], [110], [101] and [111], each also offset by ±1e-12, ±1e-9 and ±1e-6 rad), roundoff-bearing 180° rotations, symmetry images from other Laue classes, and 128 random orientations with a fixed seed.ConvertToFundamentalZoneTestdata comparison is unchanged and passes.ci-macos-arm64preset, HDF5 on, run serially): 430/430 passed.Independent check against MTEX 6.1.0
32,398 orientations were reduced in all 12 Laue classes by this branch, by the
developalgorithm, and by MTEXproject2FundamentalRegion. The inputs were 2,000 random orientations plus boundary orientations and their full symmetry orbits.developand MTEX agree to 6e-16 in every class.1e-10tie tolerance.developgives up to 6 different results per orbit, and MTEX gives up to 4. MTEX, like EMsoftOO, keeps the first symmetry image it finds on a tie.developreturned the all-infinity quaternion for 1,446 inputs, and this branch for none.Notes for reviewers
1e-6(relative) of the FZ boundary. Downstream code that compares FZ quaternions with exemplar files (for example simplnxComputeFZQuaternions) may see different values for boundary points after updating EbsdLib.IsInsideFZcall.