How to use the clifford.tools.g3.random_euc_mv function in clifford

To help you get started, we’ve selected a few clifford examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pygae / clifford / test / test_g3c_tools.py View on Github external
def test_apply_rotor(self):
        mv = []
        for i in range(100):
            p = random_euc_mv()
            mv.append(p)
        test_array = ConformalMVArray(mv)
        up_array = test_array.up()

        # Test apply rotor
        for i in range(100):
            R = ConformalMVArray([self.layout.randomRotor()])
            rotated_array = up_array.apply_rotor(R)
            for i, v in enumerate(rotated_array):
                np.testing.assert_almost_equal(v.value, apply_rotor(up_array[i], R[0]).value)
github pygae / clifford / test / test_g3c_tools.py View on Github external
def test_from_value_array(self):
        mv = []
        for i in range(100):
            p = random_euc_mv()
            mv.append(p)
        test_array = ConformalMVArray(mv)
        up_array = test_array.up()
        new_mv_array = ConformalMVArray.from_value_array(up_array.value)
        np.testing.assert_almost_equal(new_mv_array.value, up_array.value)
github pygae / pyganja / test_pyganja.py View on Github external
def test_draw_points(self):
        from clifford.tools.g3 import random_euc_mv
        from clifford.g3 import layout
        gs = GanjaScene()
        gs.add_objects([random_euc_mv().value[0:8] for i in range(10)], static=False)
        with open('test_file.html', 'w') as test_file:
            test_file.write(generate_full_html(str(gs), sig=layout.sig, grid=True, scale=1.0, gl=True))
        render_cef_script(str(gs), sig=layout.sig, grid=True, scale=1.0, gl=False)
github pygae / clifford / test / test_g3c_tools.py View on Github external
def test_general_logarithm_translation(self):
        # Check we can reverse translation
        for i in range(50):
            t = random_euc_mv()
            biv = ninf * t /2
            R = general_exp(biv).normal()
            biv_2 = general_logarithm(R)
            np.testing.assert_almost_equal(biv.value, biv_2.value)
github pygae / clifford / test / test_g3c_tools.py View on Github external
def test_fit_plane(self):
        try:
            noise = 0.1
            trueP = random_plane()
            point_list = project_points_to_plane([random_conformal_point() for i in range(100)], trueP)
            point_list = [up(down(P) + noise * random_euc_mv()) for P in point_list]
            print(trueP)
            plane = fit_plane(point_list)
            print(plane)
            #draw(point_list + [plane], static=False, scale=0.1)
        except:
            print('FAILED TO FIND PLANE')
github pygae / clifford / clifford / tools / g3c / __init__.py View on Github external
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
github pygae / clifford / clifford / tools / g3c / __init__.py View on Github external
def random_line():
    """
    Creates a random line
    """
    mv_a = random_euc_mv()
    mv_b = random_euc_mv()
    line_a = ((up(mv_a) ^ up(mv_b) ^ ninf)).normal()
    return line_a
github pygae / clifford / clifford / tools / g3c / __init__.py View on Github external
def random_translation_rotor(maximum_translation=10.0):
    """ generate a random translation rotor """
    return generate_translation_rotor(random_euc_mv(maximum_translation))
github pygae / clifford / clifford / tools / g3c / __init__.py View on Github external
def random_point_pair():
    """
    Creates a random point pair bivector object
    """
    mv_a = random_euc_mv()
    mv_b = random_euc_mv()
    pp = (up(mv_a) ^ up(mv_b)).normal()
    return pp
github pygae / clifford / clifford / tools / g3c / __init__.py View on Github external
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