Introduction - 3D Graphics

Skip to content
Back to top
View this page
Edit this page

# 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 function

- `parametric_plot3d()` – a parametric three-dimensional space curve or surface

- `revolution_plot3d()` – a plot of a revolved curve

- `plot_vector_field3d()` – a plot of a 3d vector field

- `implicit_plot3d()` – a plot of an isosurface of a function

- `list_plot3d()`- a 3-dimensional plot of a surface defined by a list of points in 3-dimensional space

- `list_plot3d_matrix()` – a 3-dimensional plot of a surface defined by a matrix defining points in 3-dimensional space

- `list_plot3d_array_of_arrays()`- A 3-dimensional plot of a surface defined by a list of lists defining points in 3-dimensional space

- `list_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 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:

- `tetrahedron()`

- `cube()`

- `octahedron()`

- `dodecahedron()`

- `icosahedron()`

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 tracer

- `Axis_aligned_box` – box with axis-aligned edges with the given min and max coordinates

- `Cylinder` – an infinite cylinder

- `FCylinder` – a finite cylinder

- `FractalLandscape`- axis-aligned fractal landscape

- `Light` – represents lighting objects

- `ParametricPlot` – parametric plot routines

- `Plane` – an infinite plane

- `Ring` – an annulus of zero thickness

- `Sphere`- a sphere

- `TachyonSmoothTriangle` – a triangle along with a normal vector, which is used for smoothing

- `TachyonTriangle` – basic triangle class

- `TachyonTriangleFactory` – class to produce triangles of various rendering types

- `Texfunc` – creates a texture function

- `Texture` – stores texture information

- `tostr()` – converts vector information to a space-separated string