How to use the vector.Vec function in vector

To help you get started, we’ve selected a few vector 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 benshope / PyOpenCL-Tutorial / examples / enja / part2 / main.py View on Github external
def __init__(self, *args, **kwargs):
        # Mouse handling initial values
        self.mouse_down = False
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        self.initrans = Vec([0., 0., -2.])

        self.width = 640
        self.height = 480

        # Initialize the window
        glutInit(sys.argv)
        glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)
        glutInitWindowSize(self.width, self.height)
        glutInitWindowPosition(0, 0)
        self.win = glutCreateWindow("Part 2: Python")

        # Draw current frame
        glutDisplayFunc(self.draw)

        # Accept user input
github koszullab / GRAAL / main_gl.py View on Github external
def __init__(self, pyramid, name, level, n_iterations, is_simu, scrambled, perform_em, sample_param, output_folder,
                 fasta_file, candidates_blacklist, n_neighbours, allow_repeats, id_selected_gpu,
                 main_thread):
        #mouse handling for transforming scene
        id_exp = 0
        self.main_thread = main_thread
        self.n_neighbours = n_neighbours
        self.id_selected_gpu = id_selected_gpu
        self.use_rippe = True
        self.mouse_down = False
        self.size_points = 6
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        self.initrans = Vec([0., 0., -2.])
        self.scrambled = scrambled
        self.sample_param = sample_param
        self.allow_repeats = allow_repeats
        self.width = 800
        self.height = 600
        self.n_iterations_em = n_iterations
        self.n_iterations_mcmc = n_iterations
        self.dt = np.float32(0.01)
        self.white = 1
        self.collect_4_graph3d = dict()
        self.output_folder = output_folder
        self.fasta_file = fasta_file
        glutInit(sys.argv)
github enjalot / adventures_in_opencl / experiments / wave / main.py View on Github external
def __init__(self, *args, **kwargs):
        #mouse handling for transforming scene
        self.mouse_down = False
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        #self.initrans = Vec([0., 0., -2.])
        self.init_persp_trans = Vec([-.5, 0., -1.5])
        self.init_ortho_trans = Vec([0., 0., 0.])
        self.init_persp_rotate = Vec([0., 0., 0.])
        self.init_ortho_rotate = Vec([90., -90., 0.])
 

        self.ortho = False
        self.choice = 2
        #self.stable = True
        self.stable = False
        #self.type = "square"
        self.wtype = "sin"
        #self.wtype = "sawtooth"
        #self.wtype = "sweep_poly"
        self.dt = dt

        self.width = 640
        self.height = 480

        glutInit(sys.argv)
github enjalot / adventures_in_opencl / experiments / chaotic_artist / main.py View on Github external
def __init__(self, queue, *args, **kwargs):
        self.queue = queue #for communication from other threads
        #mouse handling for transforming scene
        self.mouse_down = False
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([-85., 0., 80.])
        self.translate = Vec([0., 0., 0.])
        self.initrans = Vec([0., 0., -2.])

        self.width = 640
        self.height = 480

        glutInit(sys.argv)
        glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)
        glutInitWindowSize(self.width, self.height)
        glutInitWindowPosition(0, 0)
        self.win = glutCreateWindow("Chaotic Artist")

        #gets called by GLUT every frame
        glutDisplayFunc(self.draw)

        #handle user input
github enjalot / adventures_in_opencl / python / part2 / main.py View on Github external
def __init__(self, *args, **kwargs):
        #mouse handling for transforming scene
        self.mouse_down = False
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        self.initrans = Vec([0., 0., -2.])

        self.width = 640
        self.height = 480

        glutInit(sys.argv)
        glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)
        glutInitWindowSize(self.width, self.height)
        glutInitWindowPosition(0, 0)
        self.win = glutCreateWindow("Part 2: Python")

        #gets called by GLUT every frame
        glutDisplayFunc(self.draw)

        #handle user input
github benshope / PyOpenCL-Tutorial / examples / enja / part2 / main_pyglet.py View on Github external
def __init__(self, cle, *args, **kwargs):
        window.Window.__init__(self, *args, **kwargs)

        #glutil.init(self.width, self.height)
        self.cle = cle
        self.num = num

        #mouse handling for transforming scene
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        self.initrans = Vec([0., 0., -2.])
github enjalot / adventures_in_opencl / python / part2 / main_pyglet.py View on Github external
def __init__(self, cle, *args, **kwargs):
        window.Window.__init__(self, *args, **kwargs)

        #glutil.init(self.width, self.height)
        self.cle = cle
        self.num = num

        #mouse handling for transforming scene
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        self.initrans = Vec([0., 0., -2.])
github enjalot / adventures_in_opencl / experiments / wave / main.py View on Github external
def __init__(self, *args, **kwargs):
        #mouse handling for transforming scene
        self.mouse_down = False
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        #self.initrans = Vec([0., 0., -2.])
        self.init_persp_trans = Vec([-.5, 0., -1.5])
        self.init_ortho_trans = Vec([0., 0., 0.])
        self.init_persp_rotate = Vec([0., 0., 0.])
        self.init_ortho_rotate = Vec([90., -90., 0.])
 

        self.ortho = False
        self.choice = 2
        #self.stable = True
        self.stable = False
        #self.type = "square"
        self.wtype = "sin"
        #self.wtype = "sawtooth"
        #self.wtype = "sweep_poly"
        self.dt = dt
github enjalot / adventures_in_opencl / experiments / wave / main.py View on Github external
def __init__(self, *args, **kwargs):
        #mouse handling for transforming scene
        self.mouse_down = False
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        #self.initrans = Vec([0., 0., -2.])
        self.init_persp_trans = Vec([-.5, 0., -1.5])
        self.init_ortho_trans = Vec([0., 0., 0.])
        self.init_persp_rotate = Vec([0., 0., 0.])
        self.init_ortho_rotate = Vec([90., -90., 0.])
 

        self.ortho = False
        self.choice = 2
        #self.stable = True
        self.stable = False
        #self.type = "square"
        self.wtype = "sin"
        #self.wtype = "sawtooth"
        #self.wtype = "sweep_poly"
github enjalot / adventures_in_opencl / experiments / wave / glutil.py View on Github external
#X Axis
    gl.glColor3f(1,0,0)    #red
    v1 = Vec([0,0,0])
    v2 = Vec([1,0,0])
    draw_line(v1, v2)

    #Y Axis
    gl.glColor3f(0,1,0)    #green
    v1 = Vec([0,0,0])
    v2 = Vec([0,1,0])
    draw_line(v1, v2)

    #Z Axis
    gl.glColor3f(0,0,1)    #blue
    v1 = Vec([0,0,0])
    v2 = Vec([0,0,1])
    draw_line(v1, v2)