Function:pushVRMLname

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:00, 16 December 2007
S2plot admin (Talk | contribs)

← Previous diff
Revision as of 22:03, 16 December 2007
S2plot admin (Talk | contribs)

Next diff →
Line 1: Line 1:
==pushVRMLname== ==pushVRMLname==
-Set the clipping plane expansion factor.+Push the given name onto the VRML name stack.
==Prototype== ==Prototype==

Revision as of 22:03, 16 December 2007

pushVRMLname

Push the given name onto the VRML name stack.

Prototype

void pushVRMLname(char *iname);

Description

Push the given name onto the VRML "name stack". When VRML data is written, it is written in "groups" with these names. The default group name is "ANON". To view the VRML output, which is written to a file called test.wrl, you will need a suitable VRML viewer for your operating system. VRML output is most useful for incorporating into 3d-PDF documents. See here for examples.

Not all geometry types are available for VRML output. Supported types include:

  • points
  • lines
  • 3-vertex facets (including transparent facets)
  • 4-vertex facets (including textured facets)
  • spheres
  • text

Note that the s2plot bounding box will not appear in VRML - you will need to create your own bounding box if required.

See Also

Code Example

#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"


int main(int argc, char *argv[])
{
   fprintf(stderr,"Press <shift>-<w> to write VRML\n");
   fprintf(stderr,"Creates VRML file: test.wrl\n");

   s2opend("/s2mono", argc, argv);      /* Open in mono mode */
   s2swin(-1.,1., -1.,1., -1.,1.);      /* Set the window coordinates */

   pushVRMLname("BOX");                 /* Create a new VRML object name */
   s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0);
                                        /* This will not appear in the VRML */

   int i, N = 100;                      /* Loop variables */
   XYZ xyz;                             /* Point location */
   COLOUR col;                          /* Point colour */

   pushVRMLname("POINTS");              /* Create a new VRML object name */
   for (i=0;i<N;i++) {
      xyz.x = drand48()*2.0 - 1.0;      /* Random positions */
      xyz.y = drand48()*2.0 - 1.0;
      xyz.z = drand48()*2.0 - 1.0;
      col.r = drand48()*2.0 - 1.0;      /* Random colours */
      col.g = drand48()*2.0 - 1.0;
      col.b = drand48()*2.0 - 1.0;
      ns2vthpoint(xyz, col, 2);         /* Draw current point */
   }
   pushVRMLname("ANON");                    /* Restore default VRML object name */

   s2show(1);                           /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools