Last Modified: 11/07/99 |
||||
|
||||
VRML by Hand or Program
Hand Coded VRMLYou can easily create VRML code by hand, or through a program such as Perl, if you know the syntax. You need only preface your code with the right header, give the resulting file the extension .wrl, and drag it over any browser window (if you have Cosmo Player) to see the result. Perhaps the easiest way to do this is:
return and newline
characters. The following is an expanded view of a valid VRML header
that shows each character. Note that return and
newline characters are represented by \r
and \n , respectively:
# V R M L V 2 . 0 u t f 8 \r \r \n \n # C r e a t e d w i t h V - R e a l m B u i l d e r v 2 . 1 \n # L i g o s C o r p o r a t i o n \n # w w w . l i g o s . c o m \n \nSo, lets assume that you have obtained a valid VRML header, say hdr.wrl , and have created a syntactically
correct program body named body.wrl . You create a
valid VRML file, named, say, my.wrl , as follows:
unix% cat hdr.wrl body.wrl > my.wrl A Perl VRML ProgramHere are two Perl programs that convert raw 3D data sets into VRML code that can be viewed in 3D with Cosmo Player. The first program, phase1, prepares raw 3D data for processing by the second program, phase2, which actually generates the VRML code. The procedure is described in this writeup. These programs should run on any Unix system.The system works like this:
phase1
and phase2 . For example, you may display most of
the points as size 4 in Blue, but select a special point to be
size 7 in Yellow, for emphasis. Or you may wish to run phase1
several time to extract different data sets and then combine them
into one data set for processwing by phase2 .
Here are a set of sample data files taken from SAS along with the VRML output that can be viewed with Cosmo Player. The files are:
|
||||
|
||||