plotttols,vrml - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim





three-dimensional plotting in VRML


Calling Sequence






Calling Sequence

vrml(plotstruct, file, options)




PLOT or PLOT3D data structure



valid file name to write the resulting vrml code



(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



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.



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).




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.




This option sets background color.  If no background color is specified, the default is black.  This option may be specified only once.




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.




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.




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.




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.




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.




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.




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.




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.




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.




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).




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.




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.




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'


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.





3-D geometry objects are particularly interesting viewed from VRML









3-D Parametric plot







plottools objects colored with lightsources


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:




Apply smooth shading to the object


Anchor option

Create a link




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"




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

See Also