Graphics`ThreeScript`
3Script is a file format for transferring descriptions of threedimensional graphics objects from Mathematica to other programs. All Mathematica kernels have the ability to render threedimensional images into the PostScript page description language. For certain applications, it is desirable to have a description of the image that retains the threedimensional character that is lost when rendering into PostScript. The package Graphics`ThreeScript` supplies a number of utilities for writing suitable Mathematica objects into 3Script format files.
This loads the package.
In[1]:= <<Graphics`ThreeScript`
This constructs a Graphics3D object.
In[2]:= obj = Graphics3D[ Polygon[{{0,0,0}, {0,1,0}, {0,1,1}}]]
Out[2]=
This writes the 3Script format into the file object.ts. Note that the filename is returned.
In[3]:= ThreeScript[ "object.ts", obj]
Out[3]=
This shows the contents of the file.
In[4]:= !!object.ts
"% Graphics3D objects
boundingbox
0 0 0
0 1 1
viewpoint
1.3 2.4 2.
ambientlight
0 0 0
lightsources
1. 0. 1.
1 0 0
1. 1. 1.
0 1 0
0. 1. 1.
0 0 1
polygon
0 0 0
0 1 0
0 1 1"
The 3Script format works with all threedimensional primitives and directives. This includes both Graphics3D and SurfaceGraphics objects. Note that in the 3Script format information such as coordinates appears below the command name.
Standard 3Script descriptions of threedimensional objects.
3Script commands used as global directives.
3Script is used by the Mathematica command Live that is available on platforms that support the GL library, such as Silicon Graphics computers. A 3Script format file is written and this is passed to an external renderer to process. An alternative method you can use to pass a threedimensional structure, or indeed any Mathematica expression into an external program, is to use the MathLink communications protocol.
A complete description of the 3Script file format is contained in the Wolfram Research technical report, The 3Script File Format, which can be found in the Mathematica Information Center, at http://library.wolfram.com; search the collection for `threescript'.
