# Module Scientific.Visualization.VPython

## Functions

- DiffuseMaterial()

  Returns a material with the `diffuse color` attribute set to color.

- EmissiveMaterial()

  Returns a material with the `emissive color` attribute set to color.

## Class Scene: VPython scene

A VPython scene is a collection of graphics objects that can be shown in a VPython window. When the "view" method is called, a new window is created and the graphics objects are displayed in it.

Constructor: Scene(objects=None, **|options|)

objects

  a list of graphics objects or `None` for an empty scene

options

  options as keyword arguments: "title" (the window title, default: "VPython scene"), "width" (the window width, default: 300), "height" (the window height, default: 300), "background" (the background color, default: `black`)

Methods:

- addObject(object)

  Adds object to the list of graphics objects.

- view()

  Open a VPython window for the scene.

## Class Sphere: Sphere

Constructor: Sphere(center, radius, **|attributes|)

center

  the center of the sphere (a vector)

radius

  the sphere radius (a positive number)

attributes

  any graphics object attribute

## Class Cube: Cube

Constructor: Cube(center, edge, **|attributes|)

center

  the center of the cube (a vector)

edge

  the length of an edge (a positive number)

attributes

  any graphics object attribute

The edges of a cube are always parallel to the coordinate axes.

## Class Cylinder: Cylinder

Constructor: Cylinder(point1, point2, radius, **|attributes|)

point1, point2

  the end points of the cylinder axis (vectors)

radius

  the radius (a positive number)

attributes

  any graphics object attribute

## Class Arrow: Arrow

Constructor: Arrow(point1, point2, radius, **|attributes|)

point1, point2

  the end points of the cylinder axis (vectors)

radius

  the radius (a positive number)

attributes

  any graphics object attribute

## Class Cone: Cone

Constructor: Cone(point1, point2, radius, **|attributes|)

point1, point2

  the end points of the cylinder axis (vectors). point1 is the tip of the cone.

radius

  the radius (a positive number)

attributes

  any graphics object attribute

## Class PolyLines: Multiple connected lines

Constructor: PolyLines(points, **|attributes|)

points

  a sequence of points to be connected by lines

attributes

  any graphics object attribute

## Class Line: Line

Constructor: Line(point1, point2, **|attributes|)

point1, point2

  the end points of the line (vectors)

attributes

  any graphics object attribute

## Class Polygons: Polygons

Constructor: Polygons(points, index_lists, **|attributes|)

points

  a sequence of points

index_lists

  a sequence of index lists, one for each polygon. The index list for a polygon defines which points in points are vertices of the polygon.

attributes

  any graphics object attribute

## Class Material: Material for graphics objects

A material defines the color and surface properties of an object.

Constructor: Material(**|attributes|)

The attributes are "ambient_color", "diffuse_color", "specular_color", "emissive_color", "shininess", and "transparency".