Back to main page

Back to **draw-VTK**contents

This section shows how to draw isolated and connected points with the Maxima-VTK interface.

Once you have opened a Maxima session, load package **draw** and then set global variable **draw_renderer** to **vtk**:

load("draw") $ draw_renderer : 'vtk $

Draw 3D sample points. Valid values for **point_type** are: **dot**, **plus**, **multiply**, **asterisk**, **square**, **fille_square**, **sphere**, **cube**, **cylinder**, and **cone**.

/* read multivariate data from descriptive package */ s2 : read_matrix (file_search ("wind.data"))$ draw3d( point_size = 1/2, color = red, point_type = multiply, points(args(submatrix (s2, 4, 5))) )$

Isolated and connected points. Note that the **point_size**, which defaults to 1, the radius of the symbol, is an absolute measure in terms of the axes scales.

draw3d( /* points with default settings */ points([[2,1,6], [-2,3,5], [3,-1,-2], [1,2,3], [-2,5,0], [0,0,0]]), /* another set of points */ color = red, points_joined = true, point_type = filled_square, point_size = 1/3, points([[5,1,6], [1,3,5], [6,-1,-2], [4,2,3], [1,5,0], [3,0,0]]))$

Discrete data and explicit surface.

draw3d( points_joined = true, color = red, line_width = 2, point_size = 1/3, points([[1,2,1], [3,2,4], [4,1,-2], [0,0,5]]), color = blue, explicit(x^2+y^2, x,-2,2,y,-2,2)) $

Coloring points with palette and **enhanced3d** model.

draw3d( point_size = 1/2, point_type = 3, palette = [-4,-9,7], enhanced3d = [sqrt(k),k], /* here, k is the order index in the points object */ points_joined = true, points([[0,0,0], [1,1,1], [2,2,2], [3,3,3], [4,4,4], [5,5,5]]))$

Two samples with solid glyphs (in vtk's parlance).

draw3d( point_size = 1/2, point_type = cone, palette = gray, enhanced3d = [y,x,y,z], points_joined = true, points([[3,1,6], [-1,3,5], [4,-1,-2], [2,2,3], [-1,5,0], [1,0,0]]), point_size = 2/3, point_type = cube, palette = [5,12,-3], points_joined = false, points([[0,0,0], [1,1,1], [2,2,2], [3,3,3], [4,4,4], [5,5,5]]) )$

Joining points with different line types.

draw3d( line_width = 3, points_joined = true, point_type = dot, line_type = solid, color = blue, points([[0,0,0], [5,5,5]]), line_type = dots, color = red, points([[0,0,0], [-5,5,-5]]), line_type = dashes, color = green, points([[0,0,0], [5,-5,5]]), line_type = dot_dash, color = black, points([[0,0,0], [-5,-5,-5]]))$

Joining two points with a tube painted with a solid color.

draw3d( points_joined = true, point_type = dot, color = yellow, line_width = 0.05, line_type = tube, points([[0,0,0], [1,1,1]])) $

Joining two points with a tube painted with the **enhanced3d** model and default palette.

draw3d( points_joined = true, point_type = dot, enhanced3d = true, line_width = 0.05, line_type = tube, points([[0,0,0], [1,1,1]])) $

Joining a series of points with a tube painted with the **enhanced3d** model and a selected palette.

draw3d( points_joined = true, point_type = dot, enhanced3d = [z,x,y,z], line_width = 0.05, line_type = tube, palette = [33, -13, 10], points([[0,0,0], [1,1,1],[2,1,1],[2,2,1],[2,2,2],[2,2,3],[2,3,3]])) $

The colors of my football team.

draw3d( points_joined = true, point_type = dot, enhanced3d = true, line_width = 1/2, line_type = tube, palette = [white, blue, white, blue, white, blue], points([[0,0,0], [1,1,1],[2,2,2], [3,3,3], [4,4,4], [5,5,5]])) $

The benzene molecule, C_{6}H_{6}.

s: 5*sqrt(3)/2 $ v: 5*sqrt(3) $ draw3d( axis_3d = false, point_size = 0, color = yellow, points_joined = true, line_width = 0.3, line_type = tube, points([[0,10,0],[0,5,0],[s,5/2,0],[v,5,0]]), points([[v,-5,0],[s,-5/2,0],[0,-5,0],[0,-10,0]]), points([[-v,5,0],[-s,5/2,0],[-s,-5/2,0],[-v,-5,0]]), points([[0,5,1/2],[-s,5/2,1/2]]), points([[0,5,-1/2],[-s,5/2,-1/2]]), points([[-s,-5/2,1/2],[0,-5,1/2]]), points([[-s,-5/2,-1/2],[0,-5,-1/2]]), points([[s,5/2,1/2],[s,-5/2,1/2]]), points([[s,5/2,-1/2],[s,-5/2,-1/2]]), points_joined = false, /* Hydrogen */ color = red, point_type = sphere, point_size = 3, points([[0,10,0], [0,-10,0], [v,5,0], [v,-5,0], [-v,5,0], [-v,-5,0]]), font_size = 1, label(["H",0,10,1.7],["H",0,-10,1.7], ["H",v,5,1.7],["H",v,-5,1.7], ["H",-v,5,1.7],["H",-v,-5,1.7]), /* Carbon */ color = blue, points([[0,5,0], [0,-5,0], [s,5/2,0], [s,-5/2,0], [-s,5/2,0], [-s,-5/2,0]]), label(["C",0,5,1.7],["C",0,-5,1.7], ["C",s,5/2,1.7],["C",s,-5/2,1.7], ["C",-s,5/2,1.7],["C",-s,-5/2,1.7]) )$

When option **points_joined** is set to **impulses**, vertical lines are drawn from
each point to plane *z=0*.

s2 : read_matrix (file_search ("wind.data"))$ draw3d( point_size = 1/2, point_type = cube, enhanced3d = [y,x,y,z], palette = [5,12,-3], points_joined = impulses, color = red, /* for vertical segments */ points(args(submatrix (s2, 4, 5))) )$

Back to main page

Back to **draw-VTK** contents

by Mario Rodríguez Riotorto