def test_checks(self):
        R = np.zeros((10, 10))
        fail("rotation_matrix", R)
        R = random_rotation()
        R[0, 2] += R[0, 1]
        fail("rotation_matrix", R)

        R = random_rotation()
        R *= 2
        fail("rotation_matrix", R)
    def test_checks(self):
        R = np.zeros((10, 10))
        fail('rotation_matrix', R)
        R = random_rotation()
        R[0, 2] += R[0, 1]
        fail('rotation_matrix', R)

        R = random_rotation()
        R *= 2
        fail('rotation_matrix', R)
    def test_checks(self):
        if not self.is_contracts_active():
            return
        R = np.zeros((10, 10))
        fail('rotation_matrix', R)
        R = random_rotation()
        R[0, 2] += R[0, 1]
        fail('rotation_matrix', R)

        R = random_rotation()
        R *= 2
        fail('rotation_matrix', R)
    def test_checks(self):
        if not self.is_contracts_active():
            return
        R = np.zeros((10, 10))
        fail('rotation_matrix', R)
        R = random_rotation()
        R[0, 2] += R[0, 1]
        fail('rotation_matrix', R)

        R = random_rotation()
        R *= 2
        fail('rotation_matrix', R)
Exemple #5
0
 def compute_performer_start(self) -> Dict[str, Dict[str, float]]:
     """Compute the starting location (position & rotation) for the performer. Must return the same thing on
     multiple calls. This default implementation chooses a random location."""
     if self._performer_start is None:
         self._performer_start = {
             'position': {
                 'x': geometry.random_position(),
                 'y': 0,
                 'z': geometry.random_position()
             },
             'rotation': {
                 'y': geometry.random_rotation()
             }
         }
     return self._performer_start
Exemple #6
0
def best_similarity_transform_test():
    N = 20
    for K in [3]: # TODO: multiple dimensions
        X = np.random.randn(K, N)

        R = random_rotation()
#        R = np.eye(K)
        t = np.random.randn(K, 1)
#        print 'R: %s' % R 
#        print 't: %s' % t

        Y = np.dot(R, X) + t
        R2, t2 = best_similarity_transform(X, Y)
#        print 'R2: %s' % R2 
#        print 't2: %s' % t2
        Y2 = np.dot(R2, X) + t2

        assert_allclose(R, R2, atol=1e-10)
        assert_allclose(t, t2)

        assert_allclose(Y, Y2)
Exemple #7
0
def best_similarity_transform_test():
    N = 20
    for K in [3]:  # TODO: multiple dimensions
        X = np.random.randn(K, N)

        R = random_rotation()
        #        R = np.eye(K)
        t = np.random.randn(K, 1)
        #        print 'R: %s' % R
        #        print 't: %s' % t

        Y = np.dot(R, X) + t
        R2, t2 = best_similarity_transform(X, Y)
        #        print 'R2: %s' % R2
        #        print 't2: %s' % t2
        Y2 = np.dot(R2, X) + t2

        assert_allclose(R, R2, atol=1e-10)
        assert_allclose(t, t2)

        assert_allclose(Y, Y2)
 def test_random_rotations(self):
     for i in range(N):  #@UnusedVariable
         random_rotation()
Exemple #9
0
def rotations_sequence():
    yield np.eye(3)
    # TODO: add special values
    for i in range(N):  # @UnusedVariable
        yield random_rotation()
 def test_random_rotations(self):
     for i in range(N):  # @UnusedVariable
         random_rotation()
Exemple #11
0
def best_orthogonal_transform_test1():
    X = random_directions(20)
    R = random_rotation()
    Y = np.dot(R, X)
    R2 = best_orthogonal_transform(X, Y)
    assert_allclose(R, R2)
Exemple #12
0
def closest_orthogonal_matrix_test1():
    R = random_rotation()
    R2 = closest_orthogonal_matrix(R)
    assert_allclose(R, R2)
Exemple #13
0
def best_orthogonal_transform_test1():
    X = random_directions(20)
    R = random_rotation()
    Y = np.dot(R, X)
    R2 = best_orthogonal_transform(X, Y)
    assert_allclose(R, R2)
Exemple #14
0
def closest_orthogonal_matrix_test1():
    R = random_rotation()
    R2 = closest_orthogonal_matrix(R)
    assert_allclose(R, R2)
Exemple #15
0
def rotations_sequence():
    yield np.eye(3)
    # TODO: add special values
    for i in range(N):  # @UnusedVariable
        yield random_rotation()