Options for graphics objects are specified as JavaScript dictionaries. Unless stated otherwise, common default options are

colorrgb(0,127,255) - rich azure blue
opacity1

Colors are specified using standard HTML color code strings. Predefined colormaps are also available.

Objects composed of lines have an additional option of thickness that defaults to 1.5 in two dimensions. Due to limitations of WebGL, in three dimensions it renders as 1 on most platforms regardless of the setting: a numeric option of radius should be used instead.

The axis for three-dimensional objects is rotated from the z-axis. This can produce unexpected behavior for objects that do not have rotational symmetry. The utility function rotateObject is available for further adjustment.

Additional object-specific options are listed below each.


arrow( begin, end, options ) — two- or three-dimensional arrow from beginning to end

size1

box( width, depth, height, options ) — box of specified dimensions

axisarbitrary vector direction, default [0,0,1]
centervector position, default [0,0,0]

cone( radius, height, options ) — cone of specified dimensions

axisarbitrary vector direction, default [0,0,1]
centervector position, default [0,0,0]
stepsinteger determining surface smoothness, default 20

cylinder( radius, height, options ) — cylinder of specified dimensions

axisarbitrary vector direction, default [0,0,1]
centervector position, default [0,0,0]
openEndedBoolean to draw cylinder ends, default true
stepsinteger determining surface smoothness, default 20

ellipsoid( a, b, c, options ) — ellipsoid of specified parameters

axisarbitrary vector direction, default [0,0,1]
centervector position, default [0,0,0]
stepsinteger determining surface smoothness, default 20

line( points, options ) — two- or three-dimensional line joining an array of points

endcapsBoolean to include spheres to smooth joints, default false
radiusfloat for drawing the line as an extended cylinder

plane( width, depth, options ) — plane of specified dimensions

normalarbitrary vector direction, default [0,0,1]
centervector position, default [0,0,0]

point( point, options ) — two- or three-dimensional point

size1

sphere( radius, options ) — sphere of specified radius

centervector position, default [0,0,0]
stepsinteger determining surface smoothness, default 20

text( string, point, options ) — string of text at the two- or three-dimensional point

colorblack
fontSize14