Table Of Contents

Previous topic

ode Package

Next topic

pset Package

This Page

ogl Package

ogl Package

axis_ogl Module

class pyparticles.ogl.axis_ogl.AxisOgl

Bases: object

axis_len
axis_planes_codes()
draw_arrow(color, axis, leng=None)
draw_axis()
draw_axis_procedure()
draw_plane(plane='xy', color=(0.7, 0.7, 0.7, 0.3), leng=None)
get_axis_len()
ogl_init()
set_axis_len(leng)

draw_particles_ogl Module

class pyparticles.ogl.draw_particles_ogl.DrawParticlesGL(pset=None)

Bases: object

DRAW_MODEL_LOOP = 0
DRAW_MODEL_VECTOR = 1
PARTICLE_MODEL_POINT = 'point'
PARTICLE_MODEL_SPHERE = 'sphere'
PARTICLE_MODEL_TEAPOT = 'teapot'
color_fun

Set and get the function for calculating the particle color: definition of the function color, it take as args a particle_set obj. and the particle index (R,G,B,A) = cfun( pset , index )

draw()
draw_particle(pset, i)
draw_particle_sphere(pset, i)
draw_particle_teapot(pset, i)
draw_trajectory()
get_color_fun(fun)
get_pcolor()
get_pset()
get_trajectory()
get_trajectory_step()
get_vect_color_fun(fun)
init_sphere_dl()
init_teapot_dl()
ogl_init()

Initialize opengl display lists (must be called after glutInit!)

pset
set_color_fun(fun)
set_draw_model(model)
set_particle_model(model='', user_fun=None)
set_pset(pset)
set_trajectory(tr)
set_trajectory_step(trs)
set_vect_color_fun(fun)
trajectory

enable or disable the trajectory

trajectory_step

set or get the step for drawing the trajectory

vect_color_fun

get and set the vector color function

pyparticles.ogl.draw_particles_ogl.charged_particles_color(pset, i)
pyparticles.ogl.draw_particles_ogl.charged_particles_vect_color(RGBA, pset)
pyparticles.ogl.draw_particles_ogl.rand_vect_colors(RGBA, pset)

draw_vector_field Module

class pyparticles.ogl.draw_vector_field.DrawVectorField(limits, density)

Bases: object

Draw the given vector fields.

Constructor:

Parameters:
  • limits – size of the draw volume: (x_min,x_max,y_min,y_max,z_min,z_max)
  • density – distance between the plotted vectors
add_vector_fun(fun, unit_len=1.0, color_fun=None, key=None, time_dep=False)

Insert a new vector function,

fun : Vector filed function color_fun : Colors function key : [optional] a key used for distinguish the vector field time_dep : [True or False ] if True Is a time dependent filed
where functions are defined:
fun( V , X ) color_fun( RGBA , X )
X : (n by DIM) coordinates array
V : (n by DIM) resulting vector field
RGBA : (n by 4) colors array
draw()
ogl_init()

trackball Module

class pyparticles.ogl.trackball.TrackBall(w_size)

Bases: object

Class used for controlling the rotation of the scene via mouse or joystick, by generating the virtual trackball effect

Constructor

Arguments  
w_size size of the window
Example:

Event On click:

( x , y ) = get_click_coords_on_window()
trk.track_ball_mapping( [ x , y ] )

Event On Move:

( x , y ) = get_current_coords_on_window()
( rot_axis , rot_angle ) = trk.on_move( [ x , y ] )
glRotatef( rot_angle , rot_axis[0] , rot_axis[1] , rot_axis[2] )
V
get_V()
get_win_size()
on_joystick(jaxes)

Given the axes ( x and y ) of the joystick; it returns the axis and the angle of rotation. Example:

( rot_axis , rot_angle ) = trk.on_joystick( [ x , y ] )
on_move(point)

function to be called when the mouse is moved. argument requires the coordinates of the mouse pointer and it returns the axis of rotation and angle.

set_V(v)
set_win_size(w_size)
track_ball_mapping(point)

Function to be called after a click on the mouse or at beginnig of the rotation, it takes the current coordinates of the pointer.

win_size

translate_scene Module

class pyparticles.ogl.translate_scene.TranslateScene(w_size)

Bases: object

V
fovy
get_V()
get_fovy()
get_win_size()
on_move(point)
set_V(v)
set_fovy(fv)
set_win_size(w_size)
translate_mapping(point)
win_size