Cameras

Perspective Camera

class pydy.viz.camera.PerspectiveCamera(*args, **kwargs)[source]

Creates a Perspective Camera for visualization. The camera is inherited from VisualizationFrame. It can be attached to dynamics objects, hence we can get a moving camera. All the transformation matrix generation methods are applicable to a Perspective Camera.

Like VisualizationFrame, it can also be initialized using:

  1. Rigidbody
  2. ReferenceFrame, Point
  3. ReferenceFrame, Particle

Either one of these must be supplied during initialization. Unlike VisualizationFrame, it does not require a Shape argument.

Parameters:

name : str

A name for the PerspectiveCamera(optional). Default is ‘unnamed’

fov : float, default=45.0

Field Of View, It determines the angle between the top and bottom of the viewable area (in degrees).

near : float

The distance of near plane of the PerspectiveCamera. All objects closer to this distance are not displayed.

far : int or float

The distance of far plane of the PerspectiveCamera. All objects farther than this distance are not displayed.

far

Attribute for Far Plane distance of a PerspectiveCamera. The default value is 1000.0.

fov

attribute for Field Of view of a PerspectiveCamera. Default value is 45 degrees

generate_scene_dict()[source]

This method generates information for a static visualization in the initial conditions, in the form of dictionary. This contains camera parameters followed by an init_orientation Key.

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

Returns:

A dict with following Keys:

  1. name: name for the camera
  2. fov: Field of View value of the camera
  3. near: near value of the camera
  4. far: far value of the camera
  5. init_orientation: Initial orientation of the camera
generate_simulation_dict()[source]

Generates the simulation information for this visualization frame. It maps the simulation data information to the scene information via a unique id.

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

Returns:

simulation_dict : dictionary

A dictionary containing list of 4x4 matrices mapped to the unique id as the key.

near

attribute for Near Plane distance of a PerspectiveCamera. Default value is 1

Orthographic Camera

class pydy.viz.camera.OrthoGraphicCamera(*args, **kwargs)[source]

Creates a OrthoGraphic Camera for visualization. The camera is inherited from VisualizationFrame. It can be attached to dynamics objects, hence we can get a moving camera. All the transformation matrix generation methods are applicable to a Perspective Camera.

Like VisualizationFrame, it can also be initialized using:

  1. :role:`Rigidbody`
  2. ReferenceFrame, Point
  3. ReferenceFrame, Particle

Either one of these must be supplied during initialization. Unlike VisualizationFrame, it doesnt require a Shape argument.

Parameters:

name : str, optional, default=’unnamed’

A name for the PerspectiveCamera.

near : float, optional, default=

The distance of near plane of the PerspectiveCamera. All objects closer to this distance are not displayed.

far : float, optional, default=

The distance of far plane of the PerspectiveCamera. All objects farther than this distance are not displayed.

far

Attribute for Far Plane distance of an OrthoGraphicCamera. Default value is 1000.0.

generate_scene_dict()[source]

This method generates information for a static visualization in the initial conditions, in the form of dictionary. This contains camera parameters followed by an init_orientation Key.

Returns:

scene_dict : dictionary

A dict with following Keys:

  1. name: name for the camera
  2. near: near value of the camera
  3. far: far value of the camera
  4. init_orientation: Initial orientation of the camera
generate_simulation_dict()[source]

Generates the simulation information for this visualization frame. It maps the simulation data information to the scene information via a unique id.

Returns:

A dictionary containing list of 4x4 matrices mapped to the unique id

as the key.

near

Attribute for Near Plane distance of an OrthoGraphicCamera. Default value is 1.0