Exemplo n.º 1
0
def random_circle_at_origin():
    """
    Creates a random circle at the origin
    """
    mv_a = random_euc_mv()
    mv_r = random_euc_mv()
    r = generate_rotation_rotor(np.pi / 2, mv_a, mv_r)
    mv_b = r * mv_a * ~r
    mv_c = r * mv_b * ~r
    pp = (up(mv_a) ^ up(mv_b) ^ up(mv_c)).normal()
    return pp
Exemplo n.º 2
0
def random_circle_at_origin():
    """
    Creates a random circle at the origin
    """
    mv_a = random_euc_mv()
    mv_r = random_euc_mv()
    r = generate_rotation_rotor(np.pi/2, mv_a, mv_r)
    mv_b = r*mv_a*~r
    mv_c = r * mv_b * ~r
    pp = (up(mv_a) ^ up(mv_b) ^ up(mv_c) ).normal()
    return pp
Exemplo n.º 3
0
    def test_generate_rotation_rotor_and_angle(self):
        """
        Checks rotation rotor generation
        """
        from clifford.tools.g3 import generate_rotation_rotor, random_unit_vector, angle_between_vectors
        for i in range(1000):
            euc_vector_m = random_unit_vector()
            euc_vector_n = random_unit_vector()
            theta = angle_between_vectors(euc_vector_m, euc_vector_n)

            rot_rotor = generate_rotation_rotor(theta, euc_vector_m, euc_vector_n)
            v1 = euc_vector_m
            v2 = rot_rotor*euc_vector_m*~rot_rotor
            theta_return = angle_between_vectors(v1, v2)

            testing.assert_almost_equal(theta_return, theta)
            testing.assert_almost_equal(euc_vector_n.value, v2.value)
Exemplo n.º 4
0
    def test_generate_rotation_rotor_and_angle(self, rng):  # noqa: F811
        """
        Checks rotation rotor generation
        """
        from clifford.tools.g3 import generate_rotation_rotor, random_unit_vector, angle_between_vectors
        for i in range(1000):
            euc_vector_m = random_unit_vector(rng=rng)
            euc_vector_n = random_unit_vector(rng=rng)
            theta = angle_between_vectors(euc_vector_m, euc_vector_n)

            rot_rotor = generate_rotation_rotor(theta, euc_vector_m,
                                                euc_vector_n)
            v1 = euc_vector_m
            v2 = rot_rotor * euc_vector_m * ~rot_rotor
            theta_return = angle_between_vectors(v1, v2)

            testing.assert_almost_equal(theta_return, theta)
            testing.assert_almost_equal(euc_vector_n.value, v2.value)
Exemplo n.º 5
0
    def test_generate_rotation_rotor_and_angle(self):
        """
        Checks rotation rotor generation
        """
        from clifford.tools.g3 import generate_rotation_rotor, random_unit_vector, angle_between_vectors

        euc_vector_m = random_unit_vector()
        euc_vector_n = random_unit_vector()
        theta = angle_between_vectors(euc_vector_m, euc_vector_n)
        print(theta)

        rot_rotor = generate_rotation_rotor(theta, euc_vector_m, euc_vector_n)
        v1 = euc_vector_m
        v2 = rot_rotor * euc_vector_m * ~rot_rotor
        theta_return = angle_between_vectors(v1, v2)
        print(theta_return)

        testing.assert_almost_equal(theta_return, theta)
        testing.assert_almost_equal(euc_vector_n.value, v2.value)