pyrc.core.visualization.viewer#

class Viewer(objects=None, title: str = 'Cell Network', width: int = 1902, height: int = 963, background=vector(0, 0, 0), autoscale: bool = False, wireframe: tuple[tuple[float | int, float | int, float | int], tuple[float | int, float | int, float | int]] | None = None, draw_coordinate_system: bool = True)#

Bases: object

Draw cells using vPython.

Parameters:
  • objects (list, optional) – The objects to draw. They can be added later on.

  • title (str, optional) – The title of the canvas.

  • width (int, optional) – Width of the canvas.

  • height (int, optional) – Height of the canvas.

  • background (color, optional) – Background color.

  • autoscale (bool, optional) – Autoscale canvas. For a lot of objects not recommended.

  • wireframe (tuple[tuple[float | int, float | int, float | int], tuple[float | int, float | int, float | int]] | None, optional) – If given, edges are drawn to display the boundaries of the network. Should consist of two 3D tuples, first is position/center, second width, height and depth.

  • draw_coordinate_system (bool, optional) – If True, a coordinate system is drawn.

__init__(objects=None, title: str = 'Cell Network', width: int = 1902, height: int = 963, background=vector(0, 0, 0), autoscale: bool = False, wireframe: tuple[tuple[float | int, float | int, float | int], tuple[float | int, float | int, float | int]] | None = None, draw_coordinate_system: bool = True)#

Draw cells using vPython.

Parameters:
  • objects (list, optional) – The objects to draw. They can be added later on.

  • title (str, optional) – The title of the canvas.

  • width (int, optional) – Width of the canvas.

  • height (int, optional) – Height of the canvas.

  • background (color, optional) – Background color.

  • autoscale (bool, optional) – Autoscale canvas. For a lot of objects not recommended.

  • wireframe (tuple[tuple[float | int, float | int, float | int], tuple[float | int, float | int, float | int]] | None, optional) – If given, edges are drawn to display the boundaries of the network. Should consist of two 3D tuples, first is position/center, second width, height and depth.

  • draw_coordinate_system (bool, optional) – If True, a coordinate system is drawn.

add(objects: list | tuple | Cell, rgb=None)#
add_highlight(new_objects: list | tuple | Cell, highlight_rgb=(1, 0.2, 0.38823529411764707), opacity=1.0, old_opacity=0.5)#
add_new_from_list(objects: list | tuple)#

Like add_highlight, but first determine which of the objects are already added and only highlight new ones.

Parameters:

objects (list | tuple) – The list with objects, where new objects have been added and the new ones should be highlighted.

draw_coordinate_system()#
draw_wireframe(center, deltas, edge_color=vector(1, 1, 1), edge_radius_factor=0.001)#

Draw wireframe edges of the grid bounding box.

Parameters:
  • center (tuple[float | int, float | int]) – The center of the wireframe.

  • deltas (tuple[float | int, float | int]) – The width, height and depth of the wireframe.

  • edge_color (color, optional) – The color of the edges.

  • edge_radius_factor (float, optional) – Determines the thickness of the edges drawn. Is multiplied by the maximum dimension (x/y/z value).

static update_all_colors(nodes: Iterable[Node], *, t_min: float, t_max: float, fps: float = 60.0) None#

Color-only update pass. Use inside your simulation/animation loop.

update_all_geometry(fps: float = 60.0) None#

Geometry update pass (pos/size). Only use if geometry actually changes.