Skip to content

Commit 5093398

Browse files
NicoKiaruclaude
authored andcommitted
fix: reject axis permutations in isExlusiveTranslation
The old test coupled the off-diagonal check to val != 1.0, so an off-diagonal entry equal to 1.0 (e.g. an axis permutation) was not disqualified. Such matrices were misclassified as pure translations and simplifyAffineGet then rebuilt them from the last column only, silently dropping the permutation. Replace the conflated condition with the three explicit rules: the translation column accepts any value, diagonal entries must be 1, and off-diagonal entries must be 0. Permutations now fall through to the lossless generic affine copy. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f0a58cf commit 5093398

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/net/imglib2/realtransform/RealViewsSimplifyUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ public static boolean isExlusiveTranslation( final AffineGet affineGet )
108108
for ( int c = 0; c < n + 1; ++c )
109109
{
110110
final double val = affineGet.get( r, c );
111-
if ( val != 0.0 && ( ( r == c && val != 1.0 ) || ( c != n && val != 1.0 ) ) ) { return false; }
111+
if ( c == n ) { continue; } // translation column: any value allowed
112+
if ( r == c ) { if ( val != 1.0 ) { return false; } } // diagonal must be 1
113+
else if ( val != 0.0 ) { return false; } // off-diagonal must be 0
112114
}
113115
}
114116

0 commit comments

Comments
 (0)