Ejemplo n.º 1
0
    def test_rotation_norm(self):
        # two triangles rotated by 90 degrees
        points1 = np.array([[0, 0], [3, 0], [3, -2]])
        rotation = np.array([[0, 1], [-1, 0]])
        points2 = np.dot(points1, rotation)

        n = _difference_norm(points1,
                             points2,
                             embedding="ase",
                             test_case="rotation")
        self.assertAlmostEqual(n, 0)
Ejemplo n.º 2
0
    def test_scalar_rotation_norm(self):
        # triangle in 2d
        points1 = np.array([[0, 0], [3, 0], [3, -2]], dtype=np.float64)
        rotation = np.array([[0, 1], [-1, 0]])
        # rotated 90 degrees
        points2 = np.dot(points1, rotation)
        # scaled
        points2 = 2 * points2

        n = _difference_norm(points1,
                             points2,
                             embedding="ase",
                             test_case="scalar-rotation")
        self.assertAlmostEqual(n, 0)
Ejemplo n.º 3
0
    def test_diagonal_rotation_norm(self):
        # triangle in 2d
        points1 = np.array([[0, 0], [3, 0], [3, -2]], dtype=np.float64)
        rotation = np.array([[0, 1], [-1, 0]])
        # rotated 90 degrees
        points2 = np.dot(points1, rotation)
        # diagonally scaled
        diagonal = np.array([[2, 0, 0], [0, 3, 0], [0, 0, 2]])
        points2 = np.dot(diagonal, points2)

        n = _difference_norm(points1,
                             points2,
                             embedding="ase",
                             test_case="diagonal-rotation")
        self.assertAlmostEqual(n, 0)