Function:pushVRMLname
From S2PLOT
(Difference between revisions)
Revision as of 21:58, 16 December 2007 S2plot admin (Talk | contribs) ← Previous diff |
Current revision S2plot admin (Talk | contribs) |
||
Line 1: | Line 1: | ||
==pushVRMLname== | ==pushVRMLname== | ||
- | Set the clipping plane expansion factor. | + | Push the given name onto the VRML name stack. |
==Prototype== | ==Prototype== | ||
<code><pre> | <code><pre> | ||
- | void ss2snfe(float expand); | + | void pushVRMLname(char *iname); |
</pre></code> | </pre></code> | ||
==Description== | ==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 <tt>test.wrl</tt>, you will need a suitable VRML viewer for your operating system. VRML output is most useful for incorporating into 3d-PDF documents. See [http://astronomy.swin.edu.au/s2plot/3d-pdf | here] for examples. | + | 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 <tt>test.wrl</tt>, you will need a suitable VRML viewer for your operating system. VRML output is most useful for incorporating into 3d-PDF documents. See [http://astronomy.swin.edu.au/s2plot/3d-pdf 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 == | == See Also == | ||
Line 19: | Line 29: | ||
#include <stdio.h> | #include <stdio.h> | ||
#include <stdlib.h> | #include <stdlib.h> | ||
+ | #include <time.h> | ||
#include "s2plot.h" | #include "s2plot.h" | ||
Line 27: | Line 38: | ||
fprintf(stderr,"Creates VRML file: test.wrl\n"); | fprintf(stderr,"Creates VRML file: test.wrl\n"); | ||
+ | srand48((long)time(NULL)); /* Seed random numbers */ | ||
s2opend("/s2mono", argc, argv); /* Open in mono mode */ | s2opend("/s2mono", argc, argv); /* Open in mono mode */ | ||
s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */ | s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */ | ||
Line 48: | Line 60: | ||
ns2vthpoint(xyz, col, 2); /* Draw current point */ | ns2vthpoint(xyz, col, 2); /* Draw current point */ | ||
} | } | ||
- | pushVRMLname(""); /* Restore default VRML object name */ | + | pushVRMLname("ANON"); /* Restore default VRML object name */ |
s2show(1); /* Open the s2plot window */ | s2show(1); /* Open the s2plot window */ | ||
Line 54: | Line 66: | ||
return 1; | return 1; | ||
} | } | ||
+ | |||
</pre></code> | </pre></code> | ||
[[S2PLOT:Function List | Back]] to S2PLOT function list. | [[S2PLOT:Function List | Back]] to S2PLOT function list. | ||
__NOTOC__ | __NOTOC__ | ||
__NOEDITSECTION__ | __NOEDITSECTION__ |
Current revision
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 <time.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");
srand48((long)time(NULL)); /* Seed random numbers */
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.