|
20 | 20 | */ |
21 | 21 | package org.biojava.nbio.structure.geometry; |
22 | 22 |
|
23 | | -import static org.junit.Assert.*; |
24 | | - |
25 | | -import java.util.Random; |
| 23 | +import org.junit.Ignore; |
| 24 | +import org.junit.Test; |
| 25 | +import org.slf4j.Logger; |
| 26 | +import org.slf4j.LoggerFactory; |
26 | 27 |
|
27 | 28 | import javax.vecmath.AxisAngle4d; |
28 | 29 | import javax.vecmath.Matrix4d; |
29 | 30 | import javax.vecmath.Point3d; |
30 | 31 | import javax.vecmath.Vector3d; |
| 32 | +import java.util.Random; |
31 | 33 |
|
32 | | -import org.biojava.nbio.structure.geometry.SuperPositionQuat; |
33 | | -import org.biojava.nbio.structure.geometry.SuperPositionQCP; |
34 | | -import org.junit.Test; |
35 | | -import org.slf4j.Logger; |
36 | | -import org.slf4j.LoggerFactory; |
| 34 | +import static org.junit.Assert.assertEquals; |
| 35 | +import static org.junit.Assert.assertTrue; |
37 | 36 |
|
38 | 37 | /** |
39 | 38 | * Test the Quaternion-Based Characteristic Polynomial {@link SuperPositionQCP} |
@@ -166,4 +165,23 @@ public void testAlternativeUsageQCP() { |
166 | 165 |
|
167 | 166 | } |
168 | 167 |
|
| 168 | + @Ignore("test for https://github.com/biojava/biojava/issues/914") |
| 169 | + @Test |
| 170 | + public void shouldHandleTwoFoldSymmetry() { |
| 171 | + Matrix4d operator = new Matrix4d(-1, 0, 0, 0, |
| 172 | + 0, 1, 0, 0, |
| 173 | + 0, 0, -1, 0, |
| 174 | + 0, 0, 0, 1); |
| 175 | + |
| 176 | + // add some jitter - otherwise rotation matrix will contain NaN |
| 177 | + Point3d[] original = new Point3d[] { new Point3d(0, 0, 0), new Point3d(1.001, 0, 0) }; |
| 178 | + Point3d[] transformed = new Point3d[] { new Point3d(0, 0, 0), new Point3d(-1, 0, 0) }; |
| 179 | + |
| 180 | + SuperPosition sqcp = new SuperPositionQCP(false); |
| 181 | + |
| 182 | + // operator 2 is a 2-fold, trace should be == -1 |
| 183 | + Matrix4d m = sqcp.superposeAndTransform(original, transformed); |
| 184 | + assertEquals(-1.0, m.m00 + m.m11 + m.m22, 0.001); |
| 185 | + assertEquals(0.0, CalcPoint.rmsd(original, transformed), 0.001); |
| 186 | + } |
169 | 187 | } |
0 commit comments