plottools - Maple Programming Help

Home : Support : Online Help : System : Libraries and Packages : Deprecated Packages and Commands : Deprecated commands : plottools/vrml(deprecated)

plottools

 vrml
 three-dimensional plotting in VRML

 Calling Sequence vrml(plotstruct, file, options)

Parameters

 plotstruct - PLOT or PLOT3D data structure file - valid file name to write the resulting vrml code options - (optional) equations of the form option=value where option is one of anchor, background_color, camera, directional_light, emissive_color, material_binding, point_light, scene_info, shininess, smooth_shading, specular_color, spot_light, texture, tickback_color, tickfore_color, or transparency

Description

 • Important: The plottools[vrml] command has been deprecated. It may not support all possible plot structures. Use the export tools from the Standard GUI to export to the X3D format instead.
 • The special file name 'default' writes the VRML data to the standard output. This is useful in conjunction with a POST command to a CGI script on a web server.
 • Any additional arguments are interpreted as plot options specific to vrml.  Options are specified as equations of the form option = value. The following options are supported.

Options

 In the following discussion 'Color' is referred to numerous times.  'Color' is a color as defined in plot[color] (that is, red, blue, green, orange, white...), or 'Color' is an RGB color definition (that is, COLOR(RGB, 1, 1, 1) -> white) or 'Color' is a HUE color definition (that is, COLOR(HUE, 0.9) -> violet) or 'Color' is an HSV color definition (that is COLOR(HSV, 0.1, 0.9, 1.0) -> red).
 • $\mathrm{anchor}=[\mathrm{obj_no_1}=\mathrm{filename_1},...,\mathrm{obj_no_n}=\mathrm{filename_n}]$
 This option links VRML worlds together on the World Wide Web. Using links, one can connect a door in one's world to another VRML world described elsewhere on the web. obj_no_i where $1<=i<=n$ is the ith argument of plot.  filename_i is the location of the VRML format file to be linked to obj_no_i.
 • background_color=Color
 This option sets background color.  If no background color is specified, the default is black.  This option may be specified only once.
 • $\mathrm{camera}=\left[\mathrm{name},\left[\mathrm{xpos},\mathrm{ypos},\mathrm{zpos}\right],\left[\mathrm{xfrac},\mathrm{yfrac},\mathrm{zfrac},\mathrm{angle}\right]\right]$
 This option specifies a camera view point to view the VRML world.  The first camera defined is the default view point when the browser first loads the world.  Subsequent camera definitions can be selected by the user from the browser. name is a string containing no spaces and will appear as a name in the browser for selecting this camera.  xpos, ypos, and zpos are the coordinates of the camera's position. xfrac, yfrac, and zfrac compose a vector over which the camera is rotated by angle radians.
 • $\mathrm{directional_light}=\left[\mathrm{intensity},\mathrm{Color},\left[\mathrm{xdir},\mathrm{ydir},\mathrm{zdir}\right]\right]$
 Directional lights allow users to specify lights, which are positioned infinitely far away.  All light rays coming from the light source are parallel and point in the same direction.  In the real world, the sun is a directional light. intensity is a numeric which ranges from -1 to 1.  Negative values pull light from the scene.  The more negative the value, the more light is pulled from the world.  The more positive the value, the greater the intensity of the light source.  xdir, ydir, and zdir compose a vector that specifies the direction in which the light rays are pointed.  This option may be specified multiple times.
 • emissive_color=Color
 This option sets the color that the objects will radiate. emissive_color is useful for creating objects that appear to glow. This option can be specified only once.
 • material_binding=binding
 This option specifies how materials (colors) are bound to objects. binding takes two values: PER_VERTEX and PER_FACE.  PER_VERTEX means that each individual vertex has a color associated with it and polygons formed by these vertices have a color gradation that smoothly varies from one vertex to the next.  PER_VERTEX produces VRML files that are larger, more complex, but have better detail.  PER_FACE means that each polygon is given a solid color.  If material_binding is not specified, the default is PER_FACE.  This option can be specified only once.
 • $\mathrm{point_light}=\left[\mathrm{intensity},\mathrm{Color},\left[x,y,z\right]\right]$
 A point light is a light emanating from a point source in the world from which light is radiated in all directions.  The intensity is a numeric ranging from -1 to 1. Negative values let you pull light out of the world and make it look darker. The more negative the value, the darker the scene becomes.  The more positive the value of the intensity is, the brighter the point light is. x, y, and z specify the point in the world which the point light is positioned.  This option may be specified multiple times.
 • scene_info=string
 This option specifies a string that the VRML browser will display when the user asks for information on the vrml file.  This option can be specified only once.
 • shininess=value
 This option specifies the level at which objects reflect their light sources.  value must be a numeric value in the range 0 to 1.  A 0 value means objects appear as dull and matte.  Higher values mean that objects appear more and more shiny.  If this option is not specified, the default is 0. This option can be specified only once.
 When value is set to true, this option creates normals for each vertex of each face on a 3-D shape. By intentionally computing normals differently than those automatically computed by the VRML browser, one can make a faceted shape appear smooth. value is a boolean value, that is, true or false (the default is false). Note that this will take much more time and space when value is true.
 • specular_color=Color
 This option specifies the color that objects reflect by specular reflection. This controls the color of the highlight on shiny shapes. This option can be specified only once.  If this option is not specified the default is white.
 • $\mathrm{spot_light}=\left[\mathrm{intensity},\mathrm{Color},\left[\mathrm{xpos},\mathrm{ypos},\mathrm{zpos}\right],\left[\mathrm{xdir},\mathrm{ydir},\mathrm{zdir}\right],\mathrm{dr},\mathrm{co}\right]$
 A spotlight defines a cone of light.  Objects within the cone are illuminated, while objects not inside the cone of light are not affected. intensity is a numeric that ranges from -1 to 1.  Negative values pull light out of the world while positive values illuminate the world. The greater the magnitude of the intensity, the more effect it has. xpos, ypos, and zpos are coordinates that specify the position of the tip of the cone in the world.  xdir, ydir, and zdir form a vector specifying the direction in which the cone radiates from the point. dr, the drop off rate, is a numeric in the range 0 to 1 that specifies the rate at which the intensity drops as we move from the center of the cone to an edge. A value of 0 for dr means that objects in the middle of the cone and objects at the edge of the cone are illuminated with equal intensities of light.  A value of 1 for dr means that objects in the middle of the cone are illuminated with full intensity, but objects near the edge of the cone are hardly illuminated at all. co, the cut off angle, gives the spread angle in radians of the cone of light.  co must be a numeric in the range 0..2*Pi.  This option can be specified multiple times.
 • $\mathrm{texture}=[\mathrm{image}=\mathrm{filename},\mathrm{coords}=[[\mathrm{x1},\mathrm{y1}],[\mathrm{x2},\mathrm{y2}],[\mathrm{x3},\mathrm{y3}],...],\mathrm{transform}=\mathrm{translate}\left(x,y\right),\mathrm{rotate}\left(\mathrm{alpha}\right),\mathrm{scalefactor}\left(S,T\right),\mathrm{center}\left(x,y\right)]$
 This option allows texture-mapping on the object. filename is the location of the image texture (for example, gif file); coords specifies a shape using a list of 2-D coordinates; translate, rotate, and scalefactor specify the transformations that are going to be applied to the image texture with respect to center (for rotate and scalefactor).
 • tickback_color=Color
 Tickmarks in VRML are presented as cubes with the value of the tickmark written on all six sides.  This option specifies the color of the cube. The default is off-white.  This option can be specified only once.
 • tickfore_color=Color
 This option specifies the color of the text used to inscribe the value of the tickmark on the cube.  The default is dark green. This option can be specified only once.
 • transparency=value
 This option specifies the transparency of objects. value must be a numeric in the range 0 to 1.  0 means the objects will be opaque.  1 means objects will be transparent.  Values between 0 and 1 cause objects to appear translucent.  This option can be specified only once.
 Note: The transparency option is not available in all interfaces.
 • The standard file extension for VRML data files is '.wrl'

