6.7 Base classes for 3D Graphics objects and plotting

Module: sage.plot.plot3d.base

Base classes for 3D Graphics objects and plotting.

Author Log:

TODO: - finish integrating tachyon - good default lights, camera

Module-level Functions

flatten_list( )

This is an optimized routine to turn a list of lists (of lists ...) into a single list. We generate data in a non-flat format to avoid multiple data copying, and then concatenate it all at the end.

This is NOT recursive, otherwise there would be a lot of redundant copying (which we are trying to avoid in the first place, though at least it would be just the pointers).

max3( )

Return the componentwise maximum of a list of 3-tuples.

sage: from sage.plot.plot3d.base import min3, max3
sage: max3([(-1,2,5), (-3, 4, 2)])
(-1, 4, 5)

min3( )

Return the componentwise minimum of a list of 3-tuples.

sage: from sage.plot.plot3d.base import min3, max3
sage: min3([(-1,2,5), (-3, 4, 2)])
(-3, 2, 2)

optimal_aspect_ratios( )

optimal_extra_kwds( )

Given a list v of dictionaries, this function merges them such that later dictionaries have precedence.

point_list_bounding_box( )

sage: from sage.plot.plot3d.base import point_list_bounding_box
sage: point_list_bounding_box([(1,2,3),(4,5,6),(-10,0,10)])
((-10.0, 0.0, 3.0), (4.0, 5.0, 10.0))

Class: BoundingSphere

class BoundingSphere

Functions: transform

Special Functions: __add__,$  $ __init__,$  $ __repr__

__add__( )

__init__( )

__repr__( )

Class: Graphics3d

class Graphics3d

Functions: aspect_ratio,$  $ bounding_box,$  $ default_render_params,$  $ export_jmol,$  $ flatten,$  $ frame_aspect_ratio,$  $ jmol_repr,$  $ mtl_str,$  $ obj,$  $ obj_str,$  $ rotate,$  $ rotateX,$  $ rotateY,$  $ rotateZ,$  $ scale,$  $ show,$  $ tachyon,$  $ tachyon_str,$  $ texture_set,$  $ transform,$  $ translate,$  $ viewpoint,$  $ x3d

obj_str( )

DO NOT override this method, override obj_repr instead.

show( )

Input:

viewer
- string (default: 'jmol'), how to view the plot 'jmol': interactive 3d (java) 'tachyon': a static png image (ray traced) 'java3d': interactive opengl based 3d
filename
- string (default: a temp file); file to save the image to
verbosity
- display information about rendering the figure
figsize
- (default: 5); x or pair [x,y] for numbers, e.g., [5,5]; controls the size of the output figure. E.g., with Tachyon the number of pixels in each direction is 100 times figsize[0]. This is ignored for the jmol embedded renderer.
aspect_ratio
- (default: "automatic") - aspect ratio of the coordinate system itself. Give [1,1,1] to make spheres look round.
frame_aspect_ratio
- (default: "automatic") aspect ratio of frame that contains the 3d scene.
zoom
- (default: 1) how zoomed in
frame
- (default: True) if True, draw a bounding frame with labels
axes
- (deault: False) if True, draw coordinate axes

**kwds - other options, which make sense for particular rendering engines

CHANGING DEFAULTS: Defaults can be uniformly changed by importing a dictionary and changing it. For example, here we change the default so images display without a frame instead of with one:

sage: from sage.plot.plot3d.base import SHOW_DEFAULTS
sage: SHOW_DEFAULTS['frame'] = False

This sphere will not have a frame around it:

sage: sphere((0,0,0))

We change the default back:

sage: SHOW_DEFAULTS['frame'] = True

Now this sphere is enclosed in a frame:

sage: sphere((0,0,0))

We illustrate use of the aspect_ratio option:

sage: x, y = var('x,y')
sage: p = plot3d(2*sin(x*y), (x, -pi, pi), (y, -pi, pi))
sage: p.show(aspect_ratio=[1,1,1])

This looks flattened, but filled with the plot:

sage: p.show(frame_aspect_ratio=[1,1,1/16])

This looks flattened, but the plot is square and smaller:

sage: p.show(aspect_ratio=[1,1,1], frame_aspect_ratio=[1,1,1/8])

tachyon_str( )

DO NOT override this method, override tachyon_repr instead.

Special Functions: __add__,$  $ __radd__,$  $ __repr__,$  $ __str__,$  $ _box_for_aspect_ratio,$  $ _determine_frame_aspect_ratio,$  $ _prepare_for_jmol,$  $ _prepare_for_tachyon,$  $ _rescale_for_frame_aspect_ratio_and_zoom,$  $ _safe_bounding_box,$  $ _set_extra_kwds,$  $ _transform_to_bounding_box

__add__( )

__repr__( )

__str__( )

_box_for_aspect_ratio( )

_determine_frame_aspect_ratio( )

_prepare_for_jmol( )

_prepare_for_tachyon( )

_rescale_for_frame_aspect_ratio_and_zoom( )

_safe_bounding_box( )

_set_extra_kwds( )

_transform_to_bounding_box( )

Class: Graphics3dGroup

class Graphics3dGroup

Functions: bounding_box,$  $ flatten,$  $ jmol_repr,$  $ obj_repr,$  $ tachyon_repr,$  $ texture_set,$  $ transform,$  $ x3d_str

Special Functions: __init__

__init__( )

Class: PrimitiveObject

class PrimitiveObject

Functions: get_texture,$  $ jmol_repr,$  $ obj_repr,$  $ set_texture,$  $ tachyon_repr,$  $ texture_set,$  $ x3d_str

Special Functions: __init__

Class: RenderParams

class RenderParams
This class is a container for all parameters that may be needed to render triangulate/render an object to a certain format. It can contain both cumulative and global parameters.

Functions: pop_transform,$  $ push_transform,$  $ unique_name

Special Functions: __init__

__init__( )

Class: TransformGroup

class TransformGroup

Functions: bounding_box,$  $ flatten,$  $ get_transformation,$  $ jmol_repr,$  $ obj_repr,$  $ tachyon_repr,$  $ transform,$  $ x3d_str

Special Functions: __init__

__init__( )

Class: Viewpoint

class Viewpoint

Functions: x3d_str

Special Functions: __init__

__init__( )

See About this document... for information on suggesting changes.