Introduction¶
Sage has a wide support for 3D graphics, from basic shapes to implicit and parametric plots.
The following graphics functions are supported:
plot3d()– plot a 3d functionparametric_plot3d()– a parametric three-dimensional space curve or surfacerevolution_plot3d()– a plot of a revolved curveplot_vector_field3d()– a plot of a 3d vector fieldimplicit_plot3d()– a plot of an isosurface of a functionlist_plot3d()- a 3-dimensional plot of a surface defined by a list of points in 3-dimensional spacelist_plot3d_matrix()– a 3-dimensional plot of a surface defined by a matrix defining points in 3-dimensional spacelist_plot3d_array_of_arrays()- A 3-dimensional plot of a surface defined by a list of lists defining points in 3-dimensional spacelist_plot3d_tuples()– a 3-dimensional plot of a surface defined by a list of points in 3-dimensional space
The following classes for basic shapes are supported:
Box– a box given its three magnitudesCone– a cone, with base in the xy-plane pointing up the z-axisCylinder– a cylinder, with base in the xy-plane pointing up the z-axisLine– a 3d line joining a sequence of pointsSphere– a sphere centered at the originText– a text label attached to a point in 3d spaceTorus– a 3d torusPoint– 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 colorsLineSegment()– a line segment, which is drawn as a cylinder from start to end with given radiusline3d()– a 3d line joining a sequence of pointsarrow3d()– a 3d arrowpoint3d()– a point or list of points in 3d spacebezier3d()– a 3d bezier pathframe3d()– a frame in 3dframe_labels()– labels for a given frame in 3dpolygon3d()– draw a polygon in 3dpolygons3d()– draw the union of several polygons in 3druler()– draw a ruler in 3d, with major and minor ticksruler_frame()– draw a frame made of 3d rulers, with major and minor tickssphere()– plot of a sphere given center and radiustext3d()– 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.
Tachyon– create a scene the can be rendered using the Tachyon ray tracerAxis_aligned_box– box with axis-aligned edges with the given min and max coordinatesCylinder– an infinite cylinderFCylinder– a finite cylinderFractalLandscape- axis-aligned fractal landscapeLight– represents lighting objectsParametricPlot– parametric plot routinesPlane– an infinite planeRing– an annulus of zero thicknessSphere- a sphereTachyonSmoothTriangle– a triangle along with a normal vector, which is used for smoothingTachyonTriangle– basic triangle classTachyonTriangleFactory– class to produce triangles of various rendering typesTexfunc– creates a texture functionTexture– stores texture informationtostr()– converts vector information to a space-separated string