Examples

Important: The plottools[vrml] command has been deprecated. It may not support all possible plot structures. Use the export tools from the Standard GUI to export to the X3D format instead.

 > $\mathrm{with}\left(\mathrm{plottools}\right):$
 > $\mathrm{vrml}\left(\mathrm{plot3d}\left(\mathrm{sin}\left(xy\right)\cdot 2,x=-\mathrm{π}..\mathrm{π},y=-\mathrm{π}..\mathrm{π},\mathrm{axes}=\mathrm{NORMAL},\mathrm{lightmodel}=\mathrm{light2}\right),\mathrm{plot1.wrl}\right)$
 > $\mathrm{vrml}\left(\mathrm{plot}\left({x}^{2},x=-2..2\right),\mathrm{plot2.wrl},\mathrm{scene_info}=\mathrm{x^2}\right)$
 > $\mathrm{vrml}\left(\mathrm{plot3d}\left(\mathrm{sin}\left({x}^{2}{y}^{2}\right),x=-\frac{\mathrm{π}}{2}..\frac{\mathrm{π}}{2},y=-\frac{\mathrm{π}}{2}..\frac{\mathrm{π}}{2}\right),\mathrm{plot3.wrl},\mathrm{background_color}=\mathrm{COLOR}\left(\mathrm{RGB},1,1,1\right)\right)$

