VisualizationFrame

class pydy_viz.VisualizationFrame(*args)

A VisualizationFrame represents an object that you want to visualize. It allows you to easily associate a reference frame and a point with a shape.

A VisualizationFrame can be attached to only one Shape Object. It can be nested, i.e we can add/remove multiple visualization frames to one visualization frame. On adding the parent frame to the Scene object, all the children of the parent visualization frame are also added, and hence can be visualized and animated.

A VisualizationFrame needs to have a ReferenceFrame, and a Point for it to form transformation matrices for visualization and animations.

The ReferenceFrame and Point are required to be provided during initialization. They can be supplied in the form of any one of these:

1)reference_frame, point argument. 2)a RigidBody argument 3)reference_frame, particle argument.

In addition to these arguments, A shape argument is also required.

evaluate_transformation_matrix(dynamic_values, constant_values)

Returns the numerical transformation matrices for each time step.

Parameters:

dynamic_values : array_like, shape(m,) or shape(n, m)

The m state values for each n time step.

constant_values : array_like, shape(p,)

The p constant parameter values of the system.

Returns:

transform_matrix : numpy.array, shape(n, 4, 4)

A 4 x 4 transformation matrix for each time step.

generate_numeric_transform_function(dynamic_variables, constant_variables)

Returns a function which returns a transformation matrix given the symbolic states and the symbolic system parameters.

Parameters:

dynamic_variables : list of all the dynamic symbols used in defining the

mechanics objects.

constant_variables : list of all symbols used in defining the

mechanics objects

Returns:

A Lambda function which returns a transformation matrix, :

given symbolic states, and symbolic system parameters :

generate_transformation_matrix(reference_frame, point)

Generates the symbolic Transformation matrix, with respect to the reference_frame, point in the argument.

Parameters:

reference_frame : ReferenceFrame

A reference_frame with respect to which transformation matrix :

is generated. :

point : Point

A point with respect to which transformation matrix :

is generated. :

Returns:

A SymPy 4by4 matrix, containing symbolic variables for :

transformation. :

generate_visualization_dict()

Returns a dictionary of all the info required for the visualization of this frame, alongwith child.

Before calling this method, all the transformation matrix generation methods should be called, or it will give an error.

Returns:

a dictionary containing following keys: :

name : name of the VisualizationFrame

children : simulation dictionary of child frames

shape : shape info of the attached shape,

like dimensions, color etc.It is generated from generator method :

of Shape class. :

simulation_matrix : a N*4*4 matrix, converted to list, for

passing to Javascript for animation purposes, where N is the :

number of timesteps for animations. :

name

Name of the VisualizationFrame.

origin

Origin of the VisualizationFrame, with respect to which all translational transformations take place.

reference_frame

reference_frame of the VisualizationFrame, with respect to which all rotational/orientational transformations take place.

shape

shape in the VisualizationFrame. A shape attached to the visualization frame. NOTE: Only one shape can be attached to a visualization frame.