Introduction#

Sage has a wide support for 3D graphics, from basic shapes to implicit and parametric plots.

The following graphics functions are supported:

The following classes for basic shapes are supported:

  • Box – a box given its three magnitudes

  • Cone – a cone, with base in the xy-plane pointing up the z-axis

  • Cylinder – a cylinder, with base in the xy-plane pointing up the z-axis

  • Line – a 3d line joining a sequence of points

  • Sphere – a sphere centered at the origin

  • Text – a text label attached to a point in 3d space

  • Torus – a 3d torus

  • Point – a position in 3d, represented by a sphere of fixed size

The following plotting functions for basic shapes are supported

  • ColorCube() – a cube with given size and sides with given colors

  • LineSegment() – a line segment, which is drawn as a cylinder from start to end with given radius

  • line3d() – a 3d line joining a sequence of points

  • arrow3d() – a 3d arrow

  • point3d() – a point or list of points in 3d space

  • bezier3d() – a 3d bezier path

  • frame3d() – a frame in 3d

  • frame_labels() – labels for a given frame in 3d

  • polygon3d() – draw a polygon in 3d

  • polygons3d() – draw the union of several polygons in 3d

  • ruler() – draw a ruler in 3d, with major and minor ticks

  • ruler_frame() – draw a frame made of 3d rulers, with major and minor ticks

  • sphere() – plot of a sphere given center and radius

  • text3d() – 3d text

Sage also supports platonic solids with the following functions:

Different viewers are supported: a web-based interactive viewer using the Three.js JavaScript library (the default), Jmol, and the Tachyon ray tracer. The viewer is invoked by adding the keyword argument viewer='threejs' (respectively 'jmol' or 'tachyon') to the command show() on any three-dimensional graphic.