Exemple #1
0
    def test_compose(self):
        s1 = Similarity(self.s, self.r, self.t)
        s2 = Similarity(0.75, Rotation.from_rodrigues([-0.5, -0.5, 1.0]),
                        EigenArray.from_iterable([4, 6.5, 8]))

        sim_comp = s1.compose(s2).as_matrix()
        mat_comp = numpy.dot(s1.as_matrix(), s2.as_matrix())
        print 'sim12 comp:\n', sim_comp
        print 'mat comp:\n', mat_comp
        print 'sim - mat:\n', sim_comp - mat_comp
        nose.tools.assert_almost_equal(
            numpy.linalg.norm(sim_comp - mat_comp, 2), 0., 14)
Exemple #2
0
    def test_compose_convert(self):
        # Composing across types should work
        s1 = Similarity(self.s, self.r, self.t)
        s2 = Similarity(0.75, Rotation.from_rodrigues([-0.5, -0.5, 1.0]),
                        EigenArray.from_iterable([4, 6.5, 8]), ctypes.c_float)

        sim_comp = s1.compose(s2).as_matrix()
        mat_comp = numpy.dot(s1.as_matrix(), s2.as_matrix())
        print('sim12 comp:\n', sim_comp)
        print('mat comp:\n', mat_comp)
        print('sim - mat:\n', sim_comp - mat_comp)
        nose.tools.assert_almost_equal(
            numpy.linalg.norm(sim_comp - mat_comp, 2), 0., 6)
Exemple #3
0
    def test_compose(self):
        s1 = Similarity(self.s, self.r, self.t)
        s2 = Similarity(0.75,
                        Rotation.from_rodrigues([-0.5, -0.5, 1.0]),
                        [4, 6.5, 8])

        sim_comp = s1.compose(s2).as_matrix()
        mat_comp = numpy.dot(s1.as_matrix(), s2.as_matrix())
        print('sim12 comp:\n', sim_comp)
        print('mat comp:\n', mat_comp)
        print('sim - mat:\n', sim_comp - mat_comp)
        nose.tools.assert_almost_equal(
            numpy.linalg.norm(sim_comp - mat_comp, 2),
            0., 12
        )