Scene

class pydy_viz.scene.Scene(reference_frame, origin, *visualization_frames, **kwargs)[source]

Scene class holds all the data required for the visualizations/ animation of a system.

It has methods for inputting the numerical data from the numerical integrations of Equations of Motions and convert them to JSON values, which can be then parsed by Javascripts(webgls).

A scene object takes a ReferenceFrame, and a Point as required arguments. The reference_frame and point act as the inertial frame and origin with respect to which all objects are oriented and rendered in the visualizations

A scene needs to be supplied with visualization_frames, Cameras, and Light objects, as optional arguments. A scene can also be supplied with the height and width of the browser window where visualization would be displayed. Default is 800 * 800.

display()[source]

display method can be used in two ways. When called from IPython notebook, it shows the visualization in the form of output cell in the IPython notebook. If it is called from python interpreter or IPython interpreter(not notebook), It generates an html file, in the current directory, which can be opened in the webgl compliant browser for viewing the visualizations.

The simulation data is used from this scene, hence all simulation data generation methods should be called before calling this method

generate_visualization_dict(dynamic_variables, constant_variables, dynamic_values, constant_values)[source]

generate_visualization_dict() method generates a dictionary of visualization data

Parameters:

dynamic_variables : Sympifyable list or tuple

This contains all the dynamic symbols or state variables which are required for solving the transformation matrices of all the frames of the scene.

constant_variables : Sympifyable list or tuple

This contains all the symbols for the parameters which are used for defining various objects in the system.

dynamic_values : list or tuple

initial states of the system. The list or tuple should be respective to the state_sym.

constant_values : list or tuple

values of the parameters. The list or tuple should be respective to the par_sym.

Returns:

The dictionary contains following keys: :

1) Width of the scene. :

2) Height of the scene. :

3) name of the scene. :

4) frames in the scene, which contains sub-dictionaries :

of all the visualization frames information.

generate_visualization_json(dynamic_variables, constant_variables, dynamic_values, constant_values, save_to='data.json')[source]

generate_visualization_json() method generates a json str, which is saved to file.

Parameters:

dynamic_variables : Sympifyable list or tuple

This contains all the dynamic symbols or state variables which are required for solving the transformation matrices of all the frames of the scene.

constant_variables : Sympifyable list or tuple

This contains all the symbols for the parameters which are used for defining various objects in the system.

dynamic_values : list or tuple

initial states of the system. The list or tuple should be respective to the state_sym.

constant_values : list or tuple

values of the parameters. The list or tuple should be respective to the par_sym.

save_to : str

path to the file where to write the generated data JSON. the path should be chosen such as to have the write permissions to the user.

Returns:

The dictionary contains following keys: :

1) Width of the scene. :

2) Height of the scene. :

3) name of the scene. :

4) frames in the scene, which contains sub-dictionaries :

of all the visualization frames information.

name[source]

Returns Name of Scene.

origin[source]

returns Origin of the Scene.

reference_frame[source]

returns reference_frame of the Scene.