cmss Functions for building objects from scratch

We now describe some functions that create VRML objects, starting by those used in the first example, Figure 1 (left). The displayed scene consists of four elements :

  1. A surface, obtained with the vrml_surf () command, which is the object of interest.
  2. A reference frame, obtained with the vrml_frame () command, which indicates the orientation in which the data considered.
  3. Some lights , obtained with the vrml_PointLight () command, in order to light the scene.
  4. A background, obtained with the vrml_Background () command, to specify the grayish-blue color, rather than the browser's default black.
We now describe each function in turn :

 
Translations -or positions- will always be represented by a vector of 3 elements. Orientations -or rotations- are also represented by a 3-element vector whose direction defines the axis of the rotation and whose norm (as returned by norm(rot)) defines the angle, in radians.
 
Extra options can be passed as a key-value pair :

s = vrml_PointLight (...)
and
s = vrml_Background (...)
are low level functions that return simple VRML objects (``nodes'', in VRML lingo). All the VRML characteristics (``fields'') can be set by using key-value pairs. We describe some of the options that can be passed to vrml_Background(); the others are displayed by doing help vrml_Background().

"skyColor", RGB
\( 3\times 1 \) and
"groundColor", RGB
\( 3\times 1 \) specify the RGB color of the sky and ground, respectively.

Figure 2: Left: A checkered surface obtained by the variant of Listing 1.
Middle: An XYZ frame with axes colored red, blue and green, obtained by running Listing 3.
Right: A set of points connected by black and white cylinders and the same set of points, scaled down by half along the Y and Z axes (Listing 4).
\resizebox*{0.3\textwidth}{!}{\includegraphics{figures/freewrl-checker-snap-3.eps2}}  \resizebox*{0.3\textwidth}{!}{\includegraphics{figures/frame-sky-snap.eps2}}  \resizebox*{0.3\textwidth}{!}{\includegraphics{figures/cyl-balls-snap-2.eps2}}

The following listing and Figure 2, middle, show an example of the usage of vrml_frame(), vrml_Background(), and vrml_browse().



Subsections
Søren Hauberg 2009-06-07