3-D geometry objects are particularly interesting viewed from VRML

 > $\mathrm{geom3d}[\mathrm{point}]\left(o,0,0,0\right):$$r≔1.:$
 > $\mathrm{geom3d}[\mathrm{GreatRhombiicosidodecahedron}]\left(\mathrm{p1},o,r\right):$
 > $\mathrm{geom3d}[\mathrm{duality}]\left(\mathrm{dp1},\mathrm{p1},\mathrm{geom3d}[\mathrm{sphere}]\left(\mathrm{s1},\left[o,\mathrm{geom3d}[\mathrm{MidRadius}]\left(\mathrm{p1}\right)\right]\right)\right)$
 ${\mathrm{dp1}}$ (1)
 > $\mathrm{c1}≔\mathrm{COLOR}\left(\mathrm{RGB},1.00,0.50,0.50\right):$$\mathrm{c2}≔\mathrm{COLOR}\left(\mathrm{RGB},0.50,0.00,0.05\right):$
 > $\mathrm{pic}≔\mathrm{geom3d}[\mathrm{draw}]\left(\left[\mathrm{p1}\left(\mathrm{color}=\mathrm{c1}\right),\mathrm{dp1}\left(\mathrm{color}=\mathrm{c2}\right)\right],\mathrm{cutout}=\frac{7}{8},\mathrm{lightmodel}=\mathrm{light2},\mathrm{orientation}=\left[0,31\right]\right):$
 > $\mathrm{vrml}\left(\mathrm{pic},\mathrm{Rhombii.wrl},\mathrm{shininess}=0.5,\mathrm{specular_color}=\mathrm{COLOR}\left(\mathrm{RGB},1,1,1\right)\right):$

3-D Parametric plot

 > $\mathrm{c1}≔\left[\mathrm{cos}\left(x\right)-2\mathrm{cos}\left(0.4y\right),\mathrm{sin}\left(x\right)-2\mathrm{sin}\left(0.4y\right),y\right]:$
 > $\mathrm{c2}≔\left[\mathrm{cos}\left(x\right)+2\mathrm{cos}\left(0.4y\right),\mathrm{sin}\left(x\right)+2\mathrm{sin}\left(0.4y\right),y\right]:$
 > $\mathrm{c3}≔\left[\mathrm{cos}\left(x\right)+2\mathrm{sin}\left(0.4y\right),\mathrm{sin}\left(x\right)-2\mathrm{cos}\left(0.4y\right),y\right]:$
 > $\mathrm{c4}≔\left[\mathrm{cos}\left(x\right)-2\mathrm{sin}\left(0.4y\right),\mathrm{sin}\left(x\right)+2\mathrm{cos}\left(0.4y\right),y\right]:$
 > $\mathrm{pic}≔\mathrm{plot3d}\left(\left\{\mathrm{c1},\mathrm{c2},\mathrm{c3},\mathrm{c4}\right\},x=0..2\mathrm{π},y=0..10,\mathrm{grid}=\left[25,15\right],\mathrm{style}=\mathrm{patch},\mathrm{lightmodel}=\mathrm{light4}\right):$
 > $\mathrm{vrml}\left(\mathrm{pic},\mathrm{Tubes.wrl},\mathrm{transparency}=0.5\right)$

