Back to draw-VTK

'draw'-VTK interface:
object implicit


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 implicit, write the following sentence:

describe(implicit) $

Implicit surface colored with solid color:

draw3d(
  color = yellow,
  implicit(x^2+y^3+sin(z)=1,x,-1.2,1.2,y,-1.2,1.2,z,-1.2,1.5) ) $
vtkimp1

Implicit surface colored with the enhanced3d model and default palette:

draw3d(
  enhanced3d = true,
  implicit(x^2+y^2+sin(z)=1,x,-1.2,1.2,y,-1.2,1.2,z,-1.2,1.5) ) $
vtkimp2

Implicit surface colored with the enhanced3d model, where both the scalar levels and the palette are defined by the user:

draw3d(
  enhanced3d = [sin(2*y), x, y, z],
  palette    = [25,-23,-17],
  implicit(cos(x)+y^2+sin(z)=1,x,-1.2,1.2,y,-1.2,1.2,z,-1.2,1.5) ) $
vtkimp3

Transparent surface. We can control the resolution with options x_voxel, y_voxel and x_voxel:

draw3d(
   x_voxel    = 12,
   y_voxel    = 12,
   z_voxel    = 12,
   opacity    = 0.6,
   palette    = gray,
   enhanced3d = [sin(x+y-z),x,y,z],
   implicit((x^2+y^2+z^2-1)*(x^2+(y-1.5)^2+z^2-0.5)=0.015,
                x,-1,1,y,-1.2,2.3,z,-1,1) ) $
vtkimp4

Local option wired_surface on an implicit object:

draw3d(
  enhanced3d    = true,
  wired_surface = true,
  palette       = [15, -4, 20],
  implicit((x^2+y^2+z^2-1)*(x^2+(y-1.5)^2+z^2-0.5)=0.015,
           x,-1,1,y,-1.2,2.3,z,-1,1)) $
wired3

Two implicit surfaces. The second one is a transformation of the sphere:

draw3d(
  color = red,
  implicit(x^2+y^2+z^2=1,x,-1.2,1.2,y,-1.2,1.2,z,-1.2,1.2),

  transform  = [2+1/3*x, 2+1/2*y, 2+3/2*z, x, y, z],
  palette    = [5, -17, 6],
  enhanced3d = sin(x-y+z), 
  implicit(x^2+y^2+z^2=1,x,-1.2,1.2,y,-1.2,1.2,z,-1.2,1.2)) $
vtkimp5

Another example:

draw3d(
   enhanced3d   = true,
   x_voxel      = 50,
   y_voxel      = 50,
   z_voxel      = 50,
   implicit(2=(cos(x+%phi*y)+cos(x-%phi*y)+cos(y+%phi*z)+
               cos(y-%phi*z)+cos(z-%phi*x)+cos(z+%phi*x) ),
            x,-4.5,4.5,y,-4.5,4.5,z,-4.5,4.5))$
vtkimp6

Viviani's curve, the intersection of the sphere of radius 2 centered at (0,0,0), and the cylinder of radius 1 centered at (1,0,0):

draw3d(
    axis_3d    = false,

    /* Viviani's curve */
    line_type = tube,
    line_width = 0.1,
    nticks = 50,
    parametric(1+cos(t), sin(t), 2*sin(t/2), t, 0, 4*%pi),

    /* cylinder centered at (1,0,0), r=1 */
    color = red,
    x_voxel = 30, y_voxel = 30 , z_voxel = 30,
    implicit((x-1)^2+y^2=1, x, -0.1, 2.1, y, -1.1, 1.1, z, -2.1, 2.1),

    /* sphere  centered at (0,0,0), r=2 */
    color = yellow,
    opacity = 0.7,
    implicit(x^2+y^2+z^2=4, x, -2.1, 2.1, y, -2.1, 2.1, z, -2.1, 2.1)  )$
viviani

Isolines on an implicit surface. See also the effect of option opacity.

draw3d(
  x_voxel    = 20,
  y_voxel    = 20,  
  z_voxel    = 20,  
  palette    = gray,
  opacity    = 0.8,
  enhanced3d = true,
  isolines   = [x^2-y^2+z^3,x,y,z],
  line_width = 3,
  implicit(max(x^2+y^2+z^2,2*x^2+2*y^2)=1,
           x,-1.5,1.5,y,-1.5,1.5,z,-1.5,1.5) )$
iso10

© 2011-2017, TecnoStats.