Back to draw-VTK

'draw'-VTK interface:
object vector


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

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

To read the documentation on object vector, write the following sentence:

describe(vector) $

Two vectors:

draw3d(
  color       = yellow,
  head_length = 0.5,
  line_width  = 0.1,
  vector([0,0,0],[1,0,0]),

  color      = cyan,
  head_angle = 10,
  line_width = 0.03,
  vector([0,1,0],[-3,0,0]))$
vtkvect1

Since we are using here option unit_vectors = true, all three vector are plotted with modulus one:

draw3d(
  color = white,
  explicit(x^2+y^2, x, -1, 0, y, -1, 1),

  head_length  = 0.3,
  line_width   = 0.01,
  head_angle   = 10,
  unit_vectors = true,

  color = yellow,
  vector([0,0,0],[10,0,0]),
  color = cyan,
  vector([0,0,0],[0,7,0]),
  color = red,
  vector([0,0,0],[0,0,6]) )$
vtkvect2

Two screenshots of a vector field. Function draw3d admits as arguments lists of options and objects:

/* Define vector field */
coord: setify(makelist(k,k,1,5))$
points3d: listify(cartesian_product(coord,coord,coord))$
vf3d(x,y,z):= vector([x,y,z],2*[sin(x),cos(y),log(z)])$

/*list of vector objects*/
vect3: makelist(vf3d(k[1],k[2],k[3]),k,points3d)$

draw3d(
  [head_length  = 0.2,
   line_width   = 0.01,
   color        = cyan,
   head_angle   = 10,
   unit_vectors = true],

   vect3)$

A general view:

vtkvect3

Zoom is provided by clicking with the mouse right button:

vtkvect4

The colored arrows indicate the positive directions of the axes. In this example both the cone and the cylinder point to a common random direction:

d: [random(2.0)-1,random(2.0)-1,random(2.0)-1]$

draw3d(
    head_length = 0.5,
    line_width  = 0.1,
    capping     = true,
    axis_3d     = false,
    
    /* x- axis */
    color = red,
    vector([-8,0,0],[16,0,0]),
    
    /* y- axis */
    color = green,
    vector([0,-8,0],[0,16,0]),
    
    /* z- axis */
    color = blue,
    vector([0,0,-8],[0,0,16]),
    
    color = white,
    cylinder([0,0,0],0.5,16,d),
    cone([0,0,0],3,5,d) ) $
vtkvect5

© 2011-2016, TecnoStats.