plottools objects colored with lightsources

 > $\mathrm{with}\left(\mathrm{plots}\right):$
 > midpoint := proc(x)      local v, n, g, i;      v := [op(x),x[1] ];    n := nops( x );      g := ( a, b) -> 1/2*( a + b ) :      [ seq( g( v[i], v[i+1] ), i=1..n)]; end proc:
 > $\mathrm{Conchoid}≔\mathrm{tubeplot}\left(\left[\frac{\left(t-5\mathrm{π}\right)\mathrm{sin}\left(t\right)}{3},\frac{\left(t-5\mathrm{π}\right)\mathrm{cos}\left(t\right)}{3},\left(t-5\mathrm{π}\right)\cdot 0.9,t=0..5\mathrm{π}\right],\mathrm{radius}=\left(t-5\mathrm{π}\right)\cdot 0.2,\mathrm{tubepoints}=25\right):$
 > $\mathrm{ConchoidPolys}≔\mathrm{convert}\left(\mathrm{op}\left(1,\mathrm{Conchoid}\right),\mathrm{POLYGONS}\right):$
 > $\mathrm{vrml}\left(\mathrm{display}\left(\mathrm{map}\left(\mathrm{midpoint},\mathrm{ConchoidPolys}\right),\mathrm{scaling}=\mathrm{constrained},\mathrm{style}=\mathrm{patchnogrid},\mathrm{color}=\mathrm{COLOR}\left(\mathrm{RGB},1,1,1\right)\right),\mathrm{conchoid.wrl},\mathrm{point_light}=\left[1.0,\mathrm{COLOR}\left(\mathrm{RGB},0,0,1\right),\left[0,0,20\right]\right],\mathrm{spot_light}=\left[1.0,\mathrm{COLOR}\left(\mathrm{RGB},1,1,0\right),\left[-40,0,-7.5\right],\left[1,0,0\right],0.8,1.57\right],\mathrm{spot_light}=\left[1.0,\mathrm{COLOR}\left(\mathrm{RGB},0,1,1\right),\left[20.07,34.6,-7.5\right],\left[-20.07,-34.6,0\right],0.8,1.57\right],\mathrm{spot_light}=\left[1.0,\mathrm{COLOR}\left(\mathrm{RGB},0,1,0\right),\left[20.07,-34.6,-7.5\right],\left[-20.07,34.6,0\right],0.8,1.57\right],\mathrm{directional_light}=\left[1.0,\mathrm{COLOR}\left(\mathrm{RGB},1,0,0\right),\left[0,0,1\right]\right]\right)$

Apply smooth shading to the object

 > $\mathrm{vrml}\left(\mathrm{plot3d}\left(\mathrm{sin}\left(xy\right),x=-\mathrm{π}..\mathrm{π},y=-\mathrm{π}..\mathrm{π},\mathrm{color}=\mathrm{blue}\right),\mathrm{sin.wrl},\mathrm{smooth_shading}=\mathrm{true}\right)$

Anchor option

 > $\mathrm{geom3d}[\mathrm{tetrahedron}]\left(\mathrm{t1},\mathrm{geom3d}[\mathrm{point}]\left(o,0,0,0\right),1.\right):$
 > $\mathrm{geom3d}[\mathrm{tetrahedron}]\left(\mathrm{t2},o,1.0001\right):$
 > $\mathrm{vrml}\left(\mathrm{geom3d}[\mathrm{draw}]\left(\left[\mathrm{t2},\mathrm{t1}\right],\mathrm{tickmarks}=\left[3,3,3\right],\mathrm{axes}=\mathrm{frame}\right),\mathrm{link.wrl},\mathrm{tickback_color}=\mathrm{brown},\mathrm{tickfore_color}=\mathrm{yellow}\right)$

Create the VRML world for the tetrahedron t with center (-2,2,1), radius of the circum-sphere 1., and link t1 to "link.wrl"

 > $\mathrm{vrml}\left(\mathrm{geom3d}[\mathrm{draw}]\left(\mathrm{geom3d}[\mathrm{tetrahedron}]\left(t,\mathrm{geom3d}[\mathrm{point}]\left(\mathrm{o1},-2,2,1\right),1.\right),\mathrm{orientation}=\left[-109,52\right],\mathrm{color}=\mathrm{COLOR}\left(\mathrm{RGB},0.9335294125,0.9129411760,0.5205882350\right)\right),\mathrm{main.wrl},\mathrm{anchor}=\left[1="link.wrl"\right]\right)$

References

 The VRML Sourcebook. New York: John Wiley & Sons, 